Skip to content

Commit 620b8be

Browse files
Migrate packaging from setup.py to pyproject.toml (PEP 517/621) (#536)
* Migrate packaging from setup.py to pyproject.toml (PEP 517/621) Consolidate build configuration onto a PEP 621 pyproject.toml with the setuptools backend. The version stays single-sourced in dropbox/dropbox_client.py via `[tool.setuptools.dynamic]` attr: (resolved by setuptools>=61 AST parsing, so the module is not imported at build time and scripts/update_version.sh is unchanged). - Add pyproject.toml: project metadata, runtime deps (requests, stone), optional-dependencies (test/docs/dev), pytest config, and Description-Content-Type text/x-rst (previously missing). - Delete setup.py and setup.cfg. - tox.ini: [testenv:check] uses `python -m build` (add build dep); [testenv:lint] drops the setup.py flake8 target. - ci.yml: flake8 target drops setup.py. - coverage.yml: `python setup.py install` -> `pip install .` (both jobs). - README.rst: install-from-source uses `pip install .`. - .readthedocs.yml: install via `method: pip` with the docs extra. - requirements.txt: reword sync comment to point at pyproject.toml. Closes #487 * Use SPDX license expression in pyproject.toml Switch to the PEP 639 form: license = "MIT" + license-files, drop the redundant License classifier, and raise the setuptools floor to >=77.0 (first version supporting the SPDX license expression). Produces License-Expression: MIT in the metadata.
1 parent 2e6df15 commit 620b8be

9 files changed

Lines changed: 60 additions & 66 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
4949
- name: Run linter
5050
run: |
51-
flake8 setup.py dropbox example test
51+
flake8 dropbox example test
5252
5353
- name: Run unit tests
5454
run: |

.github/workflows/coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
pip install coverage pytest
2828
pip install -r requirements.txt
2929
pip install -r test/requirements.txt
30-
python setup.py install
30+
pip install .
3131
- name: Generate Unit Test Coverage
3232
run: |
3333
coverage run --rcfile=.coveragerc -m pytest test/unit/test_dropbox_unit.py
@@ -57,7 +57,7 @@ jobs:
5757
pip install coverage pytest
5858
pip install -r requirements.txt
5959
pip install -r test/requirements.txt
60-
python setup.py install
60+
pip install .
6161
- name: Generate Unit Test Coverage
6262
env:
6363
LEGACY_USER_DROPBOX_TOKEN: ${{ secrets.LEGACY_USER_DROPBOX_TOKEN }}

.readthedocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ build:
1111

1212
python:
1313
install:
14-
- requirements: requirements.txt
15-
- method: setuptools
14+
- method: pip
1615
path: .
16+
extra_requirements:
17+
- docs
1718

1819
sphinx:
1920
configuration: docs/conf.py

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Install from source:
4040
4141
$ git clone git://github.com/dropbox/dropbox-sdk-python.git
4242
$ cd dropbox-sdk-python
43-
$ python setup.py install
43+
$ pip install .
4444
4545
After installation, follow one of our `Examples`_ or read the documentation on `Read The Docs`_.
4646

pyproject.toml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[build-system]
2+
requires = ["setuptools>=77.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "dropbox"
7+
dynamic = ["version"]
8+
description = "Official Dropbox API Client"
9+
readme = { file = "README.rst", content-type = "text/x-rst" }
10+
requires-python = ">=3.11"
11+
license = "MIT"
12+
license-files = ["LICENSE"]
13+
authors = [{ name = "Dropbox", email = "dev-platform@dropbox.com" }]
14+
dependencies = [
15+
"requests>=2.16.2",
16+
"stone>=3.4.0,<4",
17+
]
18+
classifiers = [
19+
"Development Status :: 5 - Production/Stable",
20+
"Intended Audience :: Developers",
21+
"Operating System :: OS Independent",
22+
"Programming Language :: Python",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
26+
"Programming Language :: Python :: 3.13",
27+
"Programming Language :: Python :: Implementation :: CPython",
28+
"Programming Language :: Python :: Implementation :: PyPy",
29+
"Topic :: Software Development :: Libraries :: Python Modules",
30+
]
31+
32+
[project.urls]
33+
Homepage = "http://www.dropbox.com/developers"
34+
Source = "https://github.com/dropbox/dropbox-sdk-python"
35+
36+
[project.optional-dependencies]
37+
test = ["pytest", "mock", "pytest-mock", "coverage", "stone>=3.4.0,<4"]
38+
docs = ["sphinx", "sphinx_rtd_theme"]
39+
dev = ["flake8", "twine", "wheel", "build"]
40+
41+
[tool.setuptools]
42+
packages = ["dropbox"]
43+
zip-safe = false
44+
45+
[tool.setuptools.dynamic]
46+
version = { attr = "dropbox.dropbox_client.__version__" }
47+
48+
[tool.pytest.ini_options]
49+
norecursedirs = [".tox", ".venv", ".venv-*", "stone"]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Dependencies required for installation (keep in sync with setup.py)
1+
# Dependencies required for installation (keep in sync with pyproject.toml)
22
requests>=2.16.2
33
stone>=3.4.0,<4
44
# Other dependencies for development

setup.cfg

Lines changed: 0 additions & 5 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ deps =
3636
[testenv:check]
3737

3838
commands =
39-
python setup.py sdist bdist_wheel
39+
python -m build
4040
twine check dist/*
4141

4242
deps =
43+
build
4344
twine
4445

4546
usedevelop = true
@@ -48,7 +49,7 @@ usedevelop = true
4849
[testenv:lint]
4950
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
5051
commands =
51-
flake8 setup.py dropbox example test
52+
flake8 dropbox example test
5253
deps =
5354
flake8
5455
-rtest/requirements.txt

0 commit comments

Comments
 (0)