Skip to main content

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

exampleapp2-0.0.4.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

exampleapp2-0.0.4-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page