Skip to content

Switch to setuptools-scm #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/[email protected]
with:
python-version: "3.8"
python-version: "3.9"
- name: Install tox
run: pip install tox
- name: Lint
Expand All @@ -39,10 +39,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/[email protected]
with:
python-version: 3.8
python-version: "3.9"
- name: Install tox and upgrade setuptools and pip
run: pip install --upgrade tox setuptools pip
- name: Run tox -e ${{ matrix.tox_env }}
Expand All @@ -53,22 +53,21 @@ jobs:
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
- "3.13"
- "pypy-3.9"
- "pypy-3.10"
os: ["ubuntu-latest"]
include:
- os: "macos-14" # For m1 macos
python-version: "3.12"
- os: "macos-13" # for x86 macos
python-version: "3.8"
python-version: "3.9"
- os: "windows-latest"
python-version: "3.8"
python-version: "3.9"
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -96,7 +95,7 @@ jobs:
strategy:
matrix:
python_version:
- "3.8"
- "3.9"
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -197,7 +196,7 @@ jobs:
- name: Build wheels
run: cibuildwheel --output-dir dist
env:
# Skip 32 bit, macosx_arm64 causes issues on cpython 3.8
# Skip 32 bit, macosx_arm64 causes issues on cpython 3.9
CIBW_SKIP: "*-win32 *-manylinux_i686 cp38-macosx_arm64"
CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }}
CIBW_TEST_REQUIRES: "pytest"
Expand All @@ -218,14 +217,14 @@ jobs:
CIBW_ENVIRONMENT_LINUX: >-
PYTHON_ZLIB_NG_BUILD_CACHE=True
PYTHON_ZLIB_NG_BUILD_CACHE_FILE=/tmp/build_cache
CFLAGS="-g0 -DNDEBUG"
CFLAGS="-O3 -DNDEBUG"
CIBW_ENVIRONMENT_WINDOWS: >-
PYTHON_ZLIB_NG_BUILD_CACHE=True
PYTHON_ZLIB_NG_BUILD_CACHE_FILE=${{ runner.temp }}\build_cache
CIBW_ENVIRONMENT_MACOS: >-
PYTHON_ZLIB_NG_BUILD_CACHE=True
PYTHON_ZLIB_NG_BUILD_CACHE_FILE=${{ runner.temp }}/build_cache
CFLAGS="-g0 -DNDEBUG"
CFLAGS="-O3 -DNDEBUG"
- name: Build sdist
if: ${{runner.os == 'Linux' && matrix.cibw_archs_linux == 'x86_64'}}
run:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Changelog
.. This document is user facing. Please word the changes in such a way
.. that users understand how the changes affect the new version.

version develop
-----------------
+ Python 3.8 is no longer supported.
+ Switched to setuptools-scm for building the package rather than versioningit.
+ Test files are added to the source distribution.

version 0.5.1
-----------------
+ Fix a bug where flushing in threaded mode did not write the data to the
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
graft src/zlib_ng/zlib-ng
prune tests
prune docs
prune benchmark_scripts
prune .github
exclude tox.ini
exclude requirements-docs.txt
exclude codecov.yml
exclude .readthedocs.yml
Expand Down
3 changes: 0 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme_options = dict(
display_version=True,
)

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
60 changes: 54 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,58 @@
[build-system]
requires = ["setuptools>=64", "versioningit>=1.1.0"]
requires = ["setuptools>=77", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[tool.versioningit.vcs]
method="git"
default-tag = "v0.0.0"
[project]
name = "zlib-ng"
dynamic = ["version"]
description = "Drop-in replacement for zlib and gzip modules using zlib-ng"
license="PSF-2.0"
keywords=["zlib-ng", "zlib", "compression", "deflate", "gzip"]
authors = [{name = "Leiden University Medical Center"},
{email = "[email protected]"}]
readme = "README.rst"
requires-python = ">=3.9" # Because of setuptools version
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: C",
"Development Status :: 5 - Production/Stable",
"Topic :: System :: Archiving :: Compression",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
]
urls.homepage = "https://github.com/pycompression/python-zlib-ng"
urls.documentation = "python-zlib-ng.readthedocs.io"

[tool.versioningit.write]
file = "src/zlib_ng/_version.py"
[tool.setuptools_scm]
version_file = "src/zlib_ng/_version.py"

[tool.setuptools.packages.find]
where = ["src"]
include = ["zlib_ng"]

[tool.setuptools.package-data]
zlib_ng = ['*.pyi', 'py.typed', 'zlib-ng/LICENSE', 'zlib-ng/README.md']
[tool.setuptools.exclude-package-data]
zlib_ng = [
"*.c",
"*.h",
"zlib-ng/*/*",
"zlib-ng/*in",
"zlib-ng/.*",
"zlib-ng/*.map",
"zlib-ng/INDEX.md",
"zlib-ng/CMakeLists.txt",
"zlib-ng/PORTING.md",
"zlib-ng/configure",
"zlib-ng/*.empty",
"zlib-ng/FAQ.zlib",
]
4 changes: 2 additions & 2 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx
setuptools
# https://github.com/sphinx-doc/sphinx/issues/13415
sphinx<8
sphinx-rtd-theme
sphinx-argparse
41 changes: 1 addition & 40 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
import tempfile
from pathlib import Path

from setuptools import Extension, find_packages, setup
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext

import versioningit

ZLIB_NG_SOURCE = os.path.join("src", "zlib_ng", "zlib-ng")

SYSTEM_IS_UNIX = (sys.platform.startswith("linux") or
Expand Down Expand Up @@ -125,43 +123,6 @@ def build_zlib_ng():


setup(
name="zlib-ng",
version=versioningit.get_version(),
description="Drop-in replacement for zlib and gzip modules using zlib-ng",
author="Leiden University Medical Center",
author_email="[email protected]", # A placeholder for now
long_description=Path("README.rst").read_text(),
long_description_content_type="text/x-rst",
cmdclass={"build_ext": BuildZlibNGExt},
license="PSF-2.0",
keywords="zlib-ng zlib compression deflate gzip",
zip_safe=False,
packages=find_packages('src'),
package_dir={'': 'src'},
package_data={'zlib_ng': [
'*.pyi', 'py.typed',
# Include zlib-ng LICENSE and other relevant files with the binary distribution.
'zlib-ng/LICENSE.md', 'zlib-ng/README.md']},
url="https://github.com/pycompression/python-zlib-ng",
classifiers=[
"Programming Language :: Python :: 3 :: Only",
"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",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: C",
"Development Status :: 4 - Beta",
"Topic :: System :: Archiving :: Compression",
"License :: OSI Approved :: Python Software Foundation License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
],
python_requires=">=3.8", # Earliest version still tested.
ext_modules=EXTENSIONS
)
Loading