Skip to content

Conversation

@YuriiMotov
Copy link
Contributor

@YuriiMotov YuriiMotov commented Nov 27, 2025

This PR is to handle situations when we have versions in different folders (version code is in folder name, not in file name).

image

In case there is no version found for file in current folder, it will attempt to find versions by folders.
In the example above, for {* docs_src/settings/app02_an/main.py *} it will find:

  • Python 3.8+
  • Python 3.8+ Annotated

This implementation only handles variants in parent directory of the file. We may want to support several levels.
For example:

{* docs_src/settings/app02_an/routers/users.py *}

The example above is not currently supported (variants will not be found).


One drawback of this implementation is that if we have several versions of one app, but one of files is the same in all versions, this file will still be displayed with versions (all of them will be equal).


To overcome both of issues explained above we can add a config option to specify the level of folder where to search for variants.

For example, to search for variants in app02** folders:

{* docs_src/settings/app02_an/routers/users.py variants_lvl[2] *}

Or, to disable searching for variants in folders (if we don't want to show variants when all of them are equal):

{* docs_src/settings/app02_an/routers/users.py variants_lvl[0] *}

@YuriiMotov YuriiMotov marked this pull request as ready for review November 27, 2025 21:01
@tiangolo tiangolo added the feature New feature or request label Nov 28, 2025
Copy link
Owner

@tiangolo tiangolo left a comment

Choose a reason for hiding this comment

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

Excellent! Impeccable job! 🙌 🚀

@tiangolo tiangolo merged commit f176a9d into tiangolo:main Nov 28, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants