New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to change default mirror url pypi.python.org/simple/ with devpi-server #433

Closed
robertding opened this Issue Jun 7, 2017 · 13 comments

Comments

Projects
None yet
3 participants
@robertding

robertding commented Jun 7, 2017

i start devpi-server version 4.3.0 as cache server
with cmd devpi-server --serverdir /root/packages/ --port 5555 --host=0.0.0.0 --start
how can i change the default cache mirror?

@fschulze

This comment has been minimized.

Contributor

fschulze commented Jun 7, 2017

What do you mean by "default cache mirror"? Do you mean the URL pip uses, or the URL for the PyPI cache?

@robertding

This comment has been minimized.

robertding commented Jun 7, 2017

sorry i didn't make it clear. i want to change the default url pypi.python.org/simple/ to another mirror url like mirrors.aliyun.com when a package not accessable in my devpi server.

@robertding

This comment has been minimized.

robertding commented Jun 7, 2017

@fschulze sorry i dont exactly know the differnet between pip uses(client side usage?) and PyPi cache.
I tried to modify the pip.conf in my devpi server, but it didn't work. The devpi server still tring to get missing package from pypi.python.org which is far slow in my country.
I tried to modify the source code config.py under devpi_server, still not working. Thanks for your help.

@fschulze

This comment has been minimized.

Contributor

fschulze commented Jun 7, 2017

You can change mirror_url on the root/pypi index. Something like this should work (from my head, untested): devpi index root/pypi mirror_url="...". It must point to the simple index of the mirror.

@fschulze

This comment has been minimized.

Contributor

fschulze commented Sep 4, 2017

Did my answer solve your issue?

@blackholll

This comment has been minimized.

blackholll commented Oct 13, 2017

i have the same requirement
is this contol download package from ?
in you reply, how to "change mirror_url on the root/pypi index"?

server/devpi_server/extpypi.py line 118?

@fschulze

class PyPIStage(BaseStage): def __init__(self, xom, username, index, ixconfig): super(PyPIStage, self).__init__(xom, username, index, ixconfig) self.httpget = self.xom.httpget # XXX is requests/httpget multi-thread safe? self.cache_expiry = self.ixconfig.get( 'mirror_cache_expiry', xom.config.args.mirror_cache_expiry) self.xom = xom if xom.is_replica(): url = xom.config.master_url self.mirror_url = url.joinpath("%s/+simple/" % self.name).url else: url = URL(self.ixconfig['mirror_url']) self.mirror_url = url.asdir().url

@blackholll

This comment has been minimized.

blackholll commented Oct 13, 2017

and i have try to change mirror_url in main.py/_pypi_ixconfig_default/, it doesn't work

@fschulze

This comment has been minimized.

Contributor

fschulze commented Oct 13, 2017

You don't have to change code, use the devpi client to set the option on the index. For example to change the url for root/pypi:

devpi index root/pypi mirror_url="..."
@blackholll

This comment has been minimized.

blackholll commented Oct 14, 2017

@fschulze i think you have not understand my mean. normally, when someone install a package that haven‘t cached in devpi server, the devpi server when download the package from pipy.python.org. but we are in china, the speed is slow. so i expect the devpi server download package from pypi.doubanio.com/simple but not pypi.python.org. this should be work on devpi server but not client.

@fschulze

This comment has been minimized.

Contributor

fschulze commented Oct 15, 2017

That's exactly what I'm saying. If you run devpi index root/pypi you should get something like this:

% devpi index root/pypi
https://d.rzon.de:8141/root/pypi:
  type=mirror
  volatile=False
  mirror_url=https://pypi.python.org/simple/
  mirror_web_url_fmt=https://pypi.python.org/pypi/{name}
  title=PyPI

Now you run devpi index root/pypi mirror_url="https://pypi.doubanio.com/simple/" and you should get something like:

% devpi index root/pypi mirror_url="https://pypi.doubanio.com/simple/"
/root/pypi changing mirror_url: https://pypi.doubanio.com/simple/
https://d.rzon.de:8141/root/pypi:
  type=mirror
  volatile=False
  mirror_url=https://pypi.doubanio.com/simple/
  mirror_web_url_fmt=https://pypi.python.org/pypi/{name}
  title=PyPI

Now packages will be downloaded from the mirror instead of regular pypi.

@blackholll

This comment has been minimized.

blackholll commented Oct 15, 2017

@fschulze
I run devpi server by supervisor, and the command is :" /data/virtualenv/devpi/bin/devpi-server --port 404%(process_num)d --serverdir /data/project/devpiserver --outside-url=http://pypi.xxxxx.com".
how to run devpi index root/pypi mirror_url="https://pypi.doubanio.com/simple/"? there has no args like 'mirror_url'.

@fschulze

This comment has been minimized.

Contributor

fschulze commented Oct 16, 2017

You need devpi-client for that, it's not a command line option of the server, but a setting in the database of the server, which you can manipulate with devpi-client. See documentation, starting with https://devpi.net/docs/devpi/devpi/stable/+d/quickstart-releaseprocess.html

@blackholll

This comment has been minimized.

blackholll commented Oct 17, 2017

ths very much, it works

@robertding robertding closed this Mar 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment