short package description
Project description
Note: you have to change package name because of test.pypi won't accept any repeated package name.
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.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d235f0658be1ea681b86a42fa1f41b7f48f09e7a4fe962c1066ce9ee6614e92d |
|
MD5 | dc10da2765a1d1d7ca314509e51a1f67 |
|
BLAKE2b-256 | 78a07ac57d7dbaab8a2d6315a92a1a91725d2ccb03fab13a65d6c1e8eebe6ae0 |