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

Remove errant __init__.py that prevents mypy from working #54

Merged
merged 12 commits into from Mar 8, 2024

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Jan 28, 2024

The file at src/__init__.py is not necessary and is somehow breaking mypy for the rest of the project. This PR removes that file, then adds a series of typing related fixes.

@ml-evs ml-evs mentioned this pull request Jan 28, 2024
5 tasks
@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2024

Codecov Report

Attention: Patch coverage is 17.77778% with 37 lines in your changes are missing coverage. Please review.

Project coverage is 45.04%. Comparing base (5da2c9e) to head (8733918).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #54      +/-   ##
===========================================
- Coverage    45.19%   45.04%   -0.16%     
===========================================
  Files           42       42              
  Lines         4290     4318      +28     
  Branches       876      885       +9     
===========================================
+ Hits          1939     1945       +6     
- Misses        2173     2193      +20     
- Partials       178      180       +2     
Files Coverage Δ
src/jobflow_remote/__init__.py 100.00% <100.00%> (ø)
src/jobflow_remote/cli/project.py 45.66% <100.00%> (+0.43%) ⬆️
src/jobflow_remote/cli/runner.py 28.00% <ø> (ø)
src/jobflow_remote/cli/types.py 90.00% <100.00%> (+0.41%) ⬆️
src/jobflow_remote/config/__init__.py 100.00% <100.00%> (ø)
src/jobflow_remote/remote/host/__init__.py 100.00% <100.00%> (ø)
src/jobflow_remote/cli/flow.py 25.28% <0.00%> (ø)
src/jobflow_remote/config/helper.py 49.47% <0.00%> (-0.53%) ⬇️
src/jobflow_remote/jobs/run.py 24.21% <0.00%> (ø)
src/jobflow_remote/cli/job.py 25.82% <25.00%> (ø)
... and 3 more

@ml-evs
Copy link
Member Author

ml-evs commented Jan 30, 2024

@gpetretto I had a go at fixing some of the typing issues suggested by mypy but I'm not entirely convinced by a lot of the annotations I am adding. Would you be able to take a look? (probably before merging this?)

@gpetretto
Copy link
Contributor

Sure. Do you want me to try to apply this change locally and check the typing issues? Or do you already have a list of problematic ones to be verified?

@ml-evs
Copy link
Member Author

ml-evs commented Jan 30, 2024

Sure. Do you want me to try to apply this change locally and check the typing issues? Or do you already have a list of problematic ones to be verified?

I'll push the changes I'm happy with to this PR and try to point out the ones that are weird

@ml-evs
Copy link
Member Author

ml-evs commented Jan 30, 2024

Sure. Do you want me to try to apply this change locally and check the typing issues? Or do you already have a list of problematic ones to be verified?

I'll push the changes I'm happy with to this PR and try to point out the ones that are weird

I've just pushed these, the remaining lint errors are the weird ones (mostly lots of awkward typing around the db potentially returning None) -- hopefully the enum value changes are fine though

@gpetretto
Copy link
Contributor

I checked some of the errors related to the None and, while they are not real errors as the check on the object not being None is performed somewhere else, mypy is likely not able to deduce that. Not sure what is the best strategy here: either skip the check or adding some redundant check on the object not being None. I can do that, so I will also check that they are all indeed correct.

The other errors could probably be resolved by adding __all__ to the __init__.py files that have imports.

I am not sure about replacing the values of the Enums with the Enums instance in the CLI. Does it work? Should I test it?

@ml-evs ml-evs added the on-hold label Feb 5, 2024
@ml-evs ml-evs removed the on-hold label Mar 6, 2024
@ml-evs ml-evs requested a review from gpetretto March 6, 2024 16:02
@ml-evs
Copy link
Member Author

ml-evs commented Mar 6, 2024

I've finally got around to fixing the mypy issues in b7b7f81, mostly by just adding checks for None where appropriate. Could you take another look @gpetretto?

Copy link
Contributor

@gpetretto gpetretto left a comment

Choose a reason for hiding this comment

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

I am fine with most of the changes, but some of those to the CLI seem to break Typer. Does it work for you? Otherwise I would revert them and ignore any related linter comments.

src/jobflow_remote/cli/job.py Show resolved Hide resolved
src/jobflow_remote/cli/job.py Outdated Show resolved Hide resolved
src/jobflow_remote/cli/job.py Outdated Show resolved Hide resolved
src/jobflow_remote/cli/project.py Outdated Show resolved Hide resolved
src/jobflow_remote/cli/runner.py Outdated Show resolved Hide resolved
src/jobflow_remote/cli/runner.py Outdated Show resolved Hide resolved
@ml-evs
Copy link
Member Author

ml-evs commented Mar 6, 2024

Annoyingly this is now back in the state where the tests work locally but not in the CI; I'll try to debug it when I get a chance but for now do not let this PR hold up the other ones that actually add features.

@gpetretto
Copy link
Contributor

Annoyingly this is now back in the state where the tests work locally but not in the CI; I'll try to debug it when I get a chance but for now do not let this PR hold up the other ones that actually add features.

After your last commit it seems that only a lint issue remains in the tests. Depending on your availability, I suppose these can be fixed and then we can merge this before the other PRs.

@ml-evs
Copy link
Member Author

ml-evs commented Mar 7, 2024

After your last commit it seems that only a lint issue remains in the tests. Depending on your availability, I suppose these can be fixed and then we can merge this before the other PRs.

Think that's got it -- I won't be able to take a look at the other PRs again until Friday so feel free to do with this as you please!

@gpetretto gpetretto merged commit b4b9e44 into develop Mar 8, 2024
5 checks passed
@ml-evs ml-evs deleted the ml-evs/fix-mypy branch March 26, 2024 16:46
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.

None yet

4 participants