How to manage python packages with packagecloud.
Build the wheel using setuptools
.
Describe the package settings in setup.py
.
setup.py
from setuptools import setup, find_packages
setup(
name='python_packagecloud_test',
version='0.0.1',
author='',
author_email='',
url='',
license='See LICENSE.txt',
description='',
long_description=open('README.md').read(),
packages=find_packages(),
install_requires=[]
)
Install and build wheel.
$ pip install wheel
$ python setup.py bdist_wheel
A file called python_packagecloud_test-0.0.1-xxx-yyy.whl
will be built under the dist directory.
$ gem install package_cloud --no-ri --no-rdoc
It seems that the following three tokens are used properly in packagecloud.
Master Token Master Token will generate a Read Token.
Read Token Read Token is a read-only token used for authentication for each repository. The Read Token is automatically generated when you run Packagecloudn's Install Script (https://packagecloud.io/docs#install_repo).
API Token Token used to embed in CI etc. and push to repository
$ export PACKAGECLOUD_TOKEN=<API token>
$ echo "{\"url\":\"https://packagecloud.io\",\"token\":\"$PACKAGECLOUD_TOKEN\"}" > ~/.packagecloud
$ package_cloud push <username>/<reponame> dist/python_packagecloud_test-0.0.1-xxx-yyy.whl
$ curl -s https://<master-token>:@packagecloud.io/install/repositories/<username>/<reponame>/script.python.sh | bash
$ sudo pip install python-packagecloud-test==0.0.1
$ export PACKAGECLOUD_TOKEN=<read-token>
$ pip install python-packagecloud-test==0.0.1 --extra-index-url=https://$PACKAGECLOUD_TOKEN:@packagecloud.io/<username>/<reponame>/pypi/simple
or
$ pip install -r requirements.txt --extra-index-url=https://$PACKAGECLOUD_TOKEN:@packagecloud.io/<username>/<reponame>/pypi/simple
Recommended Posts