-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
django-rest-framework modifies global docutils rst parser #9626
Comments
I would like to solve this issue, if you would allow me to |
it sounds to me that the problem stems from the fact that " Have you tried to raise this problem upstream to the Django project itself? I'm guessing that it may be considered an internal API from Django, however by searching GitHub, it's used in multiple other projects. Fixing it upstream would solve the problem not only for DRF users, but also for all users of these others projects. |
I've considered that, but I don't see a way for On the other side, I didn't investigate whether this usage is wide-spread. I've created https://code.djangoproject.com/ticket/36124 to get another opinion there. |
One could move these regex functions outside of the admindocs utils.py file. Django admin docs and DRF would import it from these without the side effect. Thanks for opening the ticket there! |
Did you end up creating a forum topic? I opened a PoC PR to see if Django's test suite suite passes: django/django#19116 and if we can run our own test suite against it: #9636 You could try to run some tests against these versions in your own project. I would recommend forking the version of Django you're using and applying the same patch (unless you're installing Django from source 😄) |
django-rest-framework relies on
django.contrib.admindocs
on some regex cleanups:django-rest-framework/rest_framework/schemas/generators.py
Line 10 in b483179
Unfortunately, importing
django.contrib.admindocs.views
importsdjango.contrib.admindocs.utils
which has a side effect that it customizes the rst parser in docutils:https://github.com/django/django/blob/c28f821c9067050ba0d099349a4dfea2b29faf99/django/contrib/admindocs/utils.py#L164-L170
The root cause of this being that docutils does only have a global registry (https://sourceforge.net/p/docutils/feature-requests/38/ is open for more than 10 years).
Would it be possible to use a different way to simplify regular expressions that doesn't have such side effects?
Checklist
The text was updated successfully, but these errors were encountered: