Skip to content
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

Naming conflict with "pint" quantity package #33

Closed
cdeil opened this issue Apr 20, 2015 · 22 comments
Closed

Naming conflict with "pint" quantity package #33

cdeil opened this issue Apr 20, 2015 · 22 comments
Labels

Comments

@cdeil
Copy link
Contributor

cdeil commented Apr 20, 2015

There is a Python package named "pint" on PyPI that is quite popular and has existed for a few years:
https://pypi.python.org/pypi/Pint/
https://github.com/hgrecco/pint

It's about physical quantities, so probably there will be users that have that package installed and then if they want to install this one with the same name there's a conflict and confusion.

Is renaming this package (and reserving the new name on PyPI) an option?

@scottransom
Copy link
Member

Hmmm.... maybe. I don't really see our PINT as being used by many people -- it is quite specialized. And we really like the name! (it recursively comments on the previous bits of software that do this kind of thing). I'm glad that you brought the issue up, though. We might be able to make the package name something like "pulsar_pint" or somesuch...

@cdeil
Copy link
Contributor Author

cdeil commented Apr 21, 2015

Sure, I understand you want to keep "pint". I like it!

But putting your package on PyPI so that pip search and pip install works is very nice, even if the number of users for this package will not be very large.

So yes, maybe "pulsar_pint" could be a good option ...

@scottransom
Copy link
Member

Ha! My student just recommended "pint_time"! That is a good suggestion.... ;-)

@luojing1211
Copy link
Member

That sounds like a happy hour. I like it.

On Tue, Apr 21, 2015 at 10:53 AM, Scott Ransom [email protected]
wrote:

Ha! My student just recommended "pint_time"! That is a good suggestion....
;-)


Reply to this email directly or view it on GitHub
#33 (comment).

@paulray
Copy link
Member

paulray commented Apr 21, 2015

On Apr 21, 2015, at 11:53 AM, Scott Ransom [email protected] wrote:

Ha! My student just recommended "pint_time"! That is a good suggestion.... ;-)

Indeed. We might have to move our telecon times to happy hour. :-)

— Paul

@paulray
Copy link
Member

paulray commented Feb 22, 2016

When PINT gets to 1.0, we should make it pip installable. Keeping this issue open until then...

@paulray
Copy link
Member

paulray commented Dec 30, 2016

We should reconsider this, especially now that PINT is a lot easier to install. I believe a new user can get it going by git clone, then pip install . --user. So, it should be easy to make it pip installable from PyPI. Maybe now is the time to reserve a package name for it? Is it OK to have the package name be pint_time while the installed module still be called pint? That would not allow the two pints to be installed at the same time, but anyone using our pint should be using astropy.units anyway.

@cdeil
Copy link
Contributor Author

cdeil commented Dec 30, 2016

Is it OK to have the package name be pint_time while the installed module still be called pint? That would not allow the two pints to be installed at the same time, but anyone using our pint should be using astropy.units anyway.

It's possible to give your package any name that's not taken yet on PyPI, simply by putting that name as the name option in setup.py:
https://packaging.python.org/distributing/#name

And yes, you can pretty much install whatever files / directories you like from setup.py (which is what pip calls), they can have different names.

scikit-learn and scikit-image are examples. You pip install scikit-learn, but then it installs a package called sklearn, i.e. users have to import sklearn. I think they used to install as scikit.learn and scikit.image, and a few years ago renamed that because they realised that independent packages are better than a "shared package namespace" called "scikit" for packages built on numpy / scipy.

But just because it's possible doesn't mean that it's a good idea. My experience with packages that have different names in different places is that I can never remember which is which, i.e. it's a bad user experience. With pint there's the additional problem that you'll get some users that for some reason have or even want the other pint package already installed.

+1 to have the same name everywhere.

@paulray
Copy link
Member

paulray commented Dec 30, 2016

If we change the name, are there rules about "-" and "_"? For some reason astropy_helpers is installed as astropy-helpers with pip. This is confusing.

Also, if we change the name, we should do it soon. This would be a good topic for a telecon @luojing1211

If we don't change the name, then either we pip install using a different name than pint, or we just never list it on PyPI and users will have to download it some other way (though they will still be able to install it with pip if they wish).

@cdeil
Copy link
Contributor Author

cdeil commented Dec 30, 2016

If we change the name, are there rules about "-" and "_"?

You can't have - (minus) in Python module or package names, because of the clash with the minus operator, resulting in a SyntaxError:

>>> import astropy-helpers

So you have to choose astropy_helpers or astropyhelpers or something that's a valid Python identifier.

The reason the "distribution" name (the one in the name argument in setup.py and on PyPI) is astropy-helpers is (I guess) because the person creating it preferred minus over underscore. I do too (no need to press shift), but IMO consistency is more important, so I wouldn't have chosen that name.

For some reason astropy_helpers is installed as astropy-helpers with pip. This is confusing.

