Skip to content

Commit ab477df

Browse files
authored
Add tox rules for building/uploading PyPI packages (#223)
1 parent 5307f8f commit ab477df

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ env*/
1515
build/
1616
develop-eggs/
1717
dist/
18+
pypi-dist/
1819
downloads/
1920
eggs/
2021
lib/

.pypirc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[distutils]
2+
index-servers=
3+
pypi
4+
testpypi
5+
6+
[pypi]
7+
8+
[testpypi]
9+
repository: https://test.pypi.org/legacy/

tox.ini

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,29 @@ deps =
5757
commands =
5858
sphinx-apidoc -f -o source ../boxsdk
5959
make html
60+
61+
[testenv:py36-build]
62+
description = Build the source and binary wheel packages for distribution.
63+
pypi_dist_dir = {toxinidir}/pypi-dist
64+
commands =
65+
rm -rf "{[testenv:py36-build]pypi_dist_dir}"
66+
{envpython} setup.py -vv \
67+
sdist --formats=gztar --keep-temp --dist-dir="{[testenv:py36-build]pypi_dist_dir}" \
68+
bdist_wheel --keep-temp --dist-dir="{[testenv:py36-build]pypi_dist_dir}"
69+
skip_install = True
70+
sitepackages = False
71+
recreate = True
72+
deps =
73+
wheel
74+
setuptools
75+
whitelist_externals = rm
76+
77+
[testenv:py36-upload]
78+
description = Upload packages to PyPI.
79+
commands =
80+
twine upload --config-file="{toxinidir}/.pypirc" {posargs} {[testenv:py36-build]pypi_dist_dir}/*
81+
skip_install = True
82+
sitepackages = False
83+
recreate = True
84+
deps =
85+
twine

0 commit comments

Comments
 (0)