Uploading a package

Prerequisites

pryv expects packaged Python’s file to be uploaded. We assume you have basic skills on packaging your code. We only provide a quick overview on how to proceed.

You need to install Setuptools on your machine:

pip install --upgrade setuptools

You should architecture your project’s directory similarly to the following:

myproject/
  setup.py
  myproject/
    __init__.py
    other modules...

A minimal setup.py file looks like the following:

from setuptools import setup, find_packages

setup(
    name = 'MyProject',
    version = '1.0.0',
    url = 'https://github.com/me/myproject.git',
    author = 'Me',
    author_email = 'me@gmail.com’,
    description = 'Short description of my project',
    packages = find_packages(),
    install_requires = [],
)

Now, in order to upload your project to pryv, you’ll need to package it. You can do the following:

python setup.py sdist bdist_wheel

Note

To ensure your project’s packages to not be published on the public Pypi, you can add the following to your setup.py:

setup(
    # ...
    classifiers=[
        'Private :: Do Not Upload to pypi server',
    ],
)

Uploading a package with Twine

You can upload your packages to pryv using Twine.

First, install setuptools and twine:

pip install --upgrade setuptools twine

Then you should package your code using setuptools. Use the following for both source and wheel distributions:

python setup.py sdist bdist_wheel

Finally, you upload your freshly built distribution using:

twine upload --repository-url http://username:password@127.0.0.1:5555/simple dist/*

Alternatively, if you don’t want to write the URL to your pryv server each time you upload a package, you can use a .pypirc configuration file. To do so, create a .pypirc file either at the root of your project’s directory or in your home directory (i.e. ~/.pypirc). Set its content to:

[distutils]
index-servers =
    pryv

[pryv]
repository = http://127.0.0.1:5555/simple
username =
password =

You can now use the following shorthand syntaxes for uploading. If you created the .pypirc file at the root of your project’s directory:

twine upload --config-file .pypirc --repository pryv dist/*

Or, if you created a ~/.pypirc file:

twine upload --repository pryv dist/*

Uploading a package with Setuptools

You can also upload your packages to pryv by simply using Setuptools:

python setup.py sdist bdist_wheel upload --repository pryv

Note

In the above example, we assume that a ~/.pypirc file exists with a pryv index server configured, as detailed in the Twine paragraph.

Warning

Uploading packages with Setuptools is now deprecated. Use Twine instead.

pryv was tested with Setuptools, but no maintenance is guaranteed on this feature. You should consider using Twine for compatibility.