Skip to content
pypi mirror status
Python Shell
Latest commit 8840b5d Aug 28, 2014 @kencochrane Merge pull request #13 from s1113950/master
Update config.py
Failed to load latest commit information.
static added notifications (twitter, email) for when the mirrors are out of … Apr 23, 2012
templates use https links for (pypi|www).python.org Mar 17, 2014
.gitignore added notifications (twitter, email) for when the mirrors are out of … Apr 23, 2012
README.rst
app.py
config.py Update config.py Aug 26, 2014
crontab added a cronjob to kill all long running cronjobs that last more then… Aug 28, 2013
daily.py fixes for issue #8 and PEP 449 Feb 24, 2014
dotcloud.yml added redis and bumped up the version of pypimirrors and added jinja2… Apr 15, 2012
iploc.py fixed url again for ip 2 location api Apr 16, 2012
mirrorlib.py
nginx.conf fixed nginx.conf to point to correct static path Apr 7, 2012
notification.py added email_port as a config option Apr 30, 2012
postinstall added an exit 0 to the else of the postinstall Apr 23, 2012
pypi_mirrors.py fixes for issue #8 and PEP 449 Feb 24, 2014
requirements.txt fixes for issue #8 and PEP 449 Feb 24, 2014
test_run.py fixes for issue #8 and PEP 449 Feb 24, 2014
utils.py added fix for finding location on mirrors with paths Apr 26, 2014
wsgi.py moved some things around to be better organized and changed the web s… Apr 16, 2012

README.rst

pypi-mirrors

Very simple tool that pings the PyPI mirrors and tells us when they were updated last.

I threw this together very quickly as a proof of concept feel free to fork, and send pull requests.

Config

Redis

It requires redis in order to cache some of the data. For local development it is assuming it to be running at localhost:6379 db:1 and no password. see config.py for more info.

GeoIP

In order to get the IP address geolocation lookup, you need to sign up for an account from http://ipinfodb.com/register.php . If you don't have the env variable set, you will not have access to the geo location information. set IPLOC_API_KEY with the API key they give you.

Email & Twitter

To get the twitter and email notifications to work correctly you need to create an environment.json file in /tmp with the variables and values shown below. replace <value> with the real values.

/tmp/environment.json:

{
"IPLOC_API_KEY": "<value>",
"TWITTER_CONSUMER_KEY" : "<value>",
"TWITTER_CONSUMER_SECRET" : "<value>",
"TWITTER_ACCESS_KEY" : "<value>",
"TWITTER_ACCESS_SECRET" : "<value>",
"EMAIL_HOST" : "<value>",
"EMAIL_PORT" : "<value>",
"EMAIL_USER" : "<value>",
"EMAIL_PASSWORD" : "<value>",
"EMAIL_FROM" : "<value>",
"EMAIL_TO" : "<value>",
"EMAIL_BCC" : "<value>",
"EMAIL_TO_ADMIN": "<value>"
}

For installing the API Key on dotCloud you need to run the following command. replace <value> with the real values.

env variables:

dotcloud var set pypimirrors \
    'IPLOC_API_KEY=<value>' \
    'TWITTER_CONSUMER_KEY=<value>' \
    'TWITTER_CONSUMER_SECRET=<value>' \
    'TWITTER_ACCESS_KEY=<value>' \
    'TWITTER_ACCESS_SECRET=<value>' \
    'EMAIL_HOST=<value>' \
    'EMAIL_PORT=<value>' \
    'EMAIL_USER=<value>' \
    'EMAIL_PASSWORD=<value>' \
    'EMAIL_FROM=<value>' \
    'EMAIL_TO=<value>' \
    'EMAIL_BCC=<value>' \
    'EMAIL_TO_ADMIN=<value>'

How it works

The pypi_mirrors.py script runs via a cron job and puts data into redis. There is one webpage that pull the data from redis and displays it. There is a daily cron job that runs and sends out notifications if the mirrors are out of date.

Demo

http://www.pypi-mirrors.org

How to help

Pick one of the things on the TODO list and implement it and send a pull request.

Running locally

Make sure redis is running

  1. Collecting Data:

    $ python pypi_mirrors.py
    
  2. Running web server:

    $ python app.py
    # connect to http://localhost:5000 in browser
    

TODO:

  • Create a setup.py and add to PyPI
  • Add better documentation
Something went wrong with that request. Please try again.