Packaging Python Projects — Supplement

examplepkglarkintuckerllc
|- examplepkglarkintuckerllc
|- __init__.py
$ python -m examplepkglarkintuckerllc
Hello World!
$ python -m unittest discover -s tests
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
  • The only functional difference between this and the official tutorial is the addition of the license keyword argument; this avoids having an empty license value in the uploaded distribution package
  • The principal stylistic difference is the sorting of the keyword arguments
$ pip install --upgrade setuptools wheel twine
$ python setup.py sdist bdist_wheel
  • build
  • dist
  • examplepkglarkintuckerllc.egg-info
$ twine upload --repository testpypi dist/*
$ pipenv install --pypi-mirror https://test.pypi.org/simple/ examplepkglarkintuckerllc
$ pipenv run python example.py
Hello World!
$ python setup.py sdist bdist_wheel
$ twine upload --repository testpypi dist/*
$ pipenv install random-word
$ pipenv run python -m examplepkglarkintuckerllc
Hello World!
amenability
install_requires=['random-word'],
install_requires=['random-word==1.0.4"'],
install_requires=[
'requests', 'nose'
],
$ pipenv run pip freeze > requirements.txt
$ cat requirements.txt
certifi==2020.6.20
chardet==3.0.4
idna==2.10
nose==1.3.7
Random-Word==1.0.4
requests==2.24.0
urllib3==1.25.10
$ python setup.py sdist bdist_wheel
$ twine upload dist/*
$ pipenv install examplepkglarkintuckerllc
$ pipenv run python example.py
Hello World!
amenability

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
John Tucker

John Tucker

Broad infrastructure, development, and soft-skill background