Issue #51: fix django_compressor requirements entry #54

Closed
wants to merge 1 commit into from

4 participants

@DanHoerst

Hi all. First time contributing.

I made the change to the 3 requirements entries to resolve this issue:
-django_compressor==1.1.2
+django-compressor==1.1.2

@brosner
Pinax Project member

Can you explain why you did this? The real requirement name is with the underscore: https://github.com/jezdez/django_compressor/blob/develop/setup.py#L114

@lieryan

@brosner One motivation is to match "pip freeze" output so it can be diff-ed with the requirements file without raising false positives, see details on #51

@brosner
Pinax Project member

In theory, pip freeze is reporting it incorrectly. I've seen situations where using a hyphen has produced wrong results. We're going to keep the real name of the package until that is officially changed.

@brosner brosner closed this Mar 25, 2012
@carljm

From the point of view of setuptools/distribute or any tool depending on it (e.g. pip), underscores are an escape character, and are always transformed to dashes on output. This is not going to change; there is one explanation of it by PJ Eby, setuptools author, here (http://python.6.n6.nabble.com/quot-Safe-quot-Project-Names-and-underscores-in-Project-Names-issue-td2011757.html). Thus as far as pip/setuptools are concerned, the "real" name of django_compressor is django-compressor. pip install django-compressor works fine.

@carljm

The reference to "using a hyphen producing wrong results" may be referring to the #egg= component of an editable requirement; I vaguely recall having issues with that years ago when I made more use of editable requirements. I don't know of any possibility of the change in this pull request causing a problem.

@brosner
Pinax Project member

Yesterday, I actually worked the problem I've seen with hyphen versus underscore. PyPI and Crate handle redirection of hyphen to underscore on simple pages. However, mirrors and "dumb indexes" won't do the redirection causing pip to fail to find the package.

@carljm

Ah, makes sense. Perhaps pip could do this redirection internally, but that would be kind of messy. I guess the best solution in the short term is to avoid using underscores in project names on PyPI.

@brosner
Pinax Project member

I will admit to being vague on detail prior to my discovery yesterday. I think it would be fine to make the change, but something still throws me off a bit not using the actual name used in setup(name=) of django_compressor. I am pretty sure pip does eventually call something (possibly pkg_resources.Requirement.parse) which does the normalization anyways thus meaning it doesn't matter what we put in the requirements file.

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