Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- master
paths:
- ".github/workflows/ci.yml"
- "pyproject.toml"
- "mypy.ini"
- "**/*.py"
pull_request:
paths:
- ".github/workflows/ci.yml"
- "pyproject.toml"
- "mypy.ini"
- "**/*.py"

concurrency:
# Cancel previous runs for the same PR
# Don't cancel successive pushes to master
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
mypy:
runs-on: ${{ matrix.os }}
timeout-minutes: &timeout-minutes 5
strategy:
# mypy is os and python-version sensitive. Test on all supported combinations
matrix:
# Arm runners are faster (as long as the same wheels are available)
os: [windows-11-arm, ubuntu-24.04-arm, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
fail-fast: false
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v8.2.0
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- run: uv sync --locked
- run: mypy . --python-version=${{ matrix.python-version }}
29 changes: 0 additions & 29 deletions .github/workflows/type-checking.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist/
/make_wheel.bat
/pip_make.bat
/pip_upload.bat
.python-version
10 changes: 7 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
os: ubuntu-24.04 # Keep in sync with runs-on in .github/workflows/ci.yml
tools:
python: "3.11"
python: "3.14" # Keep in sync with python-version in .github/workflows/ci.yml
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
Expand All @@ -32,4 +32,8 @@ sphinx:
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: requirements.txt
# https://docs.readthedocs.com/platform/latest/build-customization.html#install-dependencies-with-uv
- method: uv
command: sync
groups:
- docs
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Danie10 - https://github.com/Danie10
SamuMazzi - https://github.com/SamuMazzi
lappely - https://github.com/poipoiPIO
odknt - https://github.com/odknt
Avasam - https://github.com/Avasam

In general, all those who so generously share their work and knowledge on Internet (stackoverflow, github, ...)
so I could find a solution or a string to pull!
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# PyMonCtl
[![Type Checking](https://github.com/Kalmat/PyMonCtl/actions/workflows/type-checking.yml/badge.svg)](https://github.com/Kalmat/PyMonCtl/actions/workflows/type-checking.yml)
[![CI](https://github.com/Kalmat/PyMonCtl/actions/workflows/ci.yml/badge.svg)](https://github.com/Kalmat/PyMonCtl/actions/workflows/ci.yml)
[![PyPI version](https://badge.fury.io/py/PyMonCtl.svg)](https://badge.fury.io/py/PyMonCtl)
[![Documentation Status](https://readthedocs.org/projects/pymonctl/badge/?version=latest)](https://pymonctl.readthedocs.io/en/latest/?badge=latest)

Expand All @@ -15,7 +15,7 @@ Additional tools/extensions/APIs used:
- VCP MCCS API interface
- macOS:
- pmset command-line tool


## General Features

Expand Down Expand Up @@ -204,17 +204,17 @@ Example:

## Install <a name="install"></a>

To install this module on your system, you can use pip:
To install this module on your system, you can use pip:

pip install pymonctl
python -m pip install pymonctl

or
or using uv:

python3 -m pip install pymonctl
uv add pymonctl

Alternatively, you can download the wheel file (.whl) available in the [Download page](https://pypi.org/project/PyMonCtl/#files) and the [dist folder](https://github.com/Kalmat/PyMonCtl/tree/master/dist), and run this (don't forget to replace 'x.x.xx' with proper version number):

pip install PyMonCtl-x.x.xx-py3-none-any.whl
python -m pip install PyMonCtl-x.x.xx-py3-none-any.whl

You may want to add `--force-reinstall` option to be sure you are installing the right dependencies version.

Expand All @@ -233,12 +233,16 @@ If you want to use this code or contribute, you can either:
* Create a fork of the [repository](https://github.com/Kalmat/PyMonCtl), or
* [Download the repository](https://github.com/Kalmat/PyMonCtl/archive/refs/heads/master.zip), uncompress, and open it on your IDE of choice (e.g. PyCharm)

Be sure you install all dependencies described on `requirements.txt` by using pip

python3 -m pip install -r requirements.txt
Be sure you install all dev dependencies by running:

uv sync

or
python -m venv .venv
python -m pip install -e . --group=dev

## Test <a name="test"></a>

To test this module on your own system, cd to `tests` folder and run:

python3 test_pymonctl.py
uv run test_pywinctl.py
21 changes: 21 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[mypy]
mypy_path = src/, typings/
exclude = build/, dist/
strict = True

# Leverage type inference for function return type
disallow_untyped_calls = False
disallow_incomplete_defs = False
disallow_untyped_defs = False

disable_error_code =
# https://github.com/python/mypy/issues/6232 (redefinition with correct type)
attr-defined, assignment,

# https://github.com/ronaldoussoren/pyobjc/issues/198
# https://github.com/ronaldoussoren/pyobjc/issues/417
# https://github.com/ronaldoussoren/pyobjc/issues/419
[mypy-objc.*]
follow_untyped_imports = True
[mypy-Quartz.*]
allow_any_generics = True
82 changes: 82 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[build-system]
requires = ["uv_build>=0.11.21,<0.12"]
build-backend = "uv_build"

[project.urls]
Homepage = "https://github.com/Kalmat/PyMonCtl"
Repository = "https://github.com/Kalmat/PyMonCtl.git"
Issues = "https://github.com/Kalmat/PyMonCtl/issues"
Changelog = "https://github.com/Kalmat/PyMonCtl/blob/HEAD/CHANGES.txt"
Documentation = "https://pymonctl.readthedocs.io/"

[project]
name = "PyMonCtl"
version = "0.92"
description = "Cross-Platform toolkit to get info on and control monitors connected"
authors = [
{ name = "Kalmat", email = "palookjones@gmail.com" },
]
readme = "README.md"
license = "BSD-3-Clause"
license-files = ["LICENSE.txt"]
requires-python = ">=3.9"
keywords = [
"screen",
"display",
"monitor",
"control",
"geometry",
"size",
"position",
"frequency",
"scale",
"orientation",
"screen-size",
"mouse-position",
]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Win32 (MS Windows)",
"Environment :: X11 Applications",
"Environment :: MacOS X",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dependencies = [
"pywin32>=302; sys_platform == 'win32'",
"python-xlib>=0.21; sys_platform == 'linux'",
"ewmhlib>=0.2; sys_platform == 'linux'",
"pyobjc>=8.1; sys_platform == 'darwin'",
"typing_extensions>=4.4.0",
]

[dependency-groups]
docs = [
"myst-parser",
]
dev = [
{ include-group = "docs" },
"ewmhlib",
"mypy>=0.990,<2",
"types-python-xlib>=0.32",
# types-pywin32>=312.0.0.20260609 doesn't support Python 3.9
# and produces a difference in typing, keep stable typing as long as we support Python 3.9
"types-pywin32<312.0.0.20260609",
"typing_extensions>=4.4.0",
]

[tool.uv]
exclude-newer = "1 week"
[tool.uv.exclude-newer-package]
# Kalmat owns these packages
ewmhlib = false
8 changes: 0 additions & 8 deletions requirements.txt

This file was deleted.

22 changes: 0 additions & 22 deletions setup.cfg

This file was deleted.

72 changes: 0 additions & 72 deletions setup.py

This file was deleted.

3 changes: 2 additions & 1 deletion src/pymonctl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from importlib.metadata import version as _importlib_version

__all__ = [
"getAllMonitors", "getAllMonitorsDict", "getMonitorsCount", "getPrimary",
Expand All @@ -11,7 +12,7 @@
"DisplayMode", "ScreenValue", "Size", "Point", "Box", "Rect", "Position", "Orientation"
]

__version__ = "0.92"
__version__ = _importlib_version("pymonctl")


def version(numberOnly: bool = True) -> str:
Expand Down
Loading
Loading