Python Packaging

learn python packaging via Packaging Python Projects

view example package at https://test.pypi.org/project/example-pkg-pfeilbr/


python3 -m venv .venv
source .venv/bin/activate
mkdir example-pkg-pfeilbr
touch example-pkg-pfeilbr/__init__.py
python3 -m pip install --user --upgrade setuptools wheel
python3 setup.py sdist bdist_wheel
pip install --upgrade pip
pip install wheel
pip install twine
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*

# testing
mkdir tmp
cd tmp
python3 -m venv .venv
source .venv/bin/activate
pip list
python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps example-pkg-pfeilbr

# to install specific version.  did this because it was using 0.0.1 from a cache
python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps 'example-pkg-pfeilbr==0.0.2'

pip list

# test using package
echo -e "import example_pkg_pfeilbr\nprint(example_pkg_pfeilbr.name)" | python


Example Package

This is a simple example package. You can use Github-flavored Markdown to write your content.