From 0f0f7cff384f3c9a17f577fd2328194a84d66c4e Mon Sep 17 00:00:00 2001 From: Laurie O Date: Tue, 14 Oct 2025 00:04:09 +1000 Subject: [PATCH 1/3] Build with 'build' --- .github/workflows/release.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a5689dc1..59b71797 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install build twine - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} diff --git a/Makefile b/Makefile index e5bcb308..39f90d1e 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ release-test: sdist twine upload --repository-url https://test.pypi.org/legacy/ dist/* sdist: clean - python setup.py sdist bdist_wheel + python -m build -d dist . ls -l dist test: From 90bbf2d092ca47820fd686e9a80e24168b72645e Mon Sep 17 00:00:00 2001 From: Laurie O Date: Tue, 14 Oct 2025 00:07:02 +1000 Subject: [PATCH 2/3] Declare build backend and requirements --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..fed528d4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" From d92f3de37137fc90eb4b1ecaa50ccfad1e9bcd1d Mon Sep 17 00:00:00 2001 From: Laurie O Date: Tue, 14 Oct 2025 00:22:01 +1000 Subject: [PATCH 3/3] Move project metadata and config to pyproject.toml --- pyproject.toml | 60 +++++++++++++++++++++++++++++++++++++++++- setup.cfg | 3 --- setup.py | 71 -------------------------------------------------- 3 files changed, 59 insertions(+), 75 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index fed528d4..3ddd1360 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,61 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools >= 77.0"] build-backend = "setuptools.build_meta" + +[project] +name = "python-dotenv" +description = "Read key-value pairs from a .env file and set them as environment variables" +authors = [ + {name = "Saurabh Kumar", email = "me+github@saurabh-kumar.com"}, +] +license = "BSD-3-Clause" +keywords = [ + "environment variables", + "deployments", + "settings", + "env", + "dotenv", + "configurations", + "python", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "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 :: PyPy", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Operating System :: OS Independent", + "Topic :: System :: Systems Administration", + "Topic :: Utilities", + "Environment :: Web Environment", +] + +requires-python = ">=3.9" + +dynamic = ["version", "readme"] + +[project.urls] +Source = "https://github.com/theskumar/python-dotenv" + +[project.optional-dependencies] +cli = [ + "click>=5.0", +] + +[project.scripts] +dotenv = "dotenv.__main__:cli" + +[tool.setuptools] +packages = ["dotenv"] +package-dir = {"" = "src"} +package-data = {dotenv = ["py.typed"]} + +[tool.setuptools.dynamic] +version = {attr = "dotenv.version.__version__"} +readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} diff --git a/setup.cfg b/setup.cfg index 60effd2b..8ab2d3af 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,9 +13,6 @@ exclude = .tox,.git,docs,venv,.venv,build check_untyped_defs = true ignore_missing_imports = true -[metadata] -description_file = README.md - [tool:pytest] testpaths = tests diff --git a/setup.py b/setup.py deleted file mode 100644 index f3d43ca1..00000000 --- a/setup.py +++ /dev/null @@ -1,71 +0,0 @@ -from setuptools import setup - - -def read_files(files): - data = [] - for file in files: - with open(file, encoding="utf-8") as f: - data.append(f.read()) - return "\n".join(data) - - -long_description = read_files(["README.md", "CHANGELOG.md"]) - -meta = {} -with open("./src/dotenv/version.py", encoding="utf-8") as f: - exec(f.read(), meta) - -setup( - name="python-dotenv", - description="Read key-value pairs from a .env file and set them as environment variables", - long_description=long_description, - long_description_content_type="text/markdown", - version=meta["__version__"], - author="Saurabh Kumar", - author_email="me+github@saurabh-kumar.com", - url="https://github.com/theskumar/python-dotenv", - keywords=[ - "environment variables", - "deployments", - "settings", - "env", - "dotenv", - "configurations", - "python", - ], - packages=["dotenv"], - package_dir={"": "src"}, - package_data={ - "dotenv": ["py.typed"], - }, - python_requires=">=3.9", - extras_require={ - "cli": [ - "click>=5.0", - ], - }, - entry_points={ - "console_scripts": [ - "dotenv=dotenv.__main__:cli", - ], - }, - license="BSD-3-Clause", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "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 :: PyPy", - "Intended Audience :: Developers", - "Intended Audience :: System Administrators", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Topic :: System :: Systems Administration", - "Topic :: Utilities", - "Environment :: Web Environment", - ], -)