__init__.py
inside the package (folder under the project that has the same name as the
project). This file should be added to each directory on the project directory hierarchy,
otherwise those directories which do not contain this file will not be packaged;setup.py
(e.g. on my github data_sourcery
project);$ pip install --upgrade pip setuptools wheel
$ python setup.py sdist bdist_wheel
(on finishing this step, there will be packages on the dist/
folder)
Before moving on, make sure you have accounts on test pypi and pypi.
Install twine
to upload the python packages (distribution archives) you have generated earlier:
$ pip install --upgrade twine
(take into account that testpypi may not have your project dependencies)
$ python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Then, search for it on https://test.pypi.org. Take into account that _
on package names gets replaced by -
.
To install from testpi into a test virtualenv:
$ pip install -i https://test.pypi.org/simple/ data-sourcery
After installing to a test virtualenv, to make sure it is working:
$ python
$ import package_name
$ package_name.__name__
'package_name'
$ python -m twine upload dist/*
$ pip search your-package
$ pip install your-package