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

Try a different module/package structure #151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kinow
Copy link
Member

@kinow kinow commented Feb 2, 2022

It started over the week/holiday when I had a go at trying to write the conversion for WDL stdlib's select_all function. It didn't work for other reasons, but I noticed that the main.py keeps getting longer and longer.

So I thought we could probably reduce it a little by starting to use more modules/packages.

After reading the miniwdl code, I thought we could have a structure similar to their structure, but also thinking about CWL.

With that in mind, I thought about an wdl2cwl.expr module with the WDL Expr statements (conditionals, arithmetic, etc). And then remove the if statement from the WDL.Expr.Apply for WDL Stdlib Functions, and move that code to a separate module as well.

That resulted in wdl2cwl.functions. Furthermore, instead of using an if/elif's/else statement, we can simply check if the module has a function with the same name (coding by convention) and use it if so, otherwise raise an error as before.

While that would reduce the code, not sure if that's the best/right call for now. So happy to get any feedback. I almost finished this change, but ran out of ☕ (head was literally bobbing while I was writing the code 😴 , will review in the morning 🛌 )

Cheers
-Bruno

wdl2cwl/main.py Show resolved Hide resolved
wdl2cwl/expr.py Show resolved Hide resolved
wdl2cwl/functions.py Show resolved Hide resolved
@mr-c mr-c requested a review from ntachukwu February 3, 2022 18:57
@kinow kinow force-pushed the trying-different-struct branch 11 times, most recently from 68c5b9e to eb455f9 Compare February 4, 2022 23:22
@codecov
Copy link

codecov bot commented Feb 4, 2022

Codecov Report

Merging #151 (240439e) into main (0db1555) will increase coverage by 0.22%.
The diff coverage is 95.97%.

@@            Coverage Diff             @@
##             main     #151      +/-   ##
==========================================
+ Coverage   94.78%   95.00%   +0.22%     
==========================================
  Files           3        6       +3     
  Lines         728      761      +33     
  Branches      216      204      -12     
==========================================
+ Hits          690      723      +33     
  Misses         14       14              
  Partials       24       24              
Impacted Files Coverage Δ
wdl2cwl/expr.py 93.82% <93.82%> (ø)
wdl2cwl/functions.py 96.46% <96.46%> (ø)
wdl2cwl/errors.py 93.33% <100.00%> (+0.22%) ⬆️
wdl2cwl/main.py 94.60% <100.00%> (-0.22%) ⬇️
wdl2cwl/util.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0db1555...240439e. Read the comment docs.

wdl2cwl/main.py Outdated Show resolved Hide resolved
@kinow
Copy link
Member Author

kinow commented Feb 4, 2022

I suspect the coverage change is due to changes in line numbers.

@kinow kinow marked this pull request as ready for review February 4, 2022 23:31
@kinow
Copy link
Member Author

kinow commented Feb 4, 2022

Happy to keep rebasing/fixing conflicts so we can get @Th3nn3ss 's & @mr-c 's PRs in first 👋

Copy link
Contributor

@ntachukwu ntachukwu left a comment

Choose a reason for hiding this comment

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

I don't fully understand every implementation in this PR but am very excited to see how efficiently it handles dependencies between the python files. I hope to have pythonic powers like this someday. Incredible work.

@kinow
Copy link
Member Author

kinow commented Mar 12, 2022

Will update this PR over the next days 💪

@kinow
Copy link
Member Author

kinow commented Mar 24, 2022

Rebased, updated the code, and I think I got all the latest changes 🤓 😪 Going to stop for now, and review it in the morning. Then try to wrap it up updating anything broken in the CI. Or, if nothing broken, then just mark it as ready for review.

@kinow kinow force-pushed the trying-different-struct branch 4 times, most recently from 31487f7 to 82252b7 Compare March 25, 2022 05:08
@kinow
Copy link
Member Author

kinow commented Mar 25, 2022

Done!

@kinow kinow requested a review from mr-c March 25, 2022 06:05
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.

2 participants