Agreed.

@aarchiba
Copy link
Contributor

Please don't underestimate the value of being able to do pip install pint-pulsar and conda install pint-pulsar. Among other things this makes it much easier to have pint as a dependency of another package - so users don't need to manually install things, and scripts can automatically pull it in.

It's also not necessary that PyPI package names equal module/package names in python.

@cdeil
Copy link
Contributor Author

cdeil commented Aug 28, 2019

Agree 100% with @aarchiba .

E.g. for Gammapy we have several dependencies, and the way we tell them to install the software is like this:

In the future, we would like to support gamma-ray pulsar analysis and have some functionality in Gammapy that builds on PINT, a very early example prototyping in this direction is here.

So what we need is stable pip and/or conda packages for PINT that we can simply refer to and have install work as one of many dependencies.

@paulray
Copy link
Member

paulray commented Mar 6, 2020

With the paper coming out, how about we get PINT onto PyPI now (and conda as well perhaps)?

@luojing1211
Copy link
Member

luojing1211 commented Mar 6, 2020 via email

@paulray
Copy link
Member

paulray commented Mar 6, 2020

I guess I like "pulsar-pint" or "pint-pulsar" since most package names seem to use dash instead of underscore in the PyPI name. I looked at the docs and I think we can make it install with "pip install pulsar-pint" and still have it imported with "import pint". I wonder if there is some way in PyPI to specify that it conflicts with the other PINT package so that they can't both be installed?

@paulray
Copy link
Member

paulray commented Mar 6, 2020

Note that pip search pint currently returns this:

% pip search pint
django-pint (0.4)     - Quantity Field for Django using pint library for automated unit conversions
Pint (0.11)           - Physical quantities module
pint-mtools (0.12.2)  - Physical quantities module (modified for unitdoc)
pypint (1.5.2)        - Python interface to Pint
pynte (0.0.2)         - Pint-sized networking package for python.

@paulray
Copy link
Member

paulray commented Mar 6, 2020

@luojing1211 are you going to upload to PyPI, or should I give it a shot?
I think we should definitely tag a new version number before doing so.
But, other than that, the setup.cfg seems to have all the metadata required, so I think it should be simple.

@luojing1211
Copy link
Member

luojing1211 commented Mar 6, 2020 via email

@paulray
Copy link
Member

paulray commented Mar 6, 2020

I don't know if you can reserve a name. I suppose hanging on for 0.7 with the components stuff fixed up would be fine. I guess once we post on PyPI, we'll want to be a bit more careful with versioning, so maybe we shouldn't rush it too much.

@scottransom
Copy link
Member

I think I prefer pulsar-pint or pint-pulsar. The latter might make more sense for pulsar people looking for pint as it will show up right next to the already existing pint (which is what they would expect it was named!)

@cdeil
Copy link
Contributor Author

cdeil commented Mar 8, 2020

I guess I like "pulsar-pint" or "pint-pulsar" since most package names seem to use dash instead of underscore in the PyPI name. I looked at the docs and I think we can make it install with "pip install pulsar-pint" and still have it imported with "import pint".

Yes, you can do that.

As package install and import name, you can choose any valid Python identifier (like pint or pint_pulsar, but not pint-pulsar) and as PyPI name you can also use minus (commonly done), and then name can be completely different (very rarely done). See https://stackoverflow.com/a/53346523/498873. Actually you can pretty much in setup.py execute any code you like (erase the users hard drive).

I'm not saying you should do that - just that technically at the moment there's nothing enforced by PyPI and pip concerning matching names.

I wonder if there is some way in PyPI to specify that it conflicts with the other PINT package so that they can't both be installed?

I looked a bit, and didn't find a way. There's pypa/packaging-problems#154 (comment) from 2018 which discusses such a feature for pip, indicating it doesn't exist yet.

pip will execute your setup.py, so in there you can put code that checks if the other package is installed already, and aborts installation of your package in that case (e.g. with a message to first suggesting to uninstall the other).

Overall you have a tough choice here whether to install as pint or pulsar_pint, one is better short-term for your users and project (what you have already, what you like), the other is nicer for the global Python package namespace and community (no conflict with the other package).


But can we reserve the name on PyPI?

Years ago here used to be a way to "register" a name, i.e. reserve it and only upload later. It's not available any more though, the usual way is to just release to PyPI and that will give you the name:
https://packaging.python.org/guides/migrating-to-pypi-org/#registering-package-names-metadata
If you really must reserve a name, you can kind of do it by uploading an "empty" package:
https://stackoverflow.com/a/47723309/498873

@paulray
Copy link
Member

paulray commented May 13, 2020

We are now on PyPI and conda-forge as pint-pulsar. You can't install both pint-pulsar and pint since they conflict. This should be prevented by conda, but I don't know how to do it for PyPI. Anyway, closing...

@paulray paulray closed this as completed May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants