-
Notifications
You must be signed in to change notification settings - Fork 117
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
make django a requirement, or somehow let users know that it has to be installed #96
Comments
@jo-tham There is already a checker to do that here: https://github.com/landscapeio/pylint-django/blob/master/pylint_django/checkers/django_installed.py So if you did not get the warning then that is probably broken! There have been many version of pylint since it was originally written so perhaps the API changed somewhere. I'll look into it :-) |
With the latest version I get a ModuleNotFoundError: No module named 'django' exception if Django is not found in the path. I'm not sure the existing checker will work b/c Django is imported in other modules before the checker is registered. I am in favor of closing this issue and removing the django_installed.py checker. @carlio @colinhowe what do you think ? |
The checker was at least originally loaded before other things - it was there to avoid needing to specify Django as a requirement to avoid polluting peoples' environments as who knows what version or how they installed it. That checker is there really just as a hint for when things go wrong. It can go away for sure, it's not really important except to help quickly diagnose why pylint-django isn't working, it's not a code quality issue. @atodorov It'd be nice to keep that warning (since some CI environments might not have a full dependency tree) but the checker itself can go. |
Also https://github.com/PyCQA/pylint-django/blob/master/pylint_django/compat.py#L23 would need to be changed a bit! |
@carlio I can always try |
Also Here: https://github.com/PyCQA/pylint-django/blob/master/pylint_django/augmentations/__init__.py#L26 (for additional reasons why this was in place) |
Ran into an issue caused by this recently. Any reason not to include |
@jakirkham to be honest it was because if you're testing the validity of your django code in an environment without django, you have bigger problems :-) I don't quite understand why anyone would need the ability to have a test library define what needs to be installed? I don't mind this requirement being dropped, just seems odd to me, especially given pylint's inference, that you wouldn't already have the dependencies involved in the test environment. Otherwise pylint will miss lots of stuff too, it can't follow the AST if nodes aren't there. |
Think there is some confusion. Not encouraging The reason for the request is we maintain a package for this in conda-forge and we try to mirror upstream's requirements. However as |
@jakirkham Sorry I meant "I don't mind this requirement to not depend on django being dropped" - bad phrasing on my part. I think as long as the dependency in That was also a motivation, the fact that by specifying a version you might conflict with the user's requirements and by not specifying a version you only get latest which might also conflict with the user's requirements. That's why there's a "No Django" checker, to get them to make sure they have the right version installed for them. |
No worries. Thanks for clarifying. Personally would bias towards adding the dependency and informing users to better constrain their environments if they raise such issues. Also would think that would be a pretty defensible position. Those that are already doing this correctly in development would be unaffected. |
Agreed - that's what the DjangoNotInstalledChecker was for really. It came about from getting lots of bogus bug reports due to improperly configured test environments, not sure what the best idea is since pylint-django deals with a range of versions but adding |
also add a big warning statement about possible side effects and to deter people from reporting issues about Django version mismatches. Updates README formatting a bit as well.
Interesting. Maybe promoting better tooling for managing testing environments, virtualenv and pipenv come to mind. For those with more complex requirements, conda. Could also look into GitHub issue and contributing templates to catch this stuff before the issue is filed. |
also add a big warning statement about possible side effects and to deter people from reporting issues about Django version mismatches. Updates README formatting a bit as well.
by ignoring the import failure Python will not produce a traceback but instead let DjangoInstalledChecker do its job and warn the user. I also add a CI build stage to test this scenario since we don't want to continue if this isn't working. Finally properly fixes #96.
by ignoring the import failure Python will not produce a traceback but instead let DjangoInstalledChecker do its job and warn the user. I also add a CI build stage to test this scenario since we don't want to continue if this isn't working. Finally properly fixes #96.
by ignoring the import failure Python will not produce a traceback but instead let DjangoInstalledChecker do its job and warn the user. I also add a CI build stage to test this scenario since we don't want to continue if this isn't working. NOTE: tox doesn't allow us to easily execute shell scripts and commands outside its virtualenv so I have to resort to ugly bash escaping to make this work! Finally properly fixes #96.
by ignoring the import failure Python will not produce a traceback but instead let DjangoInstalledChecker do its job and warn the user. I also add a CI build stage to test this scenario since we don't want to continue if this isn't working. NOTE: tox doesn't allow us to easily execute shell scripts and commands outside its virtualenv so I have to resort to ugly bash escaping to make this work! Finally properly fixes #96.
Hi,
thanks for an awesome plugin; it was a relief to find when I introduced pylint to an existing django project and was swarmed with errors from django
class Meta
and so forth.My team had an issue with getting the plugin to work in some instances.
Specifically; using a virtualenv/global installation of pylint and plylint django which did not include django. It may seems silly, but I think it's a valid usage pattern.
The django typical lint errors kept being reported, and we were pretty confused as to why. Of course, django had to be installed on path.
I didn't see anywhere in the readme that django had to be installed. It's a minor nuisance to solve, but it'd be nice to help the next person by either:
setup.py
I'm in favour of the last option. Glad to create a PR for the option that the maintainer(s) prefer, if any.
Thanks
The text was updated successfully, but these errors were encountered: