-
Notifications
You must be signed in to change notification settings - Fork 33
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
Namespaces: Infrastructure #780
base: collect-components-of-namespaces
Are you sure you want to change the base?
Conversation
@MImmesberger The nested function dictionary is currently structured like this: Which levels of nesting should be removed? Based on our previous discussion, it's probably the first two, i.e. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #780 +/- ##
=======================================
Coverage ? 87.82%
=======================================
Files ? 56
Lines ? 3975
Branches ? 0
=======================================
Hits ? 3491
Misses ? 484
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
I think that, for example, |
Looking at that, I'd almost think that What do you think, @MImmesberger ? In any case, not super-important for the moment, the good thing is that it will be fairly easy to do bulk-renamings / removals (granted it seems more difficult to insert a level back than to remove it, so I'd be fine with an approach applying a bit more caution at the moment). |
I agree, there should be no overlap between the elements one level below the Regarding the naming of |
Agreed, let's use I'm all for good docstrings, but any tax deduction should go into the tax component it is deducted from, right? |
Yes definitely. Was just thinking about making it as obvious as possible. In our case "Kinderbonus" is a transfer. |
More in line with the naming of modules might be |
Good catch! Those are scheduled to be changed to
But that was not impossible to know, ofc! |
Should the renamings/removals be done programmatically in the new function or by changing the directory structure under Edit: For now, remove |
Just came across #533 -- might that be fixed in passing here? |
for more information, see https://pre-commit.ci
- Add testing dependencies to default environment - Make sure the correct kaleido dependency is installed on Windows/Unix - Add task `tests`, so that `pixi run tests` gives one the option to run the tests on Python 3.11 and 3.12 - Set 3.12 as the upper bound for the default environment Python version (as long as we don't test 3.13, we should probably not use it in the development environment?). - Use pdbp in pytest - Remove artifacts from previous packaging workflow --------- Co-authored-by: Hans-Martin von Gaudecker <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very nice -- but far too long for the amount of time I have today. Will try to continue asap.
Thanks a lot!
So that we don't forget it: We should think about changing the |
Good one. But now that we switch, should not the full path be part of |
I looked a little deeper now. Let's set aside a day in January where we'll look at this more closely. I do believe there is huge room for simplification in the whole function loader with the tree structure. That is, |
@@ -186,10 +218,12 @@ def _create_policy_function_from_decorated_callable( | |||
""" | |||
|
|||
# Only needed until the directory structure is cleaned up | |||
# TODO(@MImmesberger): Remove the removeprefix calls once the directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think we should do that right now. We will not merge this one into main, so we want to have the full machinery in place before tackling the renaming. Or am I missing something? Same for the other occurrence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered this a renaming step, but yes, we better fix it here already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And that was the right thought at the time we wanted to merge into main!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't settled on a specific directory structure yet. I propose:
|-- src
| |-- gettsim
| | |-- ...
| |-- _gettsim
| | |-- infrastructure (alternatively: ttsim?)
| | | |-- aggregation_jax.py
| | | |-- aggregation_numpy.py
| | | |-- aggregation.py
| | | |-- gettsim_typing.py
| | | |-- piecewise_functiony.py
| | | |-- policy_environment.py
| | | |-- policy_environment_postprocessor.py
| | | |-- interface.py
| | | |-- shared.py
| | | |-- time_conversion.py
| | | |-- vectorization.py
| | |-- parameters
| | |-- taxes_and_transfers
| | | |-- demographics
| | | |-- einkommensteuer
| | | |-- arbeitslosengeld_2
| | | |-- wohngeld
| | | |-- ...
| | | |-- groupings.py
| | |-- config.py
| | |-- synthetic.py
| | |-- visualization.py
| |-- _gettsim_tests
| | |-- ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. Again, I think I would be even more radical, now that we are at it:
|-- src
| |-- gettsim
| | |-- ...
| |-- _gettsim
| | |-- ttsim
| | | |-- config.py
| | | |-- aggregation_jax.py
| | | |-- aggregation_numpy.py
| | | |-- aggregation.py
| | | |-- typing.py
| | | |-- piecewise_functiony.py
| | | |-- policy_environment.py
| | | |-- policy_environment_postprocessor.py
| | | |-- interface.py
| | | |-- shared.py
| | | |-- time_conversion.py
| | | |-- vectorization.py
| | | |-- visualize_dag.py
| | |-- de
| | | |-- config.py
| | | |-- parameters
| | | |-- demographics
| | | |-- einkommensteuer
| | | |-- arbeitslosengeld_2
| | | |-- wohngeld
| | | |-- ...
| | | |-- groupings.py
| | | |-- synthetic.py
| |-- _gettsim_tests
| | |-- ttsim
| | | |-- ...
| | |-- de
| | | |-- ...
That is,
ttsim
suggestion is cool, changetaxes_and_transfers
accordinglyconfig
andsynthetic
need to be split up among these two- just
typing
, notgettsim_typing
visualize_dag
(we should probably rename the function, too?)- make parameters part of
de
Probably easiest to inject this as step 3 in the grand PR given the work you put in so far?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of small things while familiarising myself with it. Looks great in general!
return result | ||
|
||
|
||
def _filter_tree_by_name_list( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you draw up an overview where we need
- qualified names
- the branch of the nested dicts?
Just to get an idea of that, hard to see by scanning the codebase.
Reason: I think I'd prefer working with 2. wherever possible (i.e., wherever we do not need to write it down as an argument to a Python function). IIUC, that would be optree.PyTreeAccessors?).
functions_not_overridden, dag.nodes | ||
) | ||
processed_functions = _round_and_partial_parameters_to_functions( | ||
necessary_functions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
necessary_functions, | |
_filter_tree_by_name_list(...)[1], |
and remove the above line.
What problem do you want to solve?
This PR introduces namespaces to GETTSIM's infrastructure.