From 48d0beff09960ee0a7453d2141a22fd63ddcebaa Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Thu, 11 Jun 2026 23:14:03 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=A6=20Migrate=20packaging=20from?= =?UTF-8?q?=20setup.py=20to=20pyproject.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pure-metadata migration to PEP 621 with the setuptools backend: - Version stays dynamic, read from bibtexparser.__init__.__version__ - License now a PEP 639 SPDX expression; deprecated license classifier dropped - RELEASE doc: replace obsolete 'python setup.py sdist upload' with 'python -m build' Wheel contents are byte-for-byte equivalent to the setup.py build. Side-effect fix: README in package metadata is now read as UTF-8, removing mojibake ('François') present in builds made on Windows. Co-Authored-By: Claude Fable 5 --- RELEASE | 4 ++-- pyproject.toml | 47 +++++++++++++++++++++++++++++++++++++++ setup.py | 60 -------------------------------------------------- 3 files changed, 49 insertions(+), 62 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/RELEASE b/RELEASE index 58deacd1..ed62ad43 100644 --- a/RELEASE +++ b/RELEASE @@ -7,8 +7,8 @@ Oder/Manual release instructions: * Commit and open PR on Github to see that all tests pass, and then merge the PR. * Check out master locally -* Build wheel - python setup.py sdist upload +* Build sdist and wheel + python -m build * Check long description twine check dist/* * Upload to pypi-test diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..4f0d8a98 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,47 @@ +[build-system] +requires = ["setuptools>=77"] +build-backend = "setuptools.build_meta" + +[project] +name = "bibtexparser" +description = "Bibtex parser for python 3" +readme = "README.md" +requires-python = ">=3.9" +license = "MIT" +license-files = ["LICENSE"] +authors = [{ name = "Michael Weiss and other contributors", email = "code@mweiss.ch" }] +maintainers = [{ name = "Michael Weiss", email = "code@mweiss.ch" }] +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Operating System :: OS Independent", +] +dependencies = ["pylatexenc~=2.10"] +dynamic = ["version"] + +[project.optional-dependencies] +test = [ + "pytest", # Test runner + "pytest-xdist", # Parallel tests: `pytest -n ` + "pytest-cov", # Code coverage + "jupyter", # For runnable examples +] +docs = ["sphinx"] + +[project.urls] +Homepage = "https://github.com/sciunto-org/python-bibtexparser" +Repository = "https://github.com/sciunto-org/python-bibtexparser" + +[tool.setuptools.packages.find] +include = ["bibtexparser", "bibtexparser.*"] + +[tool.setuptools.package-data] +bibtexparser = ["py.typed"] + +[tool.setuptools.dynamic] +version = { attr = "bibtexparser.__version__" } diff --git a/setup.py b/setup.py deleted file mode 100644 index d0480ea1..00000000 --- a/setup.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -import setuptools - -version = None - -with open("bibtexparser/__init__.py") as fh: - for line in fh: - if line.startswith("__version__"): - version = line.strip().split()[-1][1:-1] - break - if not version: - raise RuntimeError("Could not determine version") - - -def load_readme(): - with open("README.md") as f: - return f.read() - - -setuptools.setup( - name="bibtexparser", - version=version, - url="https://github.com/sciunto-org/python-bibtexparser", - author="Michael Weiss and other contributors", - maintainer="Michael Weiss", - license="MIT", - author_email="code@mweiss.ch", - maintainer_email="code@mweiss.ch", - description="Bibtex parser for python 3", - long_description_content_type="text/markdown", - long_description=load_readme(), - python_requires=">=3.9", - packages=setuptools.find_packages(include=["bibtexparser", "bibtexparser.*"]), - package_data={"bibtexparser": ["py.typed"]}, - classifiers=[ - "Development Status :: 4 - Beta", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Scientific/Engineering :: Artificial Intelligence", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - install_requires=[ - "pylatexenc~=2.10", - ], - extras_require={ - "test": [ - "pytest", # Test runner - "pytest-xdist", # Parallel tests: `pytest -n ` - "pytest-cov", # Code coverage - "jupyter", # For runnable examples - ], - "docs": [ - "sphinx", - ], - }, -) From cd4d6e26838bd1df1df3469e16c7f7a27a15fbc9 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Thu, 11 Jun 2026 23:20:15 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8E=A8=20Apply=20pretty-format-toml?= =?UTF-8?q?=20to=20pyproject.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- pyproject.toml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4f0d8a98..7c11b95f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,9 @@ [build-system] -requires = ["setuptools>=77"] build-backend = "setuptools.build_meta" +requires = ["setuptools>=77"] [project] -name = "bibtexparser" -description = "Bibtex parser for python 3" -readme = "README.md" -requires-python = ">=3.9" -license = "MIT" -license-files = ["LICENSE"] -authors = [{ name = "Michael Weiss and other contributors", email = "code@mweiss.ch" }] -maintainers = [{ name = "Michael Weiss", email = "code@mweiss.ch" }] +authors = [{name = "Michael Weiss and other contributors", email = "code@mweiss.ch"}] classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python :: 3", @@ -22,26 +15,33 @@ classifiers = [ "Operating System :: OS Independent", ] dependencies = ["pylatexenc~=2.10"] +description = "Bibtex parser for python 3" dynamic = ["version"] +license = "MIT" +license-files = ["LICENSE"] +maintainers = [{name = "Michael Weiss", email = "code@mweiss.ch"}] +name = "bibtexparser" +readme = "README.md" +requires-python = ">=3.9" [project.optional-dependencies] +docs = ["sphinx"] test = [ - "pytest", # Test runner + "pytest", # Test runner "pytest-xdist", # Parallel tests: `pytest -n ` - "pytest-cov", # Code coverage - "jupyter", # For runnable examples + "pytest-cov", # Code coverage + "jupyter", # For runnable examples ] -docs = ["sphinx"] [project.urls] Homepage = "https://github.com/sciunto-org/python-bibtexparser" Repository = "https://github.com/sciunto-org/python-bibtexparser" -[tool.setuptools.packages.find] -include = ["bibtexparser", "bibtexparser.*"] +[tool.setuptools.dynamic] +version = {attr = "bibtexparser.__version__"} [tool.setuptools.package-data] bibtexparser = ["py.typed"] -[tool.setuptools.dynamic] -version = { attr = "bibtexparser.__version__" } +[tool.setuptools.packages.find] +include = ["bibtexparser", "bibtexparser.*"]