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
Related
I'm trying to use the code from this repository. The problem is that it isn't a package (I think?) because it can't be found on PyPI and there's no setup.py file (so I can't use pip install git+<repo link>). How would I then be able to use this code in my project?
I've already read this question, which also involved not having a setup.py file, but the answer seems unsatisfactory to me. I'm under the impression that it wouldn't allow my project to be run on someone else's pc without them also manually installing the code from the aforementioned repo.
I've also thought about just downloading the code and adding a setup.py myself, but I think that would produce the same problem.
I'm clearly a little unclear on this subject and I can't find any explanation/solution anywhere else.
That repository doesn't seem to be properly packaged for library use at all.
I'd recommend forking it, making the changes you need to make it usable (moving the files into a package, adding a setup.py) and then using that as a git+https:// style requirement.
I would like to create a very modular package, where users can install pieces if need be. I was wondering if there is a way to create multiple small packages and a master package. A user would first install the master package then install the components as needed.
I've tried researching this way, but I think I have the terminology wrong, I am hoping that someone can point me to some documentation or example project doing this.
If one creates a useful Python package, how/where does one publish/advertise it for other people to use?
I've put it on hithub, but even Google does not find it after a few weeks.
The package is neat & complete, I made it for my personal use and would be a shame not to share it with others :)
Here is the PyPI guide. https://python-packaging-user-guide.readthedocs.org/en/latest/distributing.html
PyPI is the place for putting your Python packages up for others to find. The built-in tool pip references it to install packages for you, and at least one IDE uses pip in the background to give you a GUI for doing this. (PyCharm)
So, to make the package available to a pip install, you have to register it in the Python Package Index (PyPI): https://pypi.python.org/pypi
There's also the test environment, where you can upload your packages to test if your setup is ok before going to the real deal: https://testpypi.python.org/pypi
You create an account in one of the servers and will be able to upload your package. But, before that, you will have to build your package using setuptools. Here's the documentation for packaging and distributing: https://packaging.python.org/distributing/
The proccess can be little boring, so I wrote a little tool to make it simpler. Maybe it's of some use to you: https://github.com/hugollm/foster
I have a virtualenv that serves a few separate projects. I'd like to write a utility library that each of these projects can use. It seems to make sense to stick that in the virtualenv. By all means shoot me down now but please give an alternative if you do.
Assuming I'm not completely crazy though, Where's the best place to stick my library?
My virtualenv sticks everything I install with pip in lib/pyton2.7/site-packages. I wonder if it would make more sense to follow suit or to hack in a separate home (further up the directory tree) so if things do ever clash, my work isn't overwritten by pip (et al).
If your project follows the standard packaging practices with setuptools, then all you have to do is run python setup.py develop inside the virtualenvs that you want the library to be used for. A .egg-link file will be created pointing to your package from which your other libraries will use much like any other packages, with the added benefit that your latest changes will be available to all packages at the same time (if that's your intention). If not, then either you could call python setup.py install or use multiple versions at different locations on the file system.
To get yourself started, take a look at Getting Started With setuptools and setup.py (you can skip the part on registering your package on pypi if this is your private work).
Another relevant stackoverflow thread: setup.py examples? The Hitchhiker's Guide to Packaging can also be quite useful.
I just completed my first (minor) Python project, and my boss wants me to package it nicely so that it can be distributed and called from other programs easily. He suggested I look into eggs. I've been googling and reading, but I'm just getting confused. Most of the sites I'm looking at explain how to use Python eggs that were already created, or how to create an egg from a setup.py file (which I don't yet have). All I have now is an Eclipse pydev project with about 4 modules and a settings/configuration file. In easy steps, how do I go about structuring it into folders/packages and compiling it into an egg? And once it's an egg, what do I have to know about deploying/building/using it? I'm really starting from scratch here, so don't assume I know anything; simple step-by-step instructions would be really helpful...
These are some of the sites that I've been looking at so far:
http://peak.telecommunity.com/DevCenter/PythonEggs
http://www.packtpub.com/article/writing-a-package-in-python
http://www.ibm.com/developerworks/library/l-cppeak3.html#N10232
I've also browsed a few SO questions but haven't really found what I need.
Thanks!
All you need is read this: The Hitchhiker's Guide to Packaging
or install PasteScript using pip or easy_install, then
paster create your_package_name
and you'll get a template for your python package
You should hold to the standard packaging of distutils. Quoting James Bennett:
Please, for the love of Guido, stop using setuptools and easy_install, and use distutils and pip instead.
Starting from there, a quite standard distribution looks like:
module/
README
setup.py # follow http://docs.python.org/distutils/setupscript.html
tests/
You should be able to find what you need in one of the following, depending on what version of Python you're using:
http://docs.python.org/distutils/
http://docs.python.org/py3k/distutils/index.html