A sample project that exists as an aid to the Python Packaging User Guide' s Tutorial on Packaging and Distributing Projects.
This project does not aim to cover best practices for Python project development as a whole. For example, it does not provide guidance or tool recommendations for version control, documentation, or testing.
The source for this project is available here.
Most of the configuration for a Python project is done in the setup.py
file, an example of which is included in this
project. You should edit this file accordingly to adapt this sample project to your needs.
Python 3.8 or later with all requirements.txt
dependencies installed, including build
and twine
. To install run:
python -m pip install -U pip
pip install -r requirements.txt
# Build and upload https://pypi.org/
rm -rf build dist && python -m build && python -m twine upload dist/*
# username: __token__
# password: pypi-AgENdGVzdC5weXBpLm9yZ...
# Download and install
pip install -U ultralytics
# Import and test
python -c "from ultralytics import simple; print(simple.add_one(10))"
sample_script
# Build and upload https://test.pypi.org/
rm -rf build dist && python -m build && python -m twine upload --repository testpypi dist/*
# username: __token__
# password: pypi-AgENdGVzdC5weXBpLm9yZ...
# Download and install
pip install -U --index-url https://test.pypi.org/simple/ --no-deps ultralytics2==0.0.9
# Import and test
python -c "from ultralytics import simple; print(simple.add_one(10))"
sample_script