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

Do not include "typing" lib in install_requires if Python 3.5+ #1168

Closed
tdruez opened this issue Feb 22, 2018 · 11 comments
Closed

Do not include "typing" lib in install_requires if Python 3.5+ #1168

tdruez opened this issue Feb 22, 2018 · 11 comments

Comments

@tdruez
Copy link
Contributor

tdruez commented Feb 22, 2018

From https://pypi.python.org/pypi/typing:

NOTE: in Python 3.5 and later, the typing module lives in the stdlib, and installing this package has NO EFFECT.

We should not force the install of typing for Python version 3.5 or later.

I'm suggesting the following change:

install_requires = ['six>=1.2']
if sys.version_info < (3, 5):
    install_requires.append('typing')

setup(
    [....]
    install_requires=install_requires,
    [....]
)

@trbs let me know what you think.

@trbs
Copy link
Member

trbs commented Feb 22, 2018

Looks good. Could you make a PR for this ?
Thanks !

@tdruez
Copy link
Contributor Author

tdruez commented Feb 26, 2018

@trbs sure thing, PR @ #1170

trbs added a commit that referenced this issue Feb 26, 2018
Do not include "typing" lib in `install_requires` if Python 3.5+ #1168
trbs added a commit that referenced this issue Mar 7, 2018
* 'master' of github.com:django-extensions/django-extensions:
  Issue #1173: Fix ImportError on generate_password command with django 1.8.
  Issue #1173: Add document for new `generate_password` command.
  Issue #1173: Replace `get_random_string()` with `BaseUserManager.make_random_password()` for future maintenance.
  Issue #1173: Add new `generate_password` command.
  Do not include "typing" lib in `install_requires` if Python 3.5+ #1168
@luzfcb
Copy link
Contributor

luzfcb commented Mar 7, 2018

@trbs the fix #1170 only work if i install django-extensions with pip --no-binary, I other words, when I force pip do not use the whell package

pip install django-extensions -U --no-binary :all:

my environment

Python 2.7.11 (default, Mar  8 2016, 09:32:11) 
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip, setuptools, wheel, sys
>>> sys.version_info
sys.version_info(major=2, minor=7, micro=11, releaselevel='final', serial=0)
>>> pip.__version__
'9.0.1'
>>> setuptools.__version__
'38.2.4'
>>> wheel.__version__
'0.30.0'
>>>

I've looked for some way to fix this, but I'm still a bit confused as to the correct way to do this

The closest I found it was

https://hynek.me/articles/conditional-python-dependencies/

@luzfcb
Copy link
Contributor

luzfcb commented Mar 7, 2018

@hynek do you have any comments on what is the current correct way to specify conditional dependencies in a way to work with a wheel package?

@s-wirth
Copy link

s-wirth commented Mar 7, 2018

@tdruez Hey man, maybe I am misreading how the setup.py works, but it seems to me like you are currently installing typing only if the Python Version is smaller than 3.5.
https://github.com/django-extensions/django-extensions/pull/1170/files#diff-2eeaed663bd0d25b7e608891384b7298R124

@luzfcb
Copy link
Contributor

luzfcb commented Mar 7, 2018

@s-wirth the typing module was included in the standard library in Python 3.5, so it is not necessary to install it in python 3.5 or higher, because it is already installed

@s-wirth
Copy link

s-wirth commented Mar 8, 2018

@luzfcb Ah yeah that makes sense. Thank you for the answer :)

@hynek
Copy link

hynek commented Mar 8, 2018

@luzfcb the most correct way is currently PEP 508 but the most compatible way appears to be the using extras_require. It strictly depends on how old pip/setuptools you want to support.

@trbs
Copy link
Member

trbs commented Mar 8, 2018

related to #1176

@trbs
Copy link
Member

trbs commented Mar 10, 2018

Please test with Django Extensions 2.0.5 and hopefully that fixes the issues.

@trbs
Copy link
Member

trbs commented Mar 11, 2018

If there other (edge) cases where it still fails please reopen the issue.

@trbs trbs closed this as completed Mar 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants