Opened 10 years ago

Closed 5 years ago

Last modified 4 years ago

#23433 closed Cleanup/optimization (fixed)

Django installs /usr/bin/django-admin and /usr/bin/django-admin.py

Reported by: Arfrever Owned by: Jon Dufresne
Component: Packaging Version: dev
Severity: Normal Keywords:
Cc: Arfrever.FTA@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django (since 1.7) installs /usr/bin/django-admin and /usr/bin/django-admin.py.
Both of them execute django.core.management.execute_from_command_line().
/usr/bin/django-admin.py does it directly, while /usr/bin/django-admin does it through pkg_resources module of Setuptools.

/usr/bin/django-admin.py:

#!/usr/bin/python3.4
from django.core import management

if __name__ == "__main__":
    management.execute_from_command_line()

/usr/bin/django-admin:

#!/usr/bin/python3.4
# EASY-INSTALL-ENTRY-SCRIPT: 'Django==1.7','console_scripts','django-admin'
__requires__ = 'Django==1.7'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('Django==1.7', 'console_scripts', 'django-admin')()
    )

/usr/lib64/python3.4/site-packages/Django-1.7-py3.4.egg-info/entry_points.txt:

[console_scripts]
django-admin = django.core.management:execute_from_command_line

Installation of /usr/bin/django-admin.py is caused by scripts=['django/bin/django-admin.py'] in setup.py.
Installation of /usr/bin/django-admin is caused by entry_points={'console_scripts': ['django-admin = django.core.management:execute_from_command_line',]} in setup.py.

I think that it would suffice to install only one of these scripts.

Change History (10)

comment:1 by Aymeric Augustin, 10 years ago

Triage Stage: UnreviewedSomeday/Maybe
Version: 1.7master

We've introduced django-admin because commands don't usually have "language extensions".

We're keeping django-admin.py for backwards-compatibility.

There's little benefit to remove django-admin.py and it would be very disruptive.

Maybe we'll do to at some point, but not soon.

comment:2 by Aymeric Augustin, 10 years ago

We should wait until support for Django 1.6 ends to remove django-admin.py.

Otherwise, it will become complicated to write version-independent test scripts (think tox.ini).

comment:3 by Collin Anderson, 10 years ago

If we do remove it, we should officially deprecate it first, right?

comment:4 by Aymeric Augustin, 10 years ago

Yes, the fast track would be to deprecate it in Django 1.8 and remove it in Django 2.0.

However, there's almost no downside to keeping it for a few more years, and it will avoid making many tutorials obsolete (for example).

comment:5 by Mariusz Felisiak, 5 years ago

Has patch: set
Owner: changed from nobody to Jon Dufresne
Patch needs improvement: set
Status: newassigned
Triage Stage: Someday/MaybeAccepted

comment:6 by Jon Dufresne, 5 years ago

Patch needs improvement: unset

comment:7 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In 8eb0f73:

Refs #23433 -- Removed script argument from AdminScriptTestCase.run_test().

comment:8 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 5708327:

Fixed #23433 -- Deprecated django-admin.py entry point in favor of django-admin.

Unify on the entry point created by setuptools entry_points feature.

comment:9 by GitHub <noreply@…>, 5 years ago

In 3fb7c121:

Refs #23433 -- Fixed test_django_admin_py.DeprecationTest tests failures on Windows and Python < 3.8.

subprocess.run()'s args parameter accepts a path-like object on Windows
since Python 3.8.

comment:10 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In 90c59b4e:

Refs #23433 -- Removed django-admin.py entry point per deprecation timeline.

Note: See TracTickets for help on using tickets.
Back to Top