简体   繁体   中英

What's the recommended way of renaming a project in pypi?

I want people that know of the old name to be directed to the new name.

For the pypi website, it's easy to upload a package with a README linking to the new package.

I'm not sure what's the best way to handle people using pip to install it. I assume it might be possible to show an error on pip install old_name , looking around it seems to be possible using cmdclass in setup.py and maybe throwing an exception in the right place but the documentation around it is scarce to put it mildly.

So I was wondering if anyone is aware of proper built-in systems for this, or common practices to handle this sort of thing.

Declare the new package a dependency of the old. See for example how scikit-learn does it: the old package sklearn declares in its setup.py :

install_requires=['scikit-learn'],

Thus everyone who does pip install sklearn automatically gets scikit-learn .

pypi-rename worked perfectly for me. It automates the process of making a README and redirecting users to the new package.

https://github.com/simonw/pypi-rename

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM