Skip to content

feat: Add CLI #19

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 21 commits into from
Apr 14, 2025
Merged

feat: Add CLI #19

merged 21 commits into from
Apr 14, 2025

Conversation

ubdbra001
Copy link
Contributor

This takes the FileTree implementation from #2 and uses it as part of a CLI.

I've copied over the tests for the files.types module but can't seem to get them to run. They just skip every time, I suspect I am missing something there.

Also guidance on implementing tests for the CLI itself would be greatly appreciated.

Cheers!

checks individual filenames
Adds FileTree class to walk through supplied directory
@ubdbra001 ubdbra001 marked this pull request as draft March 14, 2025 10:59
Copy link

codecov bot commented Mar 14, 2025

Codecov Report

Attention: Patch coverage is 81.74603% with 23 lines in your changes missing coverage. Please review.

Project coverage is 88.64%. Comparing base (eacb851) to head (202d6df).
Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
src/bids_validator/types/files.py 82.85% 9 Missing and 3 partials ⚠️
src/bids_validator/__main__.py 70.58% 8 Missing and 2 partials ⚠️
tests/conftest.py 90.90% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
- Coverage   93.19%   88.64%   -4.56%     
==========================================
  Files           3        7       +4     
  Lines         191      317     +126     
  Branches       21       35      +14     
==========================================
+ Hits          178      281     +103     
- Misses          5       22      +17     
- Partials        8       14       +6     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@effigies
Copy link
Contributor

Awesome!

I've done a little patching up of the tests/ directory, adding a https://github.com/bids-standard/bids-examples/ submodule, making sure it's fetched in CI, and updating the checks to look for it.

For testing the CLI, I wasn't entirely sure how best to go about it, so I spent a bit of time figuring it out and pushed it directly. It's quick and dirty, we'll probably want to clean it up some.

We shouldn't worry about the 3.8 failures. 3.8 is end-of-life, so I'll make a separate PR removing it and adding testing on 3.13.

Copy link
Contributor

@effigies effigies left a comment

Choose a reason for hiding this comment

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

Okay, here are some suggestions.

@effigies
Copy link
Contributor

Notes from meeting:

  • Add CLI entrypoints ([project.scripts])
  • Print (log?) package and version (maybe use f'bids-validator {version} (Python {sys.version.split()[0]})' to make clear that it's Python)
  • Allow -q/--quiet to suppress version message / reduce log verbosity
  • If using logging, use -v/--verbose to increase log verbosity.

@effigies effigies mentioned this pull request Mar 17, 2025
@effigies effigies changed the title Issue 5/add cli feat: Add CLI Mar 31, 2025
@ubdbra001
Copy link
Contributor Author

I got a chance to work on this, and so added the features discussed previously.
Just added as print statements because I'm not certain how logging for a library should be set up.
I can spend a bit of time reading around this if logging is preferred to print for this PR.

Copy link
Contributor

@effigies effigies left a comment

Choose a reason for hiding this comment

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

Looks good. One small suggestion.

@effigies effigies marked this pull request as ready for review April 14, 2025 15:04
@effigies effigies merged commit 87c1ae3 into bids-standard:main Apr 14, 2025
23 of 25 checks passed
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