Opened 6 years ago

Closed 6 months ago

#29942 closed Bug (fixed)

viewsource links to contrib.auth.forms not appearing

Reported by: Yemar Nevets Owned by: David Smith
Component: Documentation Version: dev
Severity: Release blocker Keywords:
Cc: Zach Borboa Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Change History (27)

comment:1 by Tim Graham, 6 years ago

Component: UncategorizedDocumentation
Summary: URL is brokenviewsource links to contrib.auth.forms not appearing
Triage Stage: UnreviewedAccepted

It looks like the issue started in Django 1.9. I wonder if the imports changes in fe914341c83b37fd6aa8fd85620cf49dd2328ab0 may be at fault. I haven't looked into how sphinx.ext.viewcode works.

comment:2 by Prabakaran Kumaresshan, 6 years ago

Owner: changed from nobody to Prabakaran Kumaresshan
Status: newassigned

comment:3 by Hasan Ramezani, 5 years ago

Has patch: set
Owner: changed from Prabakaran Kumaresshan to Hasan Ramezani

It is not only contrib.auth.forms. here are the missing source code files list.

django/db/models/fields/related_descriptors.html
django/contrib/contenttypes/fields.html
django/contrib/contenttypes/admin.html
django/contrib/contenttypes/forms.html
django/contrib/contenttypes/models.html
django/contrib/admin/models.html
django/contrib/admin/apps.html
django/contrib/sessions/base_session.html
django/contrib/auth/validators.html
django/contrib/auth/views.html
django/contrib/auth/mixins.html
django/contrib/auth/middleware.html
django/contrib/auth/backends.html
django/contrib/auth/forms.html
django/contrib/auth/models.html
django/contrib/auth/base_user.html

from Sphinx viewcode extensions: Basically, viewcode extension will import the modules being linked to.

when Sphinx tries to do for example import django.contrib.auth.forms, it will get

django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

So, I created a PR to load the apps in https://github.com/django/django/blob/master/docs/conf.py. But the docs test failed. But in my local machine, it works and missed source files generated successfully.

I don't know this is a good solution or not. just a PR to start the discussion.

comment:4 by Mariusz Felisiak, 5 years ago

Patch needs improvement: set

comment:5 by Felix Hein, 2 years ago

Owner: changed from Hasan Ramezani to Felix Hein

comment:6 by Felix Hein, 2 years ago

I spent some time trying to understand this issue and the longer I think about it, the less clear it becomes to me which parts of the source code should be linked to and which shouldn't.
The list of linked modules at https://docs.djangoproject.com/en/dev/_modules/ is missing a lot of modules, which could well be intentional. (That list is the list of files generated by the viewcode extension, so it contains all the source code files that are linked to somewhere in the documentation, like here: https://docs.djangoproject.com/en/dev/ref/applications/#django.apps.AppConfig.)
The modules mentioned in this ticket have not been linked to for a long time (and thus their source code has not been included in the /_modules/.. section of the documentation for that same time). So is this maybe something that we do not actually want to link to?

Version 0, edited 2 years ago by Felix Hein (next)

comment:7 by Zach Borboa, 2 years ago

Cc: Zach Borboa added

comment:8 by Sarah Boyce, 19 months ago

Owner: changed from Felix Hein to Sarah Boyce
Patch needs improvement: unset

comment:9 by Natalia Bidart, 19 months ago

Triage Stage: AcceptedReady for checkin
Version: 2.1dev

comment:10 by Sarah Boyce, 18 months ago

Triage Stage: Ready for checkinAccepted

Updating the status to "Accepted" as edits have been pushed recently and need a review :)

comment:12 by Sarah Boyce, 18 months ago

Owner: changed from Sarah Boyce to Joachim Jablon

comment:13 by Mariusz Felisiak, 16 months ago

Patch needs improvement: set

comment:14 by Mariusz Felisiak, 13 months ago

Owner: Joachim Jablon removed
Status: assignednew

comment:15 by David Smith, 10 months ago

Owner: set to David Smith
Patch needs improvement: unset
Status: newassigned

comment:16 by Natalia Bidart, 9 months ago

Patch needs improvement: set

comment:17 by David Smith, 8 months ago

Patch needs improvement: unset

comment:18 by Natalia Bidart, 8 months ago

Needs tests: set
Patch needs improvement: set

Setting as patch needs improvements following review from yesterday.

comment:19 by David Smith, 8 months ago

Needs tests: unset
Patch needs improvement: unset

comment:20 by Natalia Bidart, 7 months ago

Patch needs improvement: set

Branch is pretty much ready for merge though there is a tiny pending detail about better error reporting when calling importlib.util.resolve_name(name=imported_path, package=module). Setting the needs improvement flag to track that item.

comment:21 by Natalia Bidart, 6 months ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:22 by nessita <124304+nessita@…>, 6 months ago

Resolution: fixed
Status: assignedclosed

In b691acce:

Fixed #29942 -- Restored source file linking in docs by using the Sphinx linkcode ext.

Co-authored-by: David Smith <smithdc@…>
Co-authored-by: Natalia <124304+nessita@…>

comment:23 by Zach Borboa, 6 months ago

hi. this ticket is marked fixed, but the dev URL mentioned in the description[1] still 404s.

[1] https://docs.djangoproject.com/en/dev/_modules/django/contrib/auth/forms/

comment:24 by Tim Graham, 6 months ago

Resolution: fixed
Severity: NormalRelease blocker
Status: closednew
Triage Stage: Ready for checkinAccepted

Probably the documentation hasn't been updated since this change due to a Python 3.8 incompatibility.

comment:25 by GitHub <noreply@…>, 6 months ago

In 15fff62d:

Refs #29942 -- Fixed docs build on Python < 3.9 avoiding dict union operator.

The docs build process was failing on djangoproject.com since it uses Python 3.8 and the dict union operator was added in Python 3.9.

in reply to:  23 comment:26 by Natalia Bidart, 6 months ago

Replying to Zach Borboa:

hi. this ticket is marked fixed, but the dev URL mentioned in the description[1] still 404s.

[1] https://docs.djangoproject.com/en/dev/_modules/django/contrib/auth/forms/

Hello Zach,

As Tim mentioned, we did land a fix but it wasn't available because of a docs build issue in our building server. We have now fixed that and the linking to source code is available via the "[source]" link in the docs, for example in https://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.forms.PasswordChangeForm there is a link to https://github.com/django/django/blob/main/django/contrib/auth/forms.py#L488

The fix for this issue included migrating from one Sphinx extension (viewcode) to another (linkcode), so now the docs include links to the source code directly in GitHub.

comment:27 by Natalia Bidart, 6 months ago

Resolution: fixed
Status: newclosed

Docs build failure fixed in 15fff62d5d8f28b6b61d63341535c9aafc64c865 and confirmed docs now build correctly in both RTD and our server.

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