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

MNT: Refactor AeroSurfaces #634

Merged
merged 12 commits into from
Jul 12, 2024
Merged

MNT: Refactor AeroSurfaces #634

merged 12 commits into from
Jul 12, 2024

Conversation

MateusStano
Copy link
Member

Pull request type

  • Code maintenance (refactoring, formatting, tests)

Checklist

  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Changes

  • Separate each AeroSurface class into a different file
  • Made a few shared attributes part of the AeroSurface class

Breaking change

  • Yes
  • No

@MateusStano MateusStano added Aerodynamics Any problem to be worked on top of RocketPy's Aerodynamic Refactor labels Jul 8, 2024
@MateusStano MateusStano self-assigned this Jul 8, 2024
@MateusStano MateusStano requested a review from a team as a code owner July 8, 2024 18:48
@MateusStano MateusStano mentioned this pull request Jul 8, 2024
8 tasks
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 80.60897% with 121 lines in your changes missing coverage. Please review.

Project coverage is 73.90%. Comparing base (fd4941c) to head (a749c01).
Report is 1 commits behind head on develop.

Files Patch % Lines
rocketpy/rocket/aero_surface/nose_cone.py 78.68% 39 Missing ⚠️
rocketpy/rocket/aero_surface/fins/fins.py 72.56% 31 Missing ⚠️
...ketpy/rocket/aero_surface/fins/trapezoidal_fins.py 80.00% 19 Missing ⚠️
rocketpy/rocket/aero_surface/tail.py 79.16% 15 Missing ⚠️
...cketpy/rocket/aero_surface/fins/elliptical_fins.py 87.03% 7 Missing ⚠️
rocketpy/rocket/aero_surface/air_brakes.py 85.71% 6 Missing ⚠️
rocketpy/rocket/aero_surface/rail_buttons.py 92.00% 2 Missing ⚠️
rocketpy/simulation/flight.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #634      +/-   ##
===========================================
- Coverage    73.92%   73.90%   -0.03%     
===========================================
  Files           70       79       +9     
  Lines        10032    10070      +38     
===========================================
+ Hits          7416     7442      +26     
- Misses        2616     2628      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Good job.

It will be much easier to add new AeroSurface now.

The flight.py file is the only one that warns me a bit. Please double check this file to ensure that you are not making any bad operation.

Copy link
Member

Choose a reason for hiding this comment

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

This file deletion will probably create merge conflicts with the following PR: #597

Copy link
Member

Choose a reason for hiding this comment

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

classes Fins and AeroSurface are abstract classes and therefore cannot be instantiated.
They are only exposed here if the user decides to create a new class based on them.
With that being said, I think we should avoid re-exposing them in the init files.

I don't want someone doing something like this:

from rocketpy import Fins

fins = Fins(...) # raises an error!!

An experienced user would still be able to import the class using its absolute path, like this:

from rocketpy.rocket.aero_surface.fins import Fins,

class NewFins(Fins):
    ...

@MateusStano MateusStano merged commit 92f8c97 into develop Jul 12, 2024
7 checks passed
@MateusStano MateusStano deleted the mnt/refactor-aerosurfaces branch July 12, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aerodynamics Any problem to be worked on top of RocketPy's Aerodynamic Refactor
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

2 participants