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

Constants are always showned in alphabetical order, no matter the value of members_order #335

Closed
ghost opened this issue Oct 14, 2021 · 5 comments
Labels
unconfirmed This bug was not reproduced yet

Comments

@ghost
Copy link

ghost commented Oct 14, 2021

Describe the bug

No matter what value I set for members_order (alphabetical vs source), I always get alphabetical order when documenting constants.

To Reproduce
Please run this google colab

index.md :

::: code
    selection:
      filters:
      - "!.*"
      - "^[A-Z][A-Z_0-9]*$"
    rendering:
      show_if_no_docstring: True
      show_root_heading: False
      show_root_toc_entry: False
      members_order: "source"

Expected behavior
I expected the constants to be displayed in the same order as they are declared in the source code. (B_CONST first)

Screenshots
image
image

Information (please complete the following information):

  • OS: Linux
  • Browser: Brave
  • mkdocstrings version: 0.16.2
@ghost ghost added the unconfirmed This bug was not reproduced yet label Oct 14, 2021
@matthewwardrop
Copy link

I also observe this behaviour.

@yhtang
Copy link

yhtang commented Feb 3, 2022

Is this fixed by 0.17.0?

@pawamoy
Copy link
Member

pawamoy commented Feb 3, 2022

Probably not. I didn't get the time to try and fix it. My intuition is that inspect cannot get the source line numbers for regular attributes, therefore all attributes can only be sorted alphabetically. A new Python handler is on its way and will probably fix this.

@pawamoy
Copy link
Member

pawamoy commented Feb 3, 2022

By the way, sorry for the late answer 🙇
I've been focusing real hard on the new handler which should solve a lot of the current pain points 🙂

@pawamoy
Copy link
Member

pawamoy commented Feb 7, 2022

The new handler is now available, and should fix this issue for code that can be visited. It still won't be able to "source"-order attributes/constants for which we can't get the source lines though (for example compiled modules without the source available), and there's no workaround for that, but I don't think it matters much. Closing, feel free to further comment on this.

@pawamoy pawamoy closed this as completed Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unconfirmed This bug was not reproduced yet
Projects
None yet
Development

No branches or pull requests

3 participants