#34778: startproject could use find_spec() rather than import_module() to check
for
conflicts
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: nobody
Walls |
Type: | Status: new
Cleanup/optimization |
Component: Core | Version: dev
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The `startproject` command currently depends on calling
`importlib.import_module()` on the intended new project name, which will
execute a python module if it happens to find one.
It would be more performant and less intrusive to check the return value
of `importlib.util.find_spec`
[https://docs.python.org/3/library/importlib.html?highlight=find_spec#importlib.util.find_spec
(docs)], which avoids importing anything (so long as the path doesn't
include a dot, but that can be checked for first.)
Happy to submit a PR if welcome.
--
Ticket URL: <https://code.djangoproject.com/ticket/34778>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070189f5d2f75d-f2b2b112-5c84-4c2c-9ee4-47644d010be3-000000%40eu-central-1.amazonses.com.