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

change: Trigger instance events after package is loaded? #346

Open
pawamoy opened this issue Dec 26, 2024 · 1 comment
Open

change: Trigger instance events after package is loaded? #346

pawamoy opened this issue Dec 26, 2024 · 1 comment
Assignees
Labels
refactor Change suggestion, not a bug nor a feature.

Comments

@pawamoy
Copy link
Member

pawamoy commented Dec 26, 2024

Is your change request related to a problem? Please describe.

Extensions parse docstrings and modify the cached parsed attribute to append/remove sections. But now parsers fetch annotations from inherited members. And both inherited members and resolved bases are cached... they will be cached too early. Even if we stop caching them, parsers won't be able to fetch inherited members if they run before the whole package is loaded.

Describe the solution you'd like

First, and most urgent: stop caching resolved bases and inherited members.

Then, either:

  • modify hooks so that "instance" hooks always run once the whole package is loaded (still requires that other necessary packages are pre-loaded before that)
  • go back to "uncache parsed docstrings", and force extensions to modify the value attribute (with parsing/splitting + re-dumping/insertion/deletion). Docstring styles must anyway be set correctly before attempting any splitting/parsing, caching or not doesn't change that fact.

Describe alternatives you've considered

/

Additional context

#340

@pawamoy pawamoy added the refactor Change suggestion, not a bug nor a feature. label Dec 26, 2024
@pawamoy pawamoy self-assigned this Dec 26, 2024
@pawamoy
Copy link
Member Author

pawamoy commented Dec 26, 2024

Running "instance" hooks later would be a breaking change as we wouldn't be able to pass AST nodes. Uncaching parsed would be a breaking change too, but at least we can have a deprecation period and it might affect less extensions.

pawamoy added a commit that referenced this issue Dec 26, 2024
…nd inherited members, classes' resolved bases

Issue-346: #346
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Change suggestion, not a bug nor a feature.
Projects
None yet
Development

No branches or pull requests

1 participant