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

fix: support for nested parameters and FuncParam reference #56

Merged
merged 7 commits into from
Jul 23, 2022

Conversation

Miksus
Copy link
Owner

@Miksus Miksus commented Jul 17, 2022

This PR allows having (session) parameters in other parameters. Might allow recursion.

It also makes it possible to reference the function as the parameter name.

These are now possible:

from rocketry.args import Arg

@app.param("my_arg_1")
def get_arg_1():
    ...

@app.param("my_arg_2")
def get_arg_2(subarg=Arg("my_arg_1")):
    ... # Nested parameter

@app.task()
def do_things(arg_1=Arg("my_arg_1"), arg_2=Arg(get_arg_2)):
    ...

Also added func reference to FuncParams.
@Miksus Miksus added core Relates to the core functionalities (ie. base classes) built-in Relates to the built-in tasks, conditions etc. labels Jul 17, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jul 17, 2022

Codecov Report

Merging #56 (b0c9d59) into master (7599e82) will increase coverage by 0.07%.
The diff coverage is 97.29%.

@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
+ Coverage   90.71%   90.79%   +0.07%     
==========================================
  Files          87       87              
  Lines        4038     4050      +12     
==========================================
+ Hits         3663     3677      +14     
+ Misses        375      373       -2     
Impacted Files Coverage Δ
rocketry/tasks/command.py 91.11% <ø> (+3.87%) ⬆️
rocketry/args/builtin.py 89.87% <95.45%> (-1.80%) ⬇️
rocketry/args/secret.py 77.77% <100.00%> (ø)
rocketry/core/parameters/parameters.py 94.73% <100.00%> (+0.29%) ⬆️
rocketry/core/task.py 92.96% <100.00%> (+0.35%) ⬆️
rocketry/parameters/func.py 100.00% <100.00%> (ø)
rocketry/session.py 91.50% <100.00%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7599e82...b0c9d59. Read the comment docs.

@Miksus Miksus merged commit 91fe241 into master Jul 23, 2022
@Miksus Miksus deleted the fix/nested_params branch July 23, 2022 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
built-in Relates to the built-in tasks, conditions etc. core Relates to the core functionalities (ie. base classes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants