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

Detect and warn on installation time, if an old pycrypto package is installed #477

Open
frispete opened this issue Nov 19, 2020 · 4 comments

Comments

@frispete
Copy link
Contributor

Hi,

since a regular pattern of issues with pycryptodome seems to be an existing pycrypto package installation in this setup, would it be possible to warn the user about this fact, or even fail the installation?

I'm more active on the packaging front, where we typically solve this with a conflict/replacement.

Not sure how this is done best for pip and friends.

@Varbin
Copy link
Contributor

Varbin commented Nov 20, 2020

While the package metadata specification documents fields for that purpose, they are currently ignored by pip, if I'm not mistaken (see pypa/pip#4625). Nonetheless I think those fields should be set by Pycryptodome (in variant using the Crypto namespace).

For installations from sources, a check in the setup.py can to it - but as installations from wheels get more common, those would get ignored there.

If install-time checks are not possible, what about checking that during import-time, so it can be at least diagnosted easily?

@frispete
Copy link
Contributor Author

While the package metadata specification documents fields for that purpose, they are currently ignored by pip, if I'm not mistaken (see pypa/pip#4625). Nonetheless I think those fields should be set by Pycryptodome (in variant using the Crypto namespace).

Yes, that would be a start. My humble guess, those fields will get more attention over time, and this project is a nice example for their usefulness (if handled correctly).

For installations from sources, a check in the setup time can to it - but as installations from wheels get more common, those would get ignored there.

Yes, sure.

If install-time checks are not possible, what about checking that during import-time, so it can be at least diagnosed easily?

I'm pretty sure, that Helder won't like that idea much and I don't either, because it penalizes the common usage for a historical artefact. If at all, the lifetime of such a check should be limited, and we could use the deprecation fw for it? Helder?

@texadactyl
Copy link

texadactyl commented Nov 20, 2020

This is possible in setup.py:

try: 
     import pycrypto
     ### Issue warning or error message.
     ### Could have a dialog whether or not to continue.
except:
     pass

I see no harm in a notification during installation. The person who did this intentionally will not care. The person who was unaware the pycrypto was inadvertently installed can remove it.

@frispete
Copy link
Contributor Author

While the package metadata specification documents fields for that purpose, they are currently ignored by pip, if I'm not mistaken (see pypa/pip#4625). Nonetheless I think those fields should be set by Pycryptodome (in variant using the Crypto namespace).

Yes, that would be a start.

For installations from sources, a check in the setup time can to it - but as installations from wheels get more common, those would get ignored there.

Yes, sure.

If install-time checks are not possible, what about checking that during import-time, so it can be at least diagnosed easily?

I'm pretty sure, that Helder won't like this idea very much and neither do I (FWIW) because it penalizes general use for a historical artifact.

The good news is: there has been some progress in this regard recently: pip 20.3.

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

No branches or pull requests

4 participants