diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a5de97f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,67 @@ +name: Publish releases to PyPI + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + build_sdist: + name: Build sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - uses: actions/setup-python@v7 + with: + python-version: "3.11" + + - name: Install build + run: python -m pip install build + + - name: Build sdist + run: python -m build --sdist --outdir dist + + - uses: actions/upload-artifact@v7 + with: + name: dist-sdist + path: dist/* + + build_wheels: + name: Build wheels for ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v7 + + - name: Build wheels + uses: pypa/cibuildwheel@v3.4.1 + env: + CIBW_ARCHS_LINUX: "x86_64 aarch64" + CIBW_ARCHS_MACOS: "x86_64 arm64" + CIBW_ARCHS_WINDOWS: "AMD64" + + - uses: actions/upload-artifact@v7 + with: + name: dist-wheels-${{ matrix.os }} + path: ./wheelhouse/*.whl + + publish: + name: Publish to PyPI + needs: [build_sdist, build_wheels] + if: github.event_name == 'release' && github.event.action == 'published' + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v8 + with: + pattern: dist-* + path: dist + merge-multiple: true + + - name: Publish distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 55b4b43..17142bc 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -8,12 +8,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy-3.10"] + python-version: ["3.11", "3.12", "3.13", "3.14", "3.15", "pypy-3.11"] steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v7 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -31,19 +31,19 @@ jobs: run: | flake8 . - name: Build docs with sphinx - if: "matrix.python-version == '3.10'" + if: "matrix.python-version == '3.11'" run: | pip install -r docs/requirements.txt sphinx-build -W -b html docs docs/_build/html - name: Build packages - if: "matrix.python-version == '3.10'" + if: "matrix.python-version == '3.11'" run: | - pip install -U twine wheel - python setup.py sdist bdist_wheel + pip install -U twine wheel build + python -m build twine check dist/* - name: Upload packages - if: "matrix.python-version == '3.10'" - uses: actions/upload-artifact@v4 + if: "matrix.python-version == '3.11'" + uses: actions/upload-artifact@v7 with: name: python-pure-cdb-packages path: dist/* diff --git a/.gitignore b/.gitignore index 6f7a6d9..753244d 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,6 @@ venv.bak/ .mypy_cache/ .dmypy.json dmypy.json + +# MacOS +.DS_Store diff --git a/docs/conf.py b/docs/conf.py index b781c91..ed0f967 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -74,7 +74,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'sphinx_rtd_theme' +# html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/docs/requirements.txt b/docs/requirements.txt index ab3f3dd..2806c16 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1 @@ Sphinx -sphinx_rtd_theme diff --git a/docs/versions.rst b/docs/versions.rst index 9b86915..1401e4e 100644 --- a/docs/versions.rst +++ b/docs/versions.rst @@ -1,6 +1,8 @@ Version history =============== +* `Version 5.0.0 `_ + * This package is now marked as supporting Python 3.10 and above * `Version 4.0.0 `_ * This package is now marked as supporting Python 3.6 and above * Fixed a bug related to items that hash to the value 0 (thanks to pwlodarczyk92) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..084e73c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,38 @@ +[build-system] +requires = ["setuptools>=77.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "pure-cdb" +version = "5.0.0" +description = "Pure Python reader/writer for Dan J. Bernstein's CDB format." +readme = "README.rst" +requires-python = ">=3.11" +license = "MIT" +authors = [ + { name = "Bo Bayles", email = "bo@bbayles.com" }, + { name = "David Wilson", email = "dw@botanicus.net" }, +] +keywords = ["cdb", "file", "format", "appengine", "database", "db"] +dependencies = [] + +[project.urls] +Download = "https://github.com/bbayles/python-pure-cdb" + +[project.scripts] +python-pure-cdbmake = "cdblib.cdbmake:main" +python-pure-cdbdump = "cdblib.cdbdump:main" + +[project.optional-dependencies] +test = ["flake8"] + +[tool.setuptools.packages.find] +include = ["cdblib"] + +[[tool.setuptools.ext-modules]] +name = "cdblib._djb_hash" +sources = ["cdblib/_djb_hash.c"] + +[tool.cibuildwheel] +build-frontend = "build" +skip = ["*-win32", "*-manylinux_i686", "*-musllinux_i686", "pp*"] diff --git a/setup.cfg b/setup.cfg index 7e6a48a..b1c9595 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,3 @@ [flake8] filename = ./cdblib/*.py - ./setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index e45ef2b..0000000 --- a/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -from os import environ - -from setuptools import Extension, find_packages, setup - -# Opt-in to building the C extension by setting the -# ENABLE_DJB_HASH_CEXT environment variable -if environ.get('ENABLE_DJB_HASH_CEXT', '1') != '0': - ext_modules = [ - Extension('cdblib._djb_hash', sources=['cdblib/_djb_hash.c']), - ] -else: - ext_modules = [] - - -description = "Pure Python reader/writer for Dan J. Berstein's CDB format." - -with open('README.rst', 'rt') as f: - long_description = f.read() - -setup( - author='David Wilson', - author_email='dw@botanicus.net', - description=description, - long_description=long_description, - long_description_content_type='text/x-rst', - download_url='https://github.com/dw/python-pure-cdb', - keywords='cdb file format appengine database db', - license='MIT', - name='pure-cdb', - version='4.0.0', - packages=find_packages(include=['cdblib']), - ext_modules=ext_modules, - install_requires=[], - python_requires='>=3.6', - test_suite='tests', - tests_require=['flake8'], - entry_points={ - 'console_scripts': [ - 'python-pure-cdbmake=cdblib.cdbmake:main', - 'python-pure-cdbdump=cdblib.cdbdump:main', - ], - }, -)