Back to Browse

Packaging Python Projects (How to publish packages)

45 views
Dec 5, 2022
21:37

The code shown in this video can be downloaded from my bitbucket account: https://bitbucket.org/developerbitstutorials/packaging_tutorial/src/master ISSUE with Virtual Environment In case you face issue regarding virtual environment or ensurepipmodule in case of ubuntu/debian systems, please use the package venv instead of virtualenv Suppose you are using python version 3.8, run these commands: sudo apt-get install python3.8-venv To create virtual environment: python3.8 -m venv packagingvenv STEPS for creating test package and uploading to test.pypi.org. 1. To test uploading of a test package to pypi.org, register an account on test.pypi.org as shown in the video. 2. Login to test.pypi.org, add a token and copy the token username and the token password. 3. Create a virtual environment. python3.8 -m venv packagingvenv or python3.8 -m virtualenv packagingvenv 4. Activate the environment. (source bin/activate or Scripts\activate) 5. Update the tools: pip install --upgrade pip setuptools wheel 6. Create a test package as shown in the video. 7. After creating the package, install the build tool: pip install --upgrade build 8. Build the package while sitting in the path where pyproject.toml file is present: python -m build 9. A folder with name dist will be created. 10. Install the package twine: pip install --upgrade twine 11. Run the following command to upload the test package to the test.pypi.org site: python -m twine upload --repository testpypi dist/* 12. When prompted, provide the username as __token__ and the token password you already copied from the site test.pypi.org. 13. Once you are perfect in creating packages, you can upload it to the main community site pypi.org Good Luck !!

Download

0 formats

No download links available.

Packaging Python Projects (How to publish packages) | NatokHD