short package description
Project description
Note: write your logic code in exampleapp
directory then write your tests file in tests
directory.
Note: you have to choose suitable package_name because of test.pypi won't accept any repeated package_name.
Note: replace exist links in project_urls
in setup.py
with your own links.
Note: fill requirements.txt
with dependencies that your package need.
Local Install
Before uploading our package to PyPI we can confirm that our package can be installed via pip install by navigating to our package directory and entering:
pip install .
or
pip install -e .
if you want make it editable.
This should then install our package like any other package install via pip:
Build
Once we’ve written our code files, setup configuration, and tested the install — we’re ready to build our package distribution.
The build process creates a new directory dist
which will contain a .tar.gz
and .whl
file — this is what we need to publish our package to PyPI.
To build our dist
files, we use a tool creatively named build
. First, we type:
pip install build
then, while in our package directory — type:
python -m build
Once this is complete, we should find a new /dist directory inside our package directory.
Publish to TestPyPI
Finally, we are ready to publish our new Python package! Again, we make use of another package called twine
. We install this with:
pip install twine
Once installed, we upload to TestPyPI — a ‘test’ version of PyPI so that we can double-check that we have set everything up correctly. We do this by typing:
python -m twine upload --repository testpypi dist/*
At this point, we’ll need to login to TestPyPI — if you don’t have an account, sign up for one here. If everything is set up correctly, our package will be uploaded:
Now, we can test that our new package works through another pip install — but this time from TestPyPI:
pip install -i https://test.pypi.org/simple/ exampleapp
(If you find that the package is already installed — just pip uninstall exampleapp
).
PyPI
Once we’ve confirmed that the package works — we take our final step, publishing to PyPI. Again, you’ll need to register here.
Next, we upload our package to PyPI with:
python -m twine upload --repository pypi dist/*
And we’re done!
That’s our first Python package deployment — it’s surprisingly straightforward. We can go ahead and pip install exampleapp
to use the package.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for exampleapp2-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd4e21904b981ff7fd762c8dd5c83b3f3b43bde456da132198d3f0fe4f0b9434 |
|
MD5 | 7da39cc2a20b51cdaacb87f8c6c4335e |
|
BLAKE2b-256 | 39342a9cc3e189e5bdff1b1e5e1a49ee246a26505ec42a4a6ce7b60f8c0844f2 |