Make a built distribution package to github
- Create a repo at https://github.com/yes4me/hello_world_python
- run the following command
cd my_package
pip install wheel
python setup.py bdist_wheel
copy ./dist/*.whl .
git init
git add *.whl
git commit -m "first commit"
git remote add origin https://github.com/yes4me/hello_world_python.git
git push
-
Create run_hello_world.py
from hello_module import say_hello say_hello()
-
Create requirements.txt, with either:
git+https://github.com/yes4me/hello_world_python.git
git+https://github.com/yes4me/hello_world_python.git@[branch_name]
-
Either:
- cmd:
pip install .\hello_world-1.0-py3-none-any.whl
- cmd:
pip install pip install https://github.com/yes4me/hello_world_python/raw/main/dist/hello_world-1.0-py3-none-any.whl
- cmd:
-
cmd:
python run_hello_world.py
- cmd:
pip uninstall -y hello-world
PS: You cannot do pip uninstall -r requirements.txt -y
. This is because pip installs packages from Git repositories in
editable mode (-e), and there isn't a straightforward way to uninstall packages installed in editable mode.