Getting Started

Please make sure you are using VirtualEnv. This will isolate yopypi from other packages:

pip install virtualenv

Configurations

yopypi can use a configuration file in a ini style. But this is not required!

yopypi uses these settings by default:

'web_host': 'localhost',
'web_port': '8080',
'mirrors' : ['d.pypi.python.org', 'c.pypi.python.org']

The above values are in the form of a dictionary, but getting them correctly in a ini file would be something like this:

# Sample Configuration File for yopypi

[DEFAULT]
yopypi.web.host = localhost
yopypi.web.port = 8080
yopypi.mirrors = d.pypi.python.org c.pypi.python.org

Running the server

To be able to catch your requests to pypi we need to run a webserver. yopypi provides a command line tool for this: yopypi-cli. This tool will allow you to start, stop and even pass a configuration file if you need to.

Start:

yopypi-cli start

Stop:

yopypi-cli stop

Start with configuration file:

yopypi-cli start app.conf

Test it!

If you started the server with the defaults (e.g. localhost:8080) try and go to that same address

If PYPI is up, you should be automatically be redirected.

That is how yopypi works! We test if PYPI is up and redirect you there, if not, we try one of the mirrors the configuration supplied.

PYPI tools and Configurations

There are a few tools that interact with PYPI and they all take different configuration approaches.

For pip you would need something like this in the config:

[global]
index-url = http://127.0.0.1:8080/simple

For buildout:

[buildout]
index = http://127.0.0.1:8080/simple

It is necessary to add that portion of the URL. To check everything is working correctly, create a new VirtualEnv in a temporary directory and see what happens! With yopypi running you should have a similar output to this (tested with one of my packages):

(foo)[alfredo@mbp ~/foo]$ pip install supay
Downloading/unpacking supay
Downloading Supay-0.0.6.tar.gz
Running setup.py egg_info for package supay
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.10.tar.gz
Extracting in /var/folders/1Y/1YKT8JpbGuSvDHiafKs5gU+++TI/-Tmp-/tmprg36Q3
Now working in /var/folders/1Y/1YKT8JpbGuSvDHiafKs5gU+++TI/-Tmp-/tmprg36Q3/distribute-0.6.10
Building a Distribute egg in /Users/alfredo/foo/build/supay
/Users/alfredo/foo/build/supay/distribute-0.6.10-py2.6.egg
Installing collected packages: supay
Running setup.py install for supay
changing mode of build/scripts-2.6/supay.py from 644 to 755
changing mode of /Users/alfredo/foo/bin/supay.py to 755
Successfully installed supay
Cleaning up...

If you are able to catch it... PYPI was up and running when the above happened so even though you are pointing yopypi to 127.0.0.1:8080/simple it is redirecting the request to PYPI.

::...
免责声明:
当前网页内容, 由 大妈 ZoomQuiet 使用工具: ScrapBook :: Firefox Extension 人工从互联网中收集并分享;
内容版权归原作者所有;
本人对内容的有效性/合法性不承担任何强制性责任.
若有不妥, 欢迎评注提醒:

或是邮件反馈可也:
askdama[AT]googlegroups.com


订阅 substack 体验古早写作:


点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

关注公众号, 持续获得相关各种嗯哼:
zoomquiet


自怼圈/年度番新

DU22.4
关于 ~ DebugUself with DAMA ;-)
粤ICP备18025058号-1
公安备案号: 44049002000656 ...::