Skip to content

Commit ca445df

Browse files
committed
fix(build): migrate from setup.py to pyproject.toml
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 ca445df

14 files changed

+193
-207
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"

.travis.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ stages:
1010
if: (tag IS present) AND (fork = false)
1111

1212
# Default "install" and "script" steps.
13-
install:
14-
- pip install setuptools=="60.8.2"
13+
install: true
14+
1515
script:
16-
- make all
16+
- make ci
1717

1818
jobs:
1919
include:
@@ -44,12 +44,7 @@ jobs:
4444
- stage: Publish-Release
4545
python: "3.8"
4646
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
47+
script:
48+
- make ci
49+
- make publish-deps
50+
- 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/*

0 commit comments

Comments
 (0)