[Package cloud] Manage python packages with package cloud

How to manage python packages with packagecloud.

Wheel build

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.

Install the package_cloud command

$ gem install package_cloud --no-ri --no-rdoc

package cloud token

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

push to package cloud

$ 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

Installation from package cloud

Install with installation script

$ curl -s https://<master-token>:@packagecloud.io/install/repositories/<username>/<reponame>/script.python.sh | bash
$ sudo pip install python-packagecloud-test==0.0.1

Install by specifying ʻextra-index-url`

$ 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

[Package cloud] Manage python packages with package cloud
Manage cron jobs with python
Manage python environment with virtualenv
Manage Python runtime packages and development environment packages with Poetry
Run XGBoost with Cloud Dataflow (Python)
Visualize python package dependencies with graphviz
Manage each Python version with Homebrew
Python installation and package management with pip
Try using Python with Google Cloud Functions
[GCP] Operate Google Cloud Storage with Python
Text mining with Python ② Visualization with Word Cloud
Manage python packages to install in containers
[Python] Get Python package information with PyPI API
Manage multiple Python versions with update-alternatives (Ubuntu)
Scraping with Python
Statistics with python
Scraping with Python
Python with Go
Twilio with Python
Integrate with Python
Play with 2016-Python
AES256 with python
Tested with Python
python starts with ()
with syntax (Python)
Bingo with python
Zundokokiyoshi with python
Excel with Python
Microcomputer with Python
Cast with python
Use additional Python packages with Serverless Framework (v1.x)
Text extraction with GCP Cloud Vision API (Python3.6)
Try it with Word Cloud Japanese Python JupyterLab.
Python (Windows 10) Virtual Environment / Package with VS Code
Manage Python multiple version environment with Pythonz, virtualenv
Manage AWS nicely with the Python library Boto
Manage multiple context managers together with Python contextlib.ExitStack
Read wav files with only Python standard packages
Use Python / Django with Windows Azure Cloud Service!
[Cloud102] # 1 Get Started with Python (Part 1 Python First Steps)
Flow of creating your own package with setup.py with python
Zip, unzip with python
Django 1.11 started with Python3.6
Primality test with Python
Python with eclipse + PyDev.
[GCP] [Python] Deploy API serverless with Google Cloud Functions!
Scraping with Python (preparation)
Try scraping with Python.
Learning Python with ChemTHEATER 03
Sequential search with Python
"Object-oriented" learning with python
Run Python with VBA
Handling yaml with python
Solve AtCoder 167 with python
Serial communication with python
[Python] Use JSON with Python
Learning Python with ChemTHEATER 05-1
Learn Python with ChemTHEATER
Run prepDE.py with python3
Installing packages with pip3
Run a machine learning pipeline with Cloud Dataflow (Python)