Skip to content

Commit be63d03

Browse files
authored
fix(build): migrate from setup.py to pyproject.toml (#271)
This commit modifies the project so that its metadata is configured in the pyproject.toml file instead of setup.py. Signed-off-by: Phil Adams <[email protected]>
1 parent 48086b0 commit be63d03

16 files changed

+195
-217
lines changed

.bumpversion.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ search = "__version__ = '{current_version}'"
99
replace = "__version__ = '{new_version}'"
1010

1111
[[tool.bumpversion.files]]
12-
filename = "setup.py"
13-
search = "__version__ = '{current_version}'"
14-
replace = "__version__ = '{new_version}'"
12+
filename = "pyproject.toml"
13+
search = "version = \"{current_version}\""
14+
replace = "version = \"{new_version}\""
1515

1616
[[tool.bumpversion.files]]
1717
filename = "README.md"

.releaserc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[
99
"@semantic-release/exec",
1010
{
11-
"prepareCmd": "bump-my-version bump --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version}"
11+
"prepareCmd": "bump-my-version bump --allow-dirty --verbose --current-version ${lastRelease.version} --new-version ${nextRelease.version}"
1212
}
1313
],
1414
[

.travis.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ dist: jammy
44

55
stages:
66
- name: Build-Test
7+
if: tag IS blank
78
- name: Semantic-Release
89
if: (branch = main) AND (type IN (push, api)) AND (fork = false)
910
- name: Publish-Release
1011
if: (tag IS present) AND (fork = false)
1112

1213
# Default "install" and "script" steps.
13-
install:
14-
- pip install setuptools=="60.8.2"
14+
install: true
15+
1516
script:
16-
- make all
17+
- make ci
1718

1819
jobs:
1920
include:
@@ -44,12 +45,7 @@ jobs:
4445
- stage: Publish-Release
4546
python: "3.8"
4647
name: Publish-To-PyPi
47-
before_deploy:
48-
- pip install bump-my-version
49-
deploy:
50-
- provider: pypi
51-
setuptools_version: "60.8.2"
52-
user: $PYPI_USER
53-
password: $PYPI_TOKEN
54-
repository: https://upload.pypi.org/legacy
55-
skip_cleanup: true
48+
script:
49+
- make ci
50+
- make publish-deps
51+
- make publish-release

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
include requirements.txt
2-
include requirements-dev.txt
31
include LICENSE

Makefile

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,30 @@
33
# example: "make setup"
44

55
PYTHON=python
6+
LINT=black
67
LINT_DIRS=ibm_platform_services test/unit test/integration examples
78

8-
setup: deps dev_deps install_project
9+
setup: deps dev-deps install-project
910

10-
all: upgrade_pip setup test-unit lint
11+
all: upgrade-pip setup test-unit lint
1112

12-
ci: setup test-unit lint
13+
ci: all
1314

14-
upgrade_pip:
15+
publish-release: build-dist publish-dist
16+
17+
upgrade-pip:
1518
${PYTHON} -m pip install --upgrade pip
1619

1720
deps:
18-
${PYTHON} -m pip install -r requirements.txt
21+
${PYTHON} -m pip install .
22+
23+
dev-deps:
24+
${PYTHON} -m pip install .[dev]
1925

20-
dev_deps:
21-
${PYTHON} -m pip install -r requirements-dev.txt
26+
publish-deps:
27+
${PYTHON} -m pip install .[publish]
2228

23-
install_project:
29+
install-project:
2430
${PYTHON} -m pip install -e .
2531

2632
test: test-unit test-int
@@ -36,7 +42,15 @@ test-examples:
3642

3743
lint:
3844
${PYTHON} -m pylint ${LINT_DIRS}
39-
black --check ${LINT_DIRS}
45+
${LINT} --check ${LINT_DIRS}
4046

4147
lint-fix:
42-
black ${LINT_DIRS}
48+
${LINT} ${LINT_DIRS}
49+
50+
build-dist:
51+
rm -fr dist
52+
${PYTHON} -m build
53+
54+
# This target requires the TWINE_PASSWORD env variable to be set to the user's pypi.org API token.
55+
publish-dist:
56+
TWINE_USERNAME=__token__ ${PYTHON} -m twine upload --non-interactive --verbose dist/*

codecov.yml

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

0 commit comments

Comments
 (0)