From 7b70e9ae6b15d354afca5174522305ed267baa06 Mon Sep 17 00:00:00 2001 From: Brian Jones Date: Tue, 8 Jul 2025 18:24:48 +0100 Subject: [PATCH 1/4] Migrates to pyproject.toml Switches the build system from setup.py to pyproject.toml. This change standardizes the project's build configuration, improves dependency management, and prepares the project for future enhancements. Removes unused requirements file. --- pyproject.toml | 32 +++++++++++++++++++++++++++----- requirements-dev.txt | 9 --------- setup.py | 14 -------------- 3 files changed, 27 insertions(+), 28 deletions(-) delete mode 100644 requirements-dev.txt delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 57f6fbe71..af0f72c84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,24 +1,46 @@ [build-system] -requires = ["setuptools>=42", "wheel"] +requires = ["setuptools >= 77.0.3"] build-backend = "setuptools.build_meta" [project] -name = "patterns" +name = "python-patterns" description = "A collection of design patterns and idioms in Python." version = "0.1.0" readme = "README.md" requires-python = ">=3.9" -license = {text = "MIT"} classifiers = [ - "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", ] +dependencies= [ +] + +maintainers=[ + { name="faif", email="" } +] + +[project.urls] +Homepage = "https://github.com/faif/python-patterns" +Repository = "https://github.com/faif/python-patterns" +"Bug Tracker" = "https://github.com/faif/python-patterns/issues" +Contributors = "https://github.com/faif/python-patterns/graphs/contributors" [project.optional-dependencies] -dev = ["pytest", "pytest-cov", "pytest-randomly", "flake8", "mypy", "coverage"] +dev = [ + "mypy", + "pipx>=1.7.1" + "pyupgrade", + "pytest>=6.2.0", + "pytest-cov>=2.11.0", + "pytest-randomly>=3.1.0", + "black>=25.1.0", + "build>=1.2.2" + "isort>=5.7.0", + "flake8>=7.1.0", + "tox>=4.25.0" +] [tool.setuptools] packages = ["patterns"] diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 4aaa81f29..000000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,9 +0,0 @@ -mypy -pyupgrade -pytest>=6.2.0 -pytest-cov>=2.11.0 -pytest-randomly>=3.1.0 -black>=25.1.0 -isort>=5.7.0 -flake8>=7.1.0 -tox>=4.25.0 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 72bc2b461..000000000 --- a/setup.py +++ /dev/null @@ -1,14 +0,0 @@ -from setuptools import find_packages, setup - -setup( - name="patterns", - packages=find_packages(), - description="A collection of design patterns and idioms in Python.", - classifiers=[ - "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", - ], -) From d04ced6f331b003dd4bc38fffc5e8f6781edb56b Mon Sep 17 00:00:00 2001 From: Brian Jones Date: Tue, 8 Jul 2025 18:28:07 +0100 Subject: [PATCH 2/4] Updates minimum Python version Corrects the minimum Python version specified in pyproject.toml. The project now requires Python 3.10 or higher. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index af0f72c84..23a1f4eb8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "python-patterns" description = "A collection of design patterns and idioms in Python." version = "0.1.0" readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.10" classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", From 96a92d8808e705146a4b55d232967388dc76042b Mon Sep 17 00:00:00 2001 From: Brian Jones Date: Tue, 8 Jul 2025 18:33:31 +0100 Subject: [PATCH 3/4] Uses installable package for dev dependencies Updates the installation of development dependencies in the linting workflow to use the installable package. This simplifies dependency management and aligns with standard Python packaging practices. --- .github/workflows/lint_python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 19d6c0785..288a94b0b 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -11,7 +11,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements-dev.txt + pip install .[dev] - name: Lint with flake8 run: flake8 ./patterns --count --show-source --statistics continue-on-error: true From 07e0dcb17dfa91e54c6f393c82afb43a4f978768 Mon Sep 17 00:00:00 2001 From: Brian Jones Date: Tue, 8 Jul 2025 18:39:34 +0100 Subject: [PATCH 4/4] Adds pyupgrade as a dev dependency Adds `pyupgrade` to the development dependencies. This enables developers to automatically upgrade Python syntax to more modern versions, improving code maintainability and readability. --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 23a1f4eb8..dfac5da9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dependencies= [ ] maintainers=[ - { name="faif", email="" } + { name="faif" } ] [project.urls] @@ -30,13 +30,13 @@ Contributors = "https://github.com/faif/python-patterns/graphs/contributors" [project.optional-dependencies] dev = [ "mypy", - "pipx>=1.7.1" + "pipx>=1.7.1", "pyupgrade", "pytest>=6.2.0", "pytest-cov>=2.11.0", "pytest-randomly>=3.1.0", "black>=25.1.0", - "build>=1.2.2" + "build>=1.2.2", "isort>=5.7.0", "flake8>=7.1.0", "tox>=4.25.0"