Skip to main content

Private package management tool for Python projects

Project description

pypiprivate is a command line tool for hosting a private PyPI-like package index or in other words, a manual python repository backed by a file based storage.

It’s implemented in a way that the storage backends are pluggable. At present, only AWS S3 and local file system are supported but more implementations can be added in future.

The backend can be protected behind a HTTP reverse proxy (eg. Nginx) to allow secure private access to the packages.

How it works?

Update: We have published a blog post that explains the usage, approach and rationale in detail - Private Python Package Index with Zero Hassle.

At present pypiprivate comes with only one command to publish a package (more utilities for package search and discoverability are coming soon).

A publish operation involves,

  1. Copying all the available package artifacts for a specific version under the ./dist directory to the storage backend

  2. Creating the index on the same storage backend

The file structure created on the backend conforms to the “Simple Repository API” specification defined in PEP 503.

The files can now be served securely by a webserver eg. by setting up a Nginx reverse proxy.

It’s important to note that although the name of the project is pypiprivate, it’s upto you to ensure that the access to both, the storage and the index is really private. If you are using S3 and Nginx, for example, then

  • package authors/owners will need read-write S3 creds to publish packages

  • nginx will authenticate with S3 using read-only S3 creds and protect the files via HTTP Basic authentication

  • package users will need HTTP Auth creds to install the packages using pip

Installation

pypi-private can be installed using pip as follows,

$ pip install pypiprivate

After installation, a script pypi-private which will be available at PATH.

You may choose to install it in a virtualenv, but it’s recommended to install it globally for all users (using sudo) so that it’s less confusing to build and publish projects that need to use their own virtualenvs.

Configuration

pypiprivate requires it’s own config file, the default location for which is ~/.pypi-private.cfg. This repo contains the example config file example.pypi-private.cfg, which can be simply copied to the home directory and renamed to .pypi-private.cfg.

For aws-s3 type of storage backend, two environment variables PP_S3_ACCESS_KEY and PP_S3_SECRET_KEY are required to be set besides the config. The advantage of excluding s3 credentials in config file are that (1) they are not stored in plain text and, (2) it’s easier to switch between read-only/read-write keys

Usage

First create the builds,

$ python setup.py sdist bdist_wheel

Then to publish the built artifacts run,

$ pypi-private -v publish <pkg-name> <pkg-version>

For other options, run

$ pypi-private -h

Fetching packages published using pypiprivate

Run pip with the --extra-index-url option,

$ pip install mypackage --extra-index-url=https://<user>:<password>@my.private.pypi.com/simple

Or, add the extra-index-url to pip config file at ~/.pip/pip.conf as follows

[install]
extra-index-url = https://<user>:<password>@my.private.pypi.com/simple

And then simply run,

$ pip install mypackage

License

MIT (See LICENSE)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypiprivate-0.4.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pypiprivate-0.4.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

pypiprivate-0.4.0-py2-none-any.whl (11.9 kB view details)

Uploaded Python 2

File details

Details for the file pypiprivate-0.4.0.tar.gz.

File metadata

  • Download URL: pypiprivate-0.4.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.11.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.14

File hashes

Hashes for pypiprivate-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4c808579e1700800d1605e195fc9b5fb0cff87d2c1ca66d262a4588f08ad2519
MD5 dde5e431937c1889a02952946a7798be
BLAKE2b-256 7cd9da69f685e8f08f1a8cc2dbf296ab3122c9a938060f32a089c859da10928a

See more details on using hashes here.

File details

Details for the file pypiprivate-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pypiprivate-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.11.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.14

File hashes

Hashes for pypiprivate-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5295126f34b8eb5b7b72c5e6126a6d674112058af4491e901d363605c3adbebe
MD5 44051c30caadda5aa926f00abef43d23
BLAKE2b-256 b4468a7ec270b174b64e621a3231690b23077bac740f3fea27173df1112ef447

See more details on using hashes here.

File details

Details for the file pypiprivate-0.4.0-py2-none-any.whl.

File metadata

  • Download URL: pypiprivate-0.4.0-py2-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.11.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.14

File hashes

Hashes for pypiprivate-0.4.0-py2-none-any.whl
Algorithm Hash digest
SHA256 ee892f20051b9ced38aa342385777e28b0f8e70de5154d85d711f9b55c4556d6
MD5 0ab68468cf7d509e914433365de0d2ac
BLAKE2b-256 6d8ec82572ce146b6db0a8aaabf7cc95f51be28e67dadaf1bdff3df44760cbb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page