Skip to content

Commit fb20014

Browse files
authored
Merge pull request #98 from Avasam/PEP-735
Migrate dependency management to PEP 735 + Add sphinx build CI check
2 parents 9d06c4d + 72d62b8 commit fb20014

8 files changed

Lines changed: 71 additions & 65 deletions

File tree

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
paths:
9+
- ".github/workflows/type-checking.yml"
10+
- "docs/**"
11+
- ".readthedocs.yaml"
12+
- "pyproject.toml"
13+
- "setup.cfg"
14+
- "**/*.py"
15+
pull_request:
16+
paths:
17+
- ".github/workflows/type-checking.yml"
18+
- "docs/**"
19+
- ".readthedocs.yaml"
20+
- "pyproject.toml"
21+
- "setup.cfg"
22+
- "**/*.py"
23+
24+
jobs:
25+
mypy:
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
matrix:
29+
os: [windows-latest, ubuntu-latest, macos-latest]
30+
python-version: ["3.10"]
31+
fail-fast: false
32+
steps:
33+
- uses: actions/checkout@v4
34+
- uses: actions/setup-python@v6
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
- run: pip install . --group=dev
38+
- run: mypy . --python-version=${{ matrix.python-version }}
39+
40+
sphinx:
41+
runs-on: ubuntu-22.04 # Keep in sync with build.os in .readthedocs.yaml
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: actions/setup-python@v6
45+
with:
46+
python-version: "3.11" # Keep in sync with build.tools.python in .readthedocs.yaml
47+
- run: pip install . --group=docs
48+
- name: Build docs
49+
# TODO: Add --fail-on-warning, but still too many warnings right now
50+
run: sphinx-build --keep-going -b html docs/source docs/_build/html

.github/workflows/type-checking.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.readthedocs.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@ version: 2
66

77
# Set the OS, Python version and other tools you might need
88
build:
9-
os: ubuntu-22.04
9+
os: ubuntu-22.04 # Keep in sync with runs-on in .github/workflows/docs.yml
1010
tools:
11-
python: "3.11"
11+
python: "3.11" # Keep in sync with python-version in .github/workflows/docs.yml
1212
# You can also specify other tool versions:
1313
# nodejs: "20"
1414
# rust: "1.70"
1515
# golang: "1.20"
16+
jobs:
17+
install:
18+
# Since the install step is overridden, pip is no longer updated automatically.
19+
- pip install --upgrade pip
20+
- pip install . --group=docs
1621

1722
# Build documentation in the "docs/" directory with Sphinx
1823
sphinx:
@@ -26,10 +31,3 @@ sphinx:
2631
# formats:
2732
# - pdf
2833
# - epub
29-
30-
# Optional but recommended, declare the Python requirements required
31-
# to build your documentation
32-
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
33-
python:
34-
install:
35-
- requirements: requirements.txt

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ If you want to use this code or contribute, you can either:
252252
* Create a fork of the [repository](https://github.com/Kalmat/PyWinCtl), or
253253
* [Download the repository](https://github.com/Kalmat/PyWinCtl/archive/refs/heads/master.zip), uncompress, and open it on your IDE of choice (e.g. PyCharm)
254254

255-
Be sure you install all dependencies described on "requirements.txt" by using pip
255+
Be sure you install all dev dependencies by using pip: `pip install -e . --group=dev`
256256

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

pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@ dependencies = [
6161
"typing_extensions>=4.4.0",
6262
]
6363

64-
[project.optional-dependencies]
65-
dev = [
66-
"ewmhlib>=0.2",
67-
"mypy>=0.990",
64+
[dependency-groups]
65+
docs = [
6866
"myst-parser",
67+
]
68+
dev = [
69+
{include-group = "docs"},
70+
"ewmhlib",
71+
"mypy>=0.990,<2",
6972
"types-python-xlib>=0.32",
7073
"types-pywin32>=305.0.0.3",
7174
"types-setuptools>=65.5",
@@ -78,4 +81,4 @@ Homepage = "https://github.com/Kalmat/PyWinCtl"
7881
where = ["src"] # list of folders that contain the packages (["."] by default)
7982

8083
[tool.setuptools.dynamic]
81-
version = {attr = "pywinctl.__version__"} # any module attribute compatible with ast.literal_eval
84+
version = {attr = "pywinctl.__version__"} # any module attribute compatible with ast.literal_eval

requirements.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

setup.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
description_file = README.md
33

44
[mypy]
5-
python_version = 3.8
5+
python_version = 3.9
66
mypy_path = src/, typings/
7+
exclude = build
78
strict = True
89

910
# Leverage type inference for function return type
@@ -16,7 +17,7 @@ disallow_untyped_defs=False
1617
warn_unused_ignores = False
1718

1819
disable_error_code =
19-
# https://github.com/python/mypy/issues/6232 (redifinition with correct type)
20+
# https://github.com/python/mypy/issues/6232 (redefinition with correct type)
2021
attr-defined, assignment,
2122
# https://github.com/python/mypy/issues/13975 (@property mistaken as Callable)
2223
comparison-overlap, truthy-function

setup.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import io
22
import os
33
import re
4-
from setuptools import setup, find_packages
4+
5+
from setuptools import find_packages, setup
56

67
scriptFolder = os.path.dirname(os.path.realpath(__file__))
78
os.chdir(scriptFolder)
@@ -44,16 +45,6 @@
4445
"pywinbox>=0.7",
4546
"pymonctl>=0.92"
4647
],
47-
extras_require={
48-
'dev': [
49-
"types-setuptools>=65.5",
50-
"mypy>=0.990",
51-
"types-pywin32>=305.0.0.3",
52-
"types-python-xlib>=0.32",
53-
"myst-parser",
54-
"ewmhlib>=0.2",
55-
]
56-
},
5748
keywords="gui window control menu title name geometry size position move resize minimize maximize restore "
5849
+ "hide show activate raise lower close screen-size mouse-position",
5950
classifiers=[

0 commit comments

Comments
 (0)