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

Introspect classes for imports and decorator support #944

Open
3 tasks
dselman opened this issue Nov 19, 2024 · 0 comments
Open
3 tasks

Introspect classes for imports and decorator support #944

dselman opened this issue Nov 19, 2024 · 0 comments

Comments

@dselman
Copy link
Contributor

dselman commented Nov 19, 2024

Feature Request ๐Ÿ›๏ธ

Refactor the code to introduce classes to represent imports.

Use Case

Imports are getting increasingly complex (import *, import single type, import multiple types, with aliasing). Before we introduce semver range support for imports we should refactor the code to make imports a first class element in introspect.

In addition we have a need to support decorators on imports.

Possible Solution

Add three new classes:

  1. Import (abstract) which extends Decorated, to support decorators on imports
  2. ImportAll (for wildcard imports)
  3. ImportTypes (for a list of imported types, with aliases)
  • Update parser to support decorators on imports
  • Refactor AST parsing and validation.
  • Refactor ModelFile to use the new introspect classes, maintaining API compatibility.

Context

Working on #931 it is clear that the way we manage imports within ModelFile needs to be refactored.

Detailed Description

@dselman dselman self-assigned this Nov 19, 2024
@dselman dselman changed the title Add Imports to introspect Introspect classes for imports and decorator support Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant