-
-
Notifications
You must be signed in to change notification settings - Fork 168
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 DispersionModel, Environment and SolidMotor #509
ENH: Remove Pydantic From DispersionModel, Environment and SolidMotor #509
Conversation
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.
This Looks Good To Me
Yes, it currently do not make any sense recreating the Environment model, only if you are not sure where you want to launch and this uncertainty is about some kilometers. Just doesn't make sense. Given you faced problem with both burn_time and intertia_tensor since they are tuples, it seems our models can't handle tuples argument yet. But you solved it for inertia tensor... Why could we do the same for the burn_time too? It's ok make some assumptions at this stage as long as you documment it. This address the penultimate question |
Tests not passing, is there anything we have to worry about it? |
Thats a great idea! Done in 631f46e
Nope, I have not looked at the tests yet |
Important to keep private methods |
Pull request type
Checklist
black rocketpy/ tests/
) has passed locallypytest --runslow
) have passed locallyCHANGELOG.md
has been updated (if relevant)Current behavior
All the Dispersion related classes were built upon pydantic, which made some of the input validation much easier to do. However, pydantic is a huge package, and we were doing something very simple with it, using only a very small and specific part of the library.
The dependency of this library also made maintaining these classes harder for new developers
After a big hiatus from working on dispersion, pydantic updated to v2 and changing our code to fit the new versions would be a lot of work. Specially since a lot of the classes' inputs changed (dry_mass, inertias etc...)
New behavior
Pydantic has been totally removed from some of the dispersion classes. I will be making smaller Pull Requests removing pydantic for every few classes, since there are a lot of additions and changes. This way we speed up our revision process
Structure and documentation of the changed classes has also been improved
This PR only removes pydantic from:
DispersionModel
McEnvironment
McSolidMotor
Notes:
MotorDispersionModel
class was created. This will be really useful for the future implementation of hybrid and liquidsDispersionModel
were related to pydantic's removal. Mostly it was just improvements to the validation function structure and documentationAdditional information
McEnvironment
andMcSolidMotor
indispersion_class_usage.ipynb
, but that notebook is not even close to being completedQuestions
I have a few issues with this implementation that needs some discussing to be resolved
datum
andtime_zone
fromMcEnvironment
. It does not make sense to vary does since we do not rebuild the atmospheric model. However, this is also true for thedate
argument. Should we really not rebuild the atmospheric model? Adding an optional parameter to chose that to the user seems like a good solution.burn_time
argument has a few issues:burn_time
can be a tuple, how could we adapt that to the dispersion classes inputs?burn_time
is passed directly toreshape_thrust_curve
, but this only acceptsburn_time
in the int/float form. If we allowburn_time
to be passed as a tuple somehow, how would we make it work inreshape_thrust_curve
?McSolidMotor
,burn_time
is assumed to be in theint/float
format, meaning we assume that the user's thrust curve starts at time zero and ends at theburn_time
. Should we keep like this?McSolidMotor
inputs. It is a lot of arguments, but I could not think of any other way of doing it. Any suggestions?