• Stars
    star
    112
  • Rank 305,990 (Top 7 %)
  • Language
    Shell
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Docker build for a simple PyPI server.

PyPI Server

This is a simple PyPI server that can be used to host internal packages and versions of packages that are suitable for use with proprietary products.

Usage

If you're not dealing with the Git repo but running the container directly from the Docker index, you can use commands such as the following:

sudo mkdir -p /srv/pypi             # local directory where packages reside
sudo touch /srv/pypi/.htpasswd      # credentials file for adding packages
docker run -t -i --rm \             # remove container when stopped
    -h pypi.local \                 # hostname
    -v /srv/pypi:/srv/pypi:rw \     # host packages from local directory
    -p 8080:80 \                    # expose port 80 as port 8080
    --name pypi \                   # container name
    codekoala/pypi                  # docker repository

Once running, you should be able to visit http://localhost:8080 to see the landing page for your very own PyPI server.

You can add Python packages to the server simply by including the tarballs, zips, wheels, eggs, etc in your /srv/pypi directory.

Configuration

There are some environment variables that may be set to override the default behavior:

  • PYPI_ROOT: path within the container where packages will be stored. Defaults to /srv/pypi.
  • PYPI_PORT: port to bind to receive requests. Defaults to 80.
  • PYPI_PASSWD_FILE: path to authentication file. Defaults to /srv/pypi/.htpasswd.
  • PYPI_OVERWRITE: allow existing packages to be overwritten. Defaults to false.
  • PYPI_AUTHENTICATE: list of (case-insensitive) actions to authenticate. Default to update.
  • PYPI_EXTRA: any additional parameters to pypi-server.

Building Your Own

You can build a new, up-to-date version of the container by cloning the Git repository and using the following command:

make build

This will create a new container that just has the latest version of pypiserver installed and ready to serve packages out of /srv/pypi. To use this container, run:

make run

This will spin up the pypi-server command within container, and it will be exposed on port 8080 on your host system. To test that the container is working, visit http://localhost:8080 in your browser.

Adding Internal Packages

Internal packages may be uploaded to this PyPI server quite easily. The first step is to create a user account:

htpasswd -s /srv/pypi/.htpasswd yourusername

You will probably need to re-run make run each time you update the htaccess file, as it will copy the password file to the correct location before launching the server.

Alternatively, you might be able to just copy the htpasswd file to /srv/pypi/.htpasswd after each change without restarting your PyPI container.

This command (included with Apache on most distributions) will prompt you for a password for yourusername. You should use a more appropriate username, and enter a password that you want to use to "secure" your PyPI uploads. Then edit your ~/.pypirc (create it if necessary), replacing both yourusername and yourpassword with the values used with the htpasswd command:

[distutils]
index-servers =
    pypi
    internal

[pypi]
username:pypiusername
password:pypipassword

[internal]
repository: http://localhost:8080
username:yourusername
password:yourpassword

Next, you should be able to go into any Python project with a valid setup.py file and run:

python setup.py sdist upload -r internal

Assuming the container is online and your credentials are correct, this should add a package with the project contents to the internal PyPI server.

Adding Third Party Packages

Third party packages can be mirrored on the PyPI server by using a command such as:

pip install -d /srv/pypi pkgname

If you have a requirements file for a project's dependencies, you can easily mirror all dependencies by running:

pip install -d /srv/pypi -r requirements.txt

Be careful to use the correct version of pip--sometimes you might want to run pip2 and other times pip3.

Updating Mirrored Packages

You can update the packages mirrored on the internal PyPI server by running:

pypi-server -U /srv/pypi

Each package in the repo will be checked for updates, and instructions for updating the repo with the latest packages will be displayed.

More Repositories

1

django-articles

ATTENTION: I have disowned this project. See http://www.codekoala.com/blog/2013/django-projects/ | The blog engine that powers codekoala.com. See http://bitbucket.org/codekoala/django-articles/issues for the ticket tracker
Python
90
star
2

network-shaper

Very simple UI for basic network traffic shaping using tc-netem
HTML
28
star
3

pysphere

A Git mirror of the official SVN repository on Google Code -- I'm not the maintainer or owner of this project, I just wanted it in Git. I have a cronjob that updates this mirror regularly.
Python
9
star
4

docker-sencha-cmd

Docker build for Sencha Cmd
Shell
7
star
5

django-pendulum

ATTENTION: I have disowned this project. See http://www.codekoala.com/blog/2013/django-projects/ | A time logging application for Django-powered sites.
Python
7
star
6

django-reploc

ATTENTION: I have disowned this project. See http://www.codekoala.com/blog/2013/django-projects/ | A simple way for people to find representative locations on your Django-powered Web site.
Python
7
star
7

docker-pia-rutorrent

Private Internet Access container with ruTorrent
ApacheConf
5
star
8

pass-qr

A pass extension that lets you quickly generate a QR code for passwords using fzf or rofi
Shell
5
star
9

docker-sikuli

Docker build for Sikuli
Shell
5
star
10

ponymine

Redmine for Django-based sites
Python
5
star
11

django-clevercss

ATTENTION: I have disowned this project. See http://www.codekoala.com/blog/2013/django-projects/ | Use CleverCSS in Django to make your CSS easier to manage!
Python
5
star
12

node-iostat

Uses Node.js and flot to produce a "real-time" graph of data from iostat.
JavaScript
4
star
13

django-smileys

ATTENTION: I have disowned this project. See http://www.codekoala.com/blog/2013/django-projects/ | Easily replace things like :) and B-) with smilies on your Django-powered site.
Python
4
star
14

go-treksum

Utility for scraping and retrieving Star Trek quotes.
Go
4
star
15

django-seasonal-stylesheets

ATTENTION: I have disowned this project. See http://www.codekoala.com/blog/2013/django-projects/ | Have your stylesheets change colors gradually depending on the time of year.
Python
3
star
16

docker-plex

Docker container with Arch Linux and Plex Media Server
Shell
3
star
17

pkgbuilds

Collection of PKGBUILDs for Arch Linux.
Shell
3
star
18

provinia

A Django-powered genealogy app. I hope I can find time to keep working on it!
Python
3
star
19

torotator

HTTP proxy that balances across several Tor sessions.
Go
3
star
20

docker-mmonit

Dockerfile for M/Monit
2
star
21

treedo

An cross-platform, XML-based todo list application written with Python and wxPython.
Python
2
star
22

docker-go

Docker build for Go bootstrapped for more than just Linux
Shell
2
star
23

hgext

My personal repository for Mercurial extensions
Python
2
star
24

meaningfultitles

My first greasemonkey script to add useful titles to some web pages....
JavaScript
2
star
25

clip2zeus

Clipboard monitor that attempts to automatically shorten URLs found in your clipboard using 2ze.us
Python
2
star
26

django-vcboard

VCBoard is intended to be a full-fledged forum system similar to vbulletin and ip.board.
Python
2
star
27

udacity-blockchain-star-notary-token

JavaScript
1
star
28

docker-ssh

Dockerfile for an Arch Linux container with ssh
Shell
1
star
29

dockerfiles

A collection of Dockerfiles for various projects.
Shell
1
star
30

docker-sphinx

Docker build for Sphinx
Shell
1
star
31

docker-s6

Dockerfile for an Arch Linux container with s6
Shell
1
star
32

docker-skydns2

Docker build for SkyDNS2
Shell
1
star
33

docker-redis

Docker build for a redis server on Arch
Shell
1
star
34

go-aws-lanes

Utility for interacting with different "lanes" of servers on AWS.
Go
1
star
35

make

Makefiles for mmake
Makefile
1
star
36

hgblog

Mirror of hgblog from bitbucket.org
1
star
37

go-webhook

Helpers to deal with webhooks (currently only GitLab)
Go
1
star