Twine

Uploading your packages to Packagr with twine

Building a package

Let’s say you have a folder containing some code to deploy to Packagr in a folder that looks like this:

root_dir/
    my_code/
        <<some python files>>

To create a package from the my_code folder, create a file called setup.py, and add the following content to it

from setuptools import setup

setup(
  name="my_code",
  packages=["my_code"],
  version="0.1.0",
)

To create a package from your code, open a terminal window at the same location as setup.py, and enter the following commands:

Install wheel

pip install wheel

Create wheel/sdist format packages

python setup.py sdist bdist_wheel

This will create a folder called dist containing your package

Uploading your package with twine

We can now upload our package to Packagr using twine. Let’s start by installing twine using pip

pip install twine

We can now upload our package to Packagr using the following command (don’t forget to insert your own repository URL here):

twine upload  --repository-url https://api.packagr.app/<my-hash-id>/ dist/*