Skip to content

Commit

Permalink
Migrate setuptools configuration inside pyproject.toml (ctypesgen#198)
Browse files Browse the repository at this point in the history
* Migrate setuptools configuration inside pyproject.toml

* Remove mention of setup.py commands which are to be avoided

* Use version of setuptools and setuptools_scm recommended by setuptools_scm

* setuptools_scm 8.0.0 dropped support for EOL Python 3.7. Use latest from setuptools_scm 7 release

* Use `python -m build` in tox commands for packaging

* Use only `python -m build`

As recommended in https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

* Use only `python -m build` for Travis configuration
  • Loading branch information
echoix authored Jan 5, 2024
1 parent 3b56564 commit 71f220f
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: python -m pip install build --user

- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .
run: python -m build

- name: Publish distribution to GitHub
uses: softprops/action-gh-release@v1
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:

- stage: publish to test.pypi.org
install:
- pip install --upgrade setuptools wheel twine
- pip install --upgrade build twine
script:
- python setup.py sdist bdist_wheel
- python -m build
- python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*

- stage: verify
Expand Down
61 changes: 50 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,56 @@
[build-system]
requires = [
"setuptools>=44",
"wheel",
"setuptools_scm[toml]>=3.4.3"
]
requires = ["setuptools>=64", "setuptools_scm>=7.1"]
build-backend = "setuptools.build_meta"

[project]
name = "ctypesgen"
description = "Python wrapper generator for ctypes"
license = { text = "BSD-2-Clause" }
classifiers = [
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
"Development Status :: 4 - Beta",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Topic :: Software Development :: Code Generators",
"Topic :: Software Development :: Pre-processors",
"Topic :: Software Development :: Build Tools",
"Environment :: Console",
]
dynamic = ["readme", "version"]
requires-python = ">=3.7"

[project.urls]
Homepage = "https://github.com/ctypesgen/ctypesgen"
Repository = "https://github.com/ctypesgen/ctypesgen.git"
Issues = "https://github.com/ctypesgen/ctypesgen/issues"
Changelog = "https://github.com/ctypesgen/ctypesgen/blob/master/CHANGELOG.md"

[project.scripts]
ctypesgen = "ctypesgen.__main__:main"

[tool.setuptools]
package-dir = {}
include-package-data = true

[tool.setuptools.packages.find]
exclude = ["tests*"]
namespaces = false

[tool.setuptools.dynamic.readme]
file = ["README.md", "LICENSE", "CHANGELOG.md"]
content-type = "text/markdown"

[tool.setuptools_scm]
write_to = "ctypesgen/VERSION"
write_to_template = "{version}"
write_to = "ctypesgen/VERSION"
write_to_template = "{version}"

[tool.black]
line-length = 100
exclude='.*tab.py|ctypesgen/parser/cgrammar.py|ctypesgen/parser/lex.py|ctypesgen/parser/yacc.py'
target-version = [ "py37", "py38", "py39"]

line-length = 100
exclude = '.*tab.py|ctypesgen/parser/cgrammar.py|ctypesgen/parser/lex.py|ctypesgen/parser/yacc.py'
target-version = ["py37", "py38", "py39"]
36 changes: 0 additions & 36 deletions setup.cfg

This file was deleted.

7 changes: 0 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#!/usr/bin/env python3

"""Examples:
setup.py sdist
setup.py bdist_wininst
"""

from setuptools import setup

if __name__ == "__main__":
Expand Down
10 changes: 4 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,18 @@ commands =

[testenv:package]
deps =
six
build
twine
wheel
basepython = python3.7
commands =
python setup.py bdist_wheel --universal
python -m build
twine check dist/*.whl

[testenv:upload]
deps =
six
build
twine
wheel
basepython = python3.7
commands =
python setup.py bdist_wheel --universal
python -m build
twine upload dist/*.whl

0 comments on commit 71f220f

Please sign in to comment.