Skip to content

Service and Model Cleanup #277

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

Merged
merged 7 commits into from
May 17, 2023
Merged

Service and Model Cleanup #277

merged 7 commits into from
May 17, 2023

Conversation

Justintime50
Copy link
Member

@Justintime50 Justintime50 commented May 16, 2023

Description

This PR is a follow-up cleanup after breaking out services and models and does the following:

  1. Removes all old logic (combined services/models)
  2. Deserializes objects into their models (to get around circular imports, we are now initializing the model at runtime instead of at import time.)
  3. Uses better imports by importing in the __init__ files for cleaner names inside the library
  4. Fixes various tests that were broken and use the new syntax for all tests
  5. Various other small fixes

I have another PR planned to cleanup the requestor and EasyPost object files which will follow this.

Testing

Fixed various tests that needed that and re-recorded cassettes.

Pull Request Type

Please select the option(s) that are relevant to this PR.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement (fixing a typo, updating readme, renaming a variable name, etc)

@Justintime50 Justintime50 marked this pull request as ready for review May 16, 2023 22:37
@Justintime50 Justintime50 requested a review from a team May 16, 2023 22:37
@@ -45,7 +43,7 @@ def get_lowest_object_rate(
return lowest_rate


def get_lowest_smart_rate(smart_rates, delivery_days: int, delivery_accuracy: str) -> Rate:
Copy link
Member Author

Choose a reason for hiding this comment

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

Reviewer Note

These type hints were removed due to circular import issues. Will try and revisit this when I come back and fix all type hints

Copy link
Contributor

Choose a reason for hiding this comment

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

Put single quotes around the word Rate

Copy link
Member Author

Choose a reason for hiding this comment

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

It's the import itself that is a problem. I already tried that approach

@Justintime50 Justintime50 changed the title Cleanup Service and Model Cleanup May 16, 2023
Copy link
Contributor

@jchen293 jchen293 left a comment

Choose a reason for hiding this comment

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

Seems fine, there are missing type hints for some parameters that need to be added but I assume there will be a follow-up PR to address that?

Copy link
Contributor

@jchen293 jchen293 left a comment

Choose a reason for hiding this comment

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

seems fine, nice clean up work!

@Justintime50 Justintime50 requested a review from nwithan8 May 17, 2023 17:12
@Justintime50 Justintime50 merged commit 9a5bbee into master May 17, 2023
@Justintime50 Justintime50 deleted the cleanup branch May 17, 2023 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants