Skip to content
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

Make use of Sphinx inventories for cross references #8682

Merged
merged 2 commits into from Feb 13, 2024

Conversation

Viicos
Copy link
Contributor

@Viicos Viicos commented Jan 30, 2024

Fixes #8664

This is far from complete but can give you an overview.

@@ -51,7 +51,7 @@ except ValidationError as e:
Pydantic supports the following [datetime](https://docs.python.org/library/datetime.html#available-types)
types:

### `datetime.datetime`
### [`datetime.datetime`][]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure you'd want references directly on the headings. If so, I can remove them

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♀️ I think it'd be nice! Looks good.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking - have you built the docs locally to confirm that the [datetime.datetime][] style of references correctly redirects to the stdlib python docs?

Copy link

@pawamoy pawamoy Feb 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These manual references will produce warnings if they can't be resolved, failing MkDocs builds in strict mode, so the checking is kinda automated 🙂

Copy link

codspeed-hq bot commented Jan 30, 2024

CodSpeed Performance Report

Merging #8682 will not alter performance

Comparing Viicos:sphinx-inv-refs (653fad7) with main (0404872)

Summary

✅ 10 untouched benchmarks

Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great so far! Thanks for your work on this 🚀 .

@@ -174,6 +174,8 @@ plugins:
merge_init_into_class: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be nice to add these too:

parameter_headings: true
show_signature_annotations: true
signature_crossrefs: true

Copy link

@pawamoy pawamoy Feb 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For parameter headings, you'll have to install the Insiders version of mkdocstrings-python, similar to how you install mkdocs-material:

pdm run python -m pip install https://files.scolvin.com/${MKDOCS_TOKEN}/mkdocs_material-9.4.2+insiders.4.42.0-py3-none-any.whl

https://mkdocstrings.github.io/python/insiders/installation/

Let me know if any other user (Pydantic team member or bot) needs to be added to the @pawamoy-insiders organization 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added:

show_signature_annotations: true
signature_crossrefs: true

@@ -51,7 +51,7 @@ except ValidationError as e:
Pydantic supports the following [datetime](https://docs.python.org/library/datetime.html#available-types)
types:

### `datetime.datetime`
### [`datetime.datetime`][]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♀️ I think it'd be nice! Looks good.

mkdocs.yml Outdated Show resolved Hide resolved
@sydney-runkle
Copy link
Member

@Viicos,

Do you want to continue to make progress on this PR, or do this in chunks?

@Viicos
Copy link
Contributor Author

Viicos commented Feb 13, 2024

Maybe better in chunks, merging this will allow other PRs to make use of this feature

Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, tysm!

@sydney-runkle sydney-runkle merged commit 14ce997 into pydantic:main Feb 13, 2024
53 checks passed
@Viicos Viicos deleted the sphinx-inv-refs branch February 13, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Sphinx inventory references in docs
3 participants