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

[Concept] Dynamic command for fastly building parser. #9

Open
elda27 opened this issue Jul 22, 2024 · 0 comments
Open

[Concept] Dynamic command for fastly building parser. #9

elda27 opened this issue Jul 22, 2024 · 0 comments

Comments

@elda27
Copy link
Owner

elda27 commented Jul 22, 2024

It becomes to separate function implementation and decleration.
An example code:

# main.py
@dynamic_command("mod.importing.dynamic:main")
def definition(config: Config):
    ....

---
# mod.importing.dynamic
def main(config:Config):
    # Implementation
    ...

A proposing approach can support no definition of the type annotation due to static analysis using ast parser.
But it implementation is hard to support precise behavior then dynamically inheritance or assignment.
So this library needs fully annotation at the function decorated by dynamic.

from pydantic import BaseModel
from pydantic_argify import command
from usermod import UnexpectedConfig
class Config(BaseModel):
    ...

Config = UnexpectedConfig

@command
def command(config: Config):
    ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant