0% found this document useful (0 votes)
46 views2 pages

Setting Up A Custom Pypi Server

This document discusses setting up a custom PyPI server to host proprietary Python packages privately. It describes running a PyPI server using the pypiserver package, configuring it to run via Supervisor to start and stop the process. Supervisor allows starting the PyPI server daemonized in the background and controlling it through simple commands to start, stop, and restart the server as needed. This allows hosting private Python packages for internal use within an organization on a custom PyPI server rather than releasing packages publicly.

Uploaded by

AkikoYuuki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views2 pages

Setting Up A Custom Pypi Server

This document discusses setting up a custom PyPI server to host proprietary Python packages privately. It describes running a PyPI server using the pypiserver package, configuring it to run via Supervisor to start and stop the process. Supervisor allows starting the PyPI server daemonized in the background and controlling it through simple commands to start, stop, and restart the server as needed. This allows hosting private Python packages for internal use within an organization on a custom PyPI server rather than releasing packages publicly.

Uploaded by

AkikoYuuki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

http://www.javawithravi.

com/setting-up-a-custom-pypi-server/

Problem statement: You have created a proprietary Python module that

you would like to release only to folks within your group/company. If you

release it to Python PyPi server it will be available to everyone.

Solution: Stand up your own PyPi server. Note: I am

using virtualenvwrapper commands below.

1. Setup your virtualenv: mkvirtualenv pypi

2. Pip install the package: pip install pypiserver

3. Create the packages dir: mkdir -p ~/pypi/packages

4. Verify that the server starts up: pypi-server -p 7001 ~/pypi/packages (or if you

want to start the server in the background: nohup pypi-server -p 7001

~/pypi/packages &

That's it. That's the base.


Start and stop PyPi server via supervisord:

The way I have my PyPi server running is via supervisord. Supervisord is an

awesome service that provides you a simple way to daemonize your process

and also provides straightforward commands to start and stop your process

(see below).

[program:pypi-server]

command=python /home/spiderman/.virtualenvs/pypi/bin/pypi-server -p

8080 packages

directory=/root
autostart=true

startretries=3

redirect_stderr=true

stdout_logfile=/var/log/supervisor/pypiserver.log

Start the supervisord in daemon mode: supervisord -c supervisord.conf. And start and

stop your pypi-server process via supervisorctl like so:

Start PyPi server: supervisorctl start pypi-server

Stop PyPi server: supervisorctl stop pypi-server

In my next post, I show how to reference your pypi server to install your

python modules.

You might also like