From b4f118b811e01e05dbc0640ee076ad66359ea1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Fri, 25 Jul 2025 16:04:51 +0200 Subject: [PATCH] Modernize packaging, and update Python support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: - Switch to PEP 621 pyproject.toml with Hatch & VCS-based versioning (hatch-vcs) - Remove legacy setup.py and setup.cfg - Update supported Python versions to 3.9–3.13 in tox and CI - Upgrade github actions Refactor tox.ini: - Remove python setup.py sdist from docs env - Add flake8 as a dependency for pep8 env - Clean up and document Sphinx build process - Remove all references to unsupported Python versions (3.6–3.8) - Ensure all test/lint/build workflows are modern and reproducible Adding Changelog file that was previously auto-generated. --- .github/workflows/main.yml | 4 +-- .gitignore | 1 - ChangeLog | 2 ++ pyproject.toml | 55 ++++++++++++++++++++++++++++++++++++++ setup.cfg | 55 -------------------------------------- setup.py | 28 ------------------- tox.ini | 6 ++--- 7 files changed, 62 insertions(+), 89 deletions(-) create mode 100644 ChangeLog create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e0732d0..41cd8d6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.9", "3.10", "3.11", "3.12"] + python: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 @@ -50,7 +50,7 @@ jobs: - name: Build package run: python -m build - name: upload windows dists - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: release-dists path: dist/ diff --git a/.gitignore b/.gitignore index 5030d4f..71bfe8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ .tox *.egg-info /AUTHORS -/ChangeLog dist/ doc/build .coverage diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..679df97 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2 @@ +ChangeLog +========= \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..35b90aa --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "beagle" +description = "Command Line Client for Hound" +readme = "README.rst" +requires-python = ">=3.9" +license = { text = "Apache-2.0" } +authors = [ + { name = "Doug Hellmann", email = "doug@doughellmann.com" } +] +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 = [] +dynamic = ["version"] + +[project.scripts] +beagle = "beagle.app:main" + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.targets.sdist] +include = [ + "/beagle", + "/README.rst", + "/LICENSE" +] + +[project.entry-points."beagle.cli"] +search = "beagle.search:Search" + +[project.entry-points."cliff.formatter.list"] +grep = "beagle.grep_formatter:GrepFormatter" +link = "beagle.openstack:OSLinkFormatter" + +[project.entry-points."openstack.cli"] +code_search = "beagle.search:Search" + +[project.optional-dependencies] +test = [ + "coverage", + "pytest", + "pytest-cov", + "testtools", + "fixtures", + "flake8" +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index a2cb995..0000000 --- a/setup.cfg +++ /dev/null @@ -1,55 +0,0 @@ -[metadata] -name = beagle -summary = Command line client for Hound -description-file = - README.rst -author = Doug Hellmann -author-email = doug@doughellmann.com -home-page = https://github.com/beaglecli/beagle/ -python-requires = >=3.9 -classifier = - Intended Audience :: Developers - Intended Audience :: Information Technology - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 -install_requires = - setuptools - -[files] -packages = - beagle - -[extras] -test = - coverage - pytest - pytest-cov - testtools - fixtures - flake8 - -[entry_points] -console_scripts = - beagle = beagle.app:main -beagle.cli = - search = beagle.search:Search -cliff.formatter.list = - grep = beagle.grep_formatter:GrepFormatter - link = beagle.openstack:OSLinkFormatter -openstack.cli = - code_search = beagle.search:Search - -[build_sphinx] -all-files = 1 -warning-is-error = 1 -source-dir = doc/source -build-dir = doc/build - -[upload_sphinx] -upload-dir = doc/build/html diff --git a/setup.py b/setup.py deleted file mode 100644 index bb3db27..0000000 --- a/setup.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import setuptools - -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - -setuptools.setup( - setup_requires=['pbr'], - pbr=True) diff --git a/tox.ini b/tox.ini index 5513e1d..6f293a4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.2.0 -envlist = py38,pep8 +envlist = py39,py310,py311,py312,py313,pep8 [testenv] usedevelop = True @@ -12,6 +12,7 @@ deps = .[test] commands = {posargs} [testenv:pep8] +deps = flake8 commands = flake8 {posargs} [testenv:cover] @@ -27,8 +28,7 @@ commands = [testenv:docs] deps = -r{toxinidir}/doc/requirements.txt commands = - python setup.py sdist - sphinx-build -a -E -W -b html doc/source doc/build/html;; + sphinx-build -a -E -W -b html doc/source doc/build/html [flake8] # E123, E125 skipped as they are invalid PEP-8.