pigar icon indicating copy to clipboard operation
pigar copied to clipboard

Feature request: django support

Open cgthayer opened this issue 7 years ago • 4 comments

Django doesn't explicitly import, but does use a list of INSTALLED_APPS, which are analogous. Would be great to provide support for that, or at least for a list of additional modules to check. My current work-around is to create an django_imports.py and copy them in, so pigar can pick up the deps.

cgthayer avatar Oct 10 '17 21:10 cgthayer

Agreed: I'm using django-bootstrap3 which is exclusively imported via template tags and this plugin is not detected at all. Additionally I also use djangocms-admin-style which isn't even imported via tags because it overrides default behaviour simply by being listed in INSTALLED_APPS.

This feature would be nice.

velis74 avatar Nov 12 '17 22:11 velis74

Additional: it also does not detect psycopg2 which is listed in DATABASES. I guess a more complete (but not ultimate) list would be: INSTALLED_APPS MIDDLEWARE TEMPLATES (BACKEND, OPTIONS / context_processors) DATABASES (ENGINE) AUTH_PASSWORD_VALIDATORS REST_FRAMEWORK (DEFAULT_PERMISSION_CLASSES, DEFAULT_AUTHENTICATION_CLASSES, etc) AUTHENTICATION_BACKENDS EMAIL_BACKEND

I'd make a pull request if you can tell me where this code should be placed: settings.py is located by manage.py, from there it should simply be parsed for the configuration variables.

velis74 avatar Nov 13 '17 08:11 velis74

@velis74 Pull request welcome! You can start from here.

damnever avatar Nov 13 '17 09:11 damnever

pip install pigar==2.1.0 has introduced an experimental feature:

INSTALLED_APPS = [
 'name-it-a', 'name-it-b', # pigar: required-packages=package-name-a,package-name-b
 'name-it-c', # pigar: required-imports=import-name
]

I hope this helps.

damnever avatar Jun 22 '23 07:06 damnever