Speaker
Mark Smith
Material
Note
Basic Usage
from setuptools import setup
setup(
name="helloworld",
version="0.0.1",
description="Say hello!",
py_modules=["helloworld"],
package_dir={'': 'src'},
)
python setup.py bdist_wheel
- test installation locally
- Links to the code instead of add it to
site-packages
Documentation
- Compare ReStructured Text and markdown
ReStructured Text |
Markdown |
Pythonic |
More Widespread |
Powerful |
Simply |
Sphinx |
mkdocs |
- keys added to
setup.py
- classifiers
- long_description
- long_description_content_type="text/markdown"
Dependencies
install_required |
extras_require |
production dependencies |
optional requirements |
relaxed versions (users can install without conflicts with other packages) |
specific versions (developers can have identical develop environment) |
- keys added to
setup.py
- install_requires
- extras_require
- install package with extras_require
Source Distribution
- keys added to
setup.py
- Ideally, everything should be included for source distribution
Publish
python setup.py bdist_wheel sdist
twine upload dist/*
Other Stuffs to add
- Must Do
- tox
- Continuous Integration
- Nice to have
- badges
- code coverage
- quality metrics
- test on macOS & windows
- more document
- contributors section
- Code of Conduct
Don't do any thing mention above
Things are changing
- move metadata from
setup.py
to setup.cfg
- move to
pyprojec.toml
Share on:
Twitter
❄ Facebook
❄ Email