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

ENH: Remove Pydantic from Remaining Classes #512

Merged
merged 12 commits into from
Jan 18, 2024

Conversation

MateusStano
Copy link
Member

Pull request type

  • Code changes (bugfix, features)

New behavior

All Stochastic classes have now been updated to the new architecture.

This can be tested in the dispersion usage notebook.

Nothing has been changed in the Dispersion class yet.

Additional Information

Next dispersion related PR will be changing all the classes names and file structure

@MateusStano MateusStano added the Monte Carlo Monte Carlo and related contents label Dec 15, 2023
@MateusStano MateusStano self-assigned this Dec 15, 2023
@MateusStano MateusStano requested a review from a team as a code owner December 15, 2023 19:52
Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review only. Good to see all these new changes.

rocketpy/rocket/components.py Outdated Show resolved Hide resolved
rocketpy/monte_carlo/mc_flight.py Show resolved Hide resolved
Copy link
Collaborator

@phmbressan phmbressan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, certainly the code is longer without Pydantic, but as least we don't have to add another dependency. You made a good job with all these hard validations.

Side-note before approval, you should check out the comment regarding the components.get_by_type removal, I also think it is a breaking change.

rocketpy/monte_carlo/mc_flight.py Show resolved Hide resolved
rocketpy/monte_carlo/mc_rocket.py Outdated Show resolved Hide resolved
@phmbressan
Copy link
Collaborator

phmbressan commented Dec 21, 2023

There is one thing about this PR that I just noticed that is is worth thinking about.

In general, assert statements are not used in Python for production code, since they are ignored when running a optimized build python -O.

This is not a huge problem for now, since I think rocketpy build in pip install is a standard one, but it is worth noting. This behavior of assert is a hotly debated one in Python Community, auch as this discussion thread.

Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validating user inputs is not an easy task, but I think this PR is dealing this sufficiently.

Ready to be merge, no?

@@ -138,18 +208,21 @@ def __init__(
center_of_dry_mass_position=center_of_dry_mass_position,
nozzle_position=nozzle_position,
throat_radius=throat_radius,
interpolate=None,
coordinate_system_orientation=None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think nobody will ever change the coordinate_system_orientation in a Monte Carlo loop, but I'm not sure what were your intentions here so just double check it please.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, these lines are guaranteeing that the interpolation and coordinat_system_orientation will be gotten from the original object. Note that these arguments are not on the class' constructor

@phmbressan phmbressan merged commit fc8fddf into enh/class_dispersion Jan 18, 2024
3 of 9 checks passed
@phmbressan phmbressan deleted the enh/remove-pydantic-rocket branch January 18, 2024 22:39
@Gui-FernandesBR Gui-FernandesBR added this to the Release v1.X.0 milestone Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Monte Carlo Monte Carlo and related contents
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

3 participants