This section documents configuration and settings specific to Python based repositories
Python Client Configuration¶
Python repositories are where software development teams that develop with Python share their code artifacts (libraries, packages, etc.).
The Python Package Index or PyPi, is the public repository where open source and other publicly available artifacts can be uploaded and downloaded.
However, many businesses, private organizations and projects require private Python repositories so that they can build and share libraries within their teams.
CloudRepo is a private, cloud based, artifact repository which provides private Python repositories, through the same API as PyPi, to its users.
This page will help you get started by helping you setup a CloudRepo Python repository.
In the Connection Settings of your repository we provide specific configuration information for your repository.
Before you can use CloudRepo with Python you’ll need to ensure that you have created a Python Repository as well as a Repository User in the CloudRepo Admin Portal.
If you haven’t done this yet, please see the following instructions for doing so:
For security purposes (mostly because passwords tend to be stored in plaintext), we do not allow your admin user to access artifacts via the repositories. Please create a user in the CloudRepo Administrator Portal.
You will need a setup.py file (sample). This is used for building your python distributions.
If you need an intro to building and packaging Python packages, check out the setuptools documentation.
Configure the ~/.pypirc File¶
Before you upload, you have to add the following lines to your ~/.pypirc file, substituting the appropriate placeholders:
[distutils] index-servers = cloudrepo pypi [cloudrepo] repository: https://[your-organization-name].mycloudrepo.io/repositories/[your-repository-name] username: [repository-user-email-address] password: [repository-user-password]
Uploading Python Packages to CloudRepo¶
To upload to cloudrepo, you’ll need to have twine installed (pip install twine). Then you’ll run the following command:
/usr/local/bin/twine upload dist/* --repository cloudrepo
Files which ar successfully published to CloudRepo are immediately avaialble for retrieval and can be seen in the CloudRepo Administrator Portal.
More importantly, these files will now be able to be downloaded with PiP.
Installing Python Packages from CloudRepo¶
Now, to install the packages from CloudRepo, run the following command, substituting the appropriate placeholders:
pip install --index-url 'https://[repository-user-email-address]:[repository-user-password]@[your-organization-name].mycloudrepo.io/repositories/[your-repository-name]' [your-package-name]
After this, your package will be installed on your machine.
Python Repository Settings¶
Python repositories support Overwrite Protection, which prevents you from overwriting a existing file in a repository.
Overwrite Protection prevents all overwrites of a file, both through the PyPi APIs as well as the Admin Portal UI.
Toggle overwrite protection in the Repository Settings of your Python Repository.
In the above image, Overwrite Protection is disabled and overwrites will be allowed.
In the above image, Overwrite Protection is enabled and overwrites will be rejected.