-
Notifications
You must be signed in to change notification settings - Fork 161
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
[ENH] Add filename template legend #1219
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please also remove:
bids-specification/.circleci/config.yml
Line 16 in d849c40
pip install ~/project/tools/schemacode/[render] |
and re:
maybe there is a way to make the JSON pre-commit hook ignore certain files?
not for this specific hook, but will exclude the file globally in the pre-commit config |
Codecov Report
@@ Coverage Diff @@
## master #1219 +/- ##
==========================================
- Coverage 88.23% 88.16% -0.07%
==========================================
Files 6 6
Lines 1020 1031 +11
==========================================
+ Hits 900 909 +9
- Misses 120 122 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
weird note: running Most likely not ideal but probably best to investigate somewhere else than in this PR Example``` datalad run -m 'run black on all files' 'black .' [INFO ] == Command start (output follows) ===== Skipping .ipynb files as Jupyter dependencies are not installed. You can fix this by running ``pip install black[jupyter]`` reformatted tools/schemacode/bidsschematools/tests/test_rules.py reformatted tools/schemacode/bidsschematools/tests/test_render.py reformatted tools/schemacode/bidsschematools/utils.py reformatted tools/schemacode/bidsschematools/schema.py reformatted tools/schemacode/bidsschematools/tests/test_validator.py reformatted tools/schemacode/bidsschematools/render.py reformatted tools/schemacode/bidsschematools/validator.pyAll done! ✨ 🍰 ✨ === Do not change lines below ===
reformatted tools/schemacode/bidsschematools/tests/test_rules.py All done! ✨ 🍰 ✨ flake8...................................................................Passed
|
@tsalo Now the filename templates include ALL datatypes everytime and the legend is rendered as codeblock. I must be missing something obvious but I can't see what. |
hum this seems to actually already be the case in the live latest version: |
EDIT: My first guess is that the |
I think I have the problem pinned down, but I don't have a solution yet. The problem is that bids-specification/tools/schemacode/bidsschematools/schema.py Lines 260 to 279 in d849c40
The next problem is that Namespace objects do not support item assignment, and |
Thanks for looking into this. Should we add a test to catch this in ci rather than having to manually check the rendering? Also because running mkdocs serves takes "ages" to run locally which does not incentive to check. |
Chris had some ideas for fixing the filter that we talked about briefly on Zoom. I'll be trying them out once I finish up with a call I'm on.
We do have #788 that seems similar, but I never figured out how to actually implement it. Otherwise, I think we'll need to write unit tests for the rendering functions. I think Horea added some, but they must not be strict enough to catch this new problem. |
I'll try to make a quick fix. |
See #1223 |
Co-authored-by: Chris Markiewicz <[email protected]>
I may have a look into this see if I can think of something. Don't hold your breath. |
Co-authored-by: Chris Markiewicz <[email protected]>
PDF and HTML now look good to me. |
1e34204
to
ec9e7d8
Compare
- repo: https://github.com/asottile/reorder_python_imports | ||
rev: "v3.8.2" | ||
hooks: | ||
- id: reorder-python-imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you prefer this over the more standard isort
?
# this config is mostly there to help with the use of pre-commit | ||
max-line-length = 110 | ||
ignore = E203,E402,E722,W503,F841 | ||
docstring-convention = numpy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for this to work we would need https://pypi.org/project/flake8-docstrings/ ... correct?
We could add it to requirements.txt
and then also add it to the pre-commit hook like here: https://github.com/sappelhoff/pyprep/blob/25b91e098d0055f14b5cbcae54b5ee9e0739aa62/.pre-commit-config.yaml#L27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum...
I have been "wasting" some time because the linting rules of precommit and those of the ci the bidsschematools clashed, so more than happy to try to make them agree.
However I know hate this PR because it does too. Many. Things.
So I will remove all changes that are not related to the title of this PR and put them in a different one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also fine with me to merge this as is and then iterate, no worries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup.cfg
is really meant for Python packages, which this isn't. If we're going to have it at the root, I would rather call it .flake8
. See https://flake8.pycqa.org/en/latest/user/configuration.html
Yeah but it bothers me. So expect a force push. |
OK I changed my mind: no force push. With several merge of master into this, reset and sorting what belongs to this PR or to another is going to be a pain. So I would prefer merging and fix the pre-commit config in another PR. (pragmatism beats clean commit history on this one) |
yes 👍 especially because we can squash and merge it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify - are you ready to have this merged @Remi-Gau ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. I'm happy with this as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I'm finding this hard to review because of bundling process changes with semantic changes. I made a couple small comments regarding the render, which seems fine, and the contributing guide. If everything else is just process, that's fine.
@@ -4,4 +4,4 @@ pymdown-extensions>=7.0.0 | |||
mkdocs-branchcustomization-plugin~=0.1.3 | |||
mkdocs-macros-plugin | |||
numpy | |||
tools/schemacode/[render] | |||
-e tools/schemacode/[render] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I suggested this, but I disagree now. This is part of the build process in RTD, and we shouldn't rely on -e
.
-e tools/schemacode/[render] | |
tools/schemacode/[render] |
@@ -302,7 +302,6 @@ is to use the `requirements.txt` file contained in this repository as follows: | |||
```bash | |||
pip install -U pip | |||
pip install -r requirements.txt | |||
pip install -e tools/schemacode/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this should be restored.
@@ -24,11 +23,12 @@ | |||
|
|||
def run_shell_cmd(command): | |||
"""Run shell/bash commands passed as a string using subprocess module.""" | |||
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE, | |||
stderr=subprocess.PIPE) | |||
process = subprocess.Popen( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there changes in this file? Style rerender?
# this config is mostly there to help with the use of pre-commit | ||
max-line-length = 110 | ||
ignore = E203,E402,E722,W503,F841 | ||
docstring-convention = numpy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup.cfg
is really meant for Python packages, which this isn't. If we're going to have it at the root, I would rather call it .flake8
. See https://flake8.pycqa.org/en/latest/user/configuration.html
@effigies |
Co-authored-by: Chris Markiewicz <[email protected]>
Co-authored-by: Stefan Appelhoff <[email protected]>
Co-authored-by: Chris Markiewicz <[email protected]>
Sorry, I hate to be annoying, but I really would prefer to keep these things separate. If it would save you trouble, I'd be happy to unsentimentally squash what I think are the relevant changes into a single commit with you as author, and you can just review that. |
No worries. I was getting annoyed at how this PR was started to mix things that were unrelated but I think I gave up too quickly to sort it. Will close and open separate PRs. |
closes #1198
fixes #1220
unrelated