]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Hatch support and general build cleanups. (#1014)
authorBob Halley <halley@dnspython.org>
Thu, 23 Nov 2023 00:50:47 +0000 (16:50 -0800)
committerGitHub <noreply@github.com>
Thu, 23 Nov 2023 00:50:47 +0000 (16:50 -0800)
* Hatch support and general build cleanups.

12 files changed:
.github/workflows/codeql-analysis.yml
.github/workflows/python-package.yml
.gitignore
.pylintrc [moved from pylintrc with 100% similarity]
MANIFEST.in [deleted file]
Makefile
doc/.gitignore [deleted file]
mypy.ini [deleted file]
pyproject.toml
pytest.ini [deleted file]
setup.cfg [deleted file]
setup.py [deleted file]

index 957bb842121d8c5704d3f6d12a4f035b5e08ac73..97f07ae9fc92d479e7112226b6998edb6a8f5e35 100644 (file)
@@ -59,8 +59,7 @@ jobs:
       run: |
         sudo apt install -y gnome-keyring
         python -m pip install --upgrade pip
-        python -m pip install poetry
-        poetry install -E dnssec -E doh -E idna -E trio
+        python -m pip install cryptography trio idna httpx h2 aioquic
 
     - name: Perform CodeQL Analysis
       uses: github/codeql-action/analyze@v2
index 7cc53ee1dbe423bfb1f5f731c1ed7e4658394519..2c83afbf74651f6a52201446e04114083a6fa956 100644 (file)
@@ -48,14 +48,13 @@ jobs:
     - name: Install dependencies
       run: |
         python -m pip install --upgrade pip
-        python -m pip install poetry
-        poetry install -E dnssec -E doh -E idna -E trio -E doq
+        python -m pip install cryptography trio idna httpx h2 aioquic mypy pytest pytest-cov
     - name: Typecheck
       run: |
-        poetry run python -m mypy --install-types --non-interactive --disallow-incomplete-defs dns
+        python -m mypy --install-types --non-interactive --disallow-incomplete-defs dns
     - name: Test with pytest
       run: |
-        poetry run pytest --cov=dns --cov-branch --cov-report=xml:coverage.xml
+        pytest --cov=dns --cov-branch --cov-report=xml:coverage.xml
     - name: Upload coverage to Codecov
       uses: codecov/codecov-action@v3
       with:
index 86ac2e501c06fa494d695d94569e1f19982c5635..f439957197f95793d0c3bb0523d6fea96c3fd590 100644 (file)
@@ -17,3 +17,4 @@ htmlcov
 coverage.xml
 .dir-locals.el
 .vscode/
+doc/_build
\ No newline at end of file
similarity index 100%
rename from pylintrc
rename to .pylintrc
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644 (file)
index 30d9d39..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-include LICENSE ChangeLog README.md
-recursive-include examples *.txt *.py
-recursive-include tests *.txt *.py Makefile *.good example query *.pickle *.text *.generic
index 94cd586aeea8ba1db0d84d00690eb8a1679da1e9..1cc3019ff7765a22932796843e4f97a35f49a341 100644 (file)
--- a/Makefile
+++ b/Makefile
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: Makefile,v 1.16 2004/03/19 00:17:27 halley Exp $
-
-PYTHON=python
-
-all:
-       ${PYTHON} ./setup.py build
-
-install:
-       ${PYTHON} ./setup.py install
+build:
+       python -m build
 
 clean:
-       ${PYTHON} ./setup.py clean --all
-       find . -name '*.pyc' -exec rm {} \;
-       find . -name '*.pyo' -exec rm {} \;
-       rm -f TAGS
        rm -rf htmlcov .coverage
        rm -rf .pytest_cache
-
-distclean: clean docclean
-       rm -rf build dist
-       rm -f MANIFEST
-       rm -rf dnspython.egg-info
+       rm -rf .ruff_cache
+       rm -rf .mypy_cache
+       rm -rf doc/_build
+       rm -rf dist
+       rm -rf build
 
 doc:
        cd doc; make html
 
-docclean:
-       rm -rf doc/_build
-
-check: test
-
 test:
-       cd tests; make test
-
-potest:
-       poetry run pytest
-
-potestlf:
-       poetry run pytest --lf
-
-potype:
-       poetry run python -m mypy --install-types --non-interactive --disallow-incomplete-defs dns
+       pytest
 
-potypetests:
-       poetry run python -m mypy --check-untyped-defs examples tests
-
-polint:
-       poetry run pylint dns
-
-poflake:
-       poetry run flake8 dns
+check: test
 
-poruff:
-       poetry run ruff dns
+type:
+       python -m mypy --install-types --non-interactive --disallow-incomplete-defs dns
 
-pocov:
-       poetry run coverage run --branch -m pytest
-       poetry run coverage html --include 'dns/*'
-       poetry run coverage report --include 'dns/*'
+lint:
+       pylint dns
 
-oldpokit:
-       po run python setup.py sdist --formats=zip bdist_wheel
+flake:
+       flake8 dns
 
-pokit:
-       po build
+ruff:
+       ruff dns
 
-findjunk:
-       find dns -type f | egrep -v '.*\.py' | egrep -v 'py\.typed'
+cov:
+       coverage --branch -m pytest
+       coverage html --include 'dns/*'
+       coverage report --include 'dns/*'
 
-poblack:
-       poetry run black dns examples tests
+black:
+       black dns examples tests
diff --git a/doc/.gitignore b/doc/.gitignore
deleted file mode 100644 (file)
index e35d885..0000000
+++ /dev/null
@@ -1 +0,0 @@
-_build
diff --git a/mypy.ini b/mypy.ini
deleted file mode 100644 (file)
index 416a5ea..0000000
--- a/mypy.ini
+++ /dev/null
@@ -1,13 +0,0 @@
-[mypy]
-
-[mypy-trio]
-ignore_missing_imports = True
-
-[mypy-pythoncom]
-ignore_missing_imports = True
-
-[mypy-wmi]
-ignore_missing_imports = True
-
-[mypy-httpcore.*]
-ignore_missing_imports = True
index 77736fab16042f0d104d4ef8ca86f23930cc4e3e..fb652f2876b955c14b4df57f3db18e0210d4d8aa 100644 (file)
-[tool.poetry]
+[build-system]
+requires = ["hatchling>=1.17.0"]
+build-backend = "hatchling.build"
+
+[project]
 name = "dnspython"
-version = "2.5.0"
 description = "DNS toolkit"
-authors = ["Bob Halley <halley@dnspython.org>"]
-license = "ISC"
-packages = [
-    {include = "dns"}
-]
-include = [
-    { path="LICENSE", format="sdist" },
-    { path="README.md", format="sdist" },
-    { path="examples/*.txt", format="sdist" },
-    { path="examples/*.py", format="sdist" },
-    { path="tests/*.txt", format="sdist" },
-    { path="tests/*.py", format="sdist" },
-    { path="tests/*.good", format="sdist" },
-    { path="tests/example", format="sdist" },
-    { path="tests/query", format="sdist" },
-    { path="tests/*.pickle", format="sdist" },
-    { path="tests/*.text", format="sdist" },
-    { path="tests/*.generic", format="sdist" },
-    { path="tests/tls/*.crt", format="sdist" },
-    { path="tests/tls/*.pem", format="sdist" },
-    { path="util/**", format="sdist" },
-    { path="setup.cfg", format="sdist" },
-]
-exclude = [
-    "**/.DS_Store",
-    "**/__pycache__/**",
+authors = [{ name = "Bob Halley", email = "halley@dnspython.org" }]
+classifiers = [
+    "Development Status :: 5 - Production/Stable",
+    "Intended Audience :: Developers",
+    "Intended Audience :: System Administrators",
+    "License :: OSI Approved :: ISC License (ISCL)",
+    "Operating System :: POSIX",
+    "Operating System :: Microsoft :: Windows",
+    "Programming Language :: Python",
+    "Topic :: Internet :: Name Service (DNS)",
+    "Topic :: Software Development :: Libraries :: Python Modules",
+    "Programming Language :: Python :: 3",
+    "Programming Language :: Python :: 3.8",
+    "Programming Language :: Python :: 3.9",
+    "Programming Language :: Python :: 3.10",
+    "Programming Language :: Python :: 3.11",
+    "Programming Language :: Python :: 3.12",
 ]
 readme = "README.md"
+requires-python = ">=3.8"
+dependencies = []
+dynamic = ["version"]
+
+[project.optional-dependencies]
+dev = [
+    "black>=23.1.0",
+    "coverage>=7.0",
+    "flake8>=5.0.3",
+    "mypy>=1.0.1",
+    "pylint>=2.7",
+    "pytest>=6.2.5",
+    "pytest-cov>=3.0.0",
+    "sphinx>=7.0.0",
+    "twine>=4.0.0",
+    "wheel>=0.41.0",
+]
+dnssec = ["cryptography>=41"]
+doh = ["httpcore>=0.17.3", "httpx>=0.25.1", "h2>=4.1.0"]
+doq = ["aioquic>=0.9.20"]
+idna = ["idna>=2.1"]
+trio = ["trio>=0.14"]
+wmi = ["wmi>=1.5.1"]
+
+[project.urls]
 homepage = "https://www.dnspython.org"
 repository = "https://github.com/rthalley/dnspython.git"
 documentation = "https://dnspython.readthedocs.io/en/stable/"
+issues = "https://github.com/rthalley/dnspython/issues"
 
-[tool.poetry.urls]
-"Bug Tracker" = "https://github.com/rthalley/dnspython/issues"
-
-[tool.poetry.dependencies]
-python = "^3.8"
-httpx = {version=">=0.24.1", optional=true}
-httpcore = {version=">=0.17.3", optional=true}
-h2 = {version=">=4.1.0", optional=true}
-idna = {version=">=2.1,<4.0", optional=true}
-cryptography = {version=">=2.6", optional=true}
-trio = {version=">=0.14,<0.24", optional=true}
-wmi = {version="^1.5.1", optional=true}
-aioquic = {version=">=0.9.20", optional=true}
+[tool.hatch.build.targets.sdist]
+include = [
+    "/dns/*.py",
+    "/dns/**/*.py",
+    "/dns/py.typed",
+    "/examples/*.txt",
+    "/examples/*.py",
+    "/tests/*.txt",
+    "/tests/*.py",
+    "/tests/*.good",
+    "/tests/example",
+    "/tests/query",
+    "/tests/*.pickle",
+    "/tests/*.text",
+    "/tests/*.generic",
+    "/tests/tls/*.crt",
+    "/tests/tls/*.pem",
+    "/util/**",
+]
 
-[tool.poetry.dev-dependencies]
-pytest = ">=5.4.1,<8"
-pytest-cov = "^4.0.0"
-flake8 = "^5.0.3"
-sphinx = "^7.0.0"
-coverage = "^7.0"
-twine = "^4.0.0"
-wheel = "^0.41.0"
-pylint = ">=2.7,<4"
-mypy = ">=1.0.1"
-black = "^23.1.0"
+[tool.hatch.build.targets.wheel]
+include = ["dns/*.py", "dns/**/*.py", "dns/py.typed"]
 
-[tool.poetry.extras]
-doh = ['httpx', 'h2', 'httpcore']
-idna = ['idna']
-dnssec = ['cryptography']
-trio = ['trio']
-wmi = ['wmi']
-doq = ['aioquic']
+[tool.hatch.envs.default]
+features = ["trio", "dnssec", "idna", "doh", "doq", "dev"]
 
-[build-system]
-requires = ["poetry-core"]
-build-backend = "poetry.core.masonry.api"
-
-[tool.setuptools_scm]
+[tool.hatch.version]
+source = "code"
+path = "dns/version.py"
+expression = "version"
 
 [tool.ruff]
 ignore = ['E741', 'F401']
 
 [tool.isort]
 profile = "black"
+
+[[tool.mypy.overrides]]
+module = "pythoncom"
+ignore_missing_imports = true
+
+[[tool.mypy.overrides]]
+module = "wmi"
+ignore_missing_imports = true
diff --git a/pytest.ini b/pytest.ini
deleted file mode 100644 (file)
index 5b9d772..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# pytest.ini
-[pytest]
-junit_family=xunit1
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644 (file)
index d474067..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,63 +0,0 @@
-[metadata]
-name = dnspython
-version = 2.5.0
-author = Bob Halley
-author_email = halley@dnspython.org
-license = ISC
-license_file = LICENSE
-description = DNS toolkit
-url = https://www.dnspython.org
-project_urls =
-    Bug Tracker = https://github.com/rthalley/dnspython/issues
-    Documentation = https://dnspython.readthedocs.io/en/stable/
-    Source Code = https://github.com/rthalley/dnspython
-long_description = dnspython is a DNS toolkit for Python. It supports almost all
-    record types. It can be used for queries, zone transfers, and dynamic
-    updates.  It supports TSIG authenticated messages and EDNS0.
-
-    dnspython provides both high and low level access to DNS. The high
-    level classes perform queries for data of a given name, type, and
-    class, and return an answer set.  The low level classes allow
-    direct manipulation of DNS zones, messages, names, and records.
-long_description_content_type = text/plain
-classifiers =
-    Development Status :: 5 - Production/Stable
-    Intended Audience :: Developers
-    Intended Audience :: System Administrators
-    License :: OSI Approved :: ISC License (ISCL)
-    Operating System :: POSIX
-    Operating System :: Microsoft :: Windows
-    Programming Language :: Python
-    Topic :: Internet :: Name Service (DNS)
-    Topic :: Software Development :: Libraries :: Python Modules
-    Programming Language :: Python :: 3
-    Programming Language :: Python :: 3.8
-    Programming Language :: Python :: 3.9
-    Programming Language :: Python :: 3.10
-    Programming Language :: Python :: 3.11
-    Programming Language :: Python :: 3.12
-provides = dns
-
-[options]
-packages =
-    dns
-    dns.dnssecalgs
-    dns.quic
-    dns.rdtypes
-    dns.rdtypes.IN
-    dns.rdtypes.ANY
-    dns.rdtypes.CH
-python_requires = >=3.8
-test_suite = tests
-setup_requires = setuptools>=44; setuptools_scm[toml]>=3.4.3
-
-[options.extras_require]
-DOH = httpx>=0.21.1; h2>=4.1.0
-IDNA = idna>=2.1
-DNSSEC = cryptography>=2.6
-trio = trio>=0.14.0
-wmi = wmi>=1.5.1
-DOQ = aioquic>=0.9.20
-
-[options.package_data]
-dns = py.typed
diff --git a/setup.py b/setup.py
deleted file mode 100755 (executable)
index cbbbecb..0000000
--- a/setup.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
-#
-# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose with or without fee is hereby granted,
-# provided that the above copyright notice and this permission notice
-# appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-import sys
-
-from setuptools import setup
-
-try:
-    sys.argv.remove("--cython-compile")
-except ValueError:
-    compile_cython = False
-else:
-    compile_cython = True
-    from Cython.Build import cythonize
-
-    ext_modules = cythonize(
-        [
-            "dns/*.py",
-            "dns/dnssecalgs/*.py",
-            "dns/quic/*.py",
-            "dns/rdtypes/*.py",
-            "dns/rdtypes/*/*.py",
-        ],
-        language_level="3",
-    )
-
-kwargs = {
-    "ext_modules": ext_modules if compile_cython else None,
-    "zip_safe": False if compile_cython else None,
-}
-
-setup(**kwargs)