damnever / pigar

:coffee: A tool to generate requirements.txt for Python project, and more than that. (IT IS NOT A PACKAGE MANAGEMENT TOOL)

Home Page:https://damnever.github.io/pigar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: django support

cgthayer opened this issue · 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.

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.

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 Pull request welcome! You can start from here.

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.