-
Notifications
You must be signed in to change notification settings - Fork 0
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
Pre commit additions #3
base: main
Are you sure you want to change the base?
Conversation
Currently setting up some GitHub workflows. Im assuming there's no need for it, but making a note here that it would be straight-forward to add something like
to auto reply this to docker hub - if we ever wanted to move to azure or similar then this would make deployment even easier. Though I don't understand enough about security concerns behind this repo |
todo:
|
Updating to say coverage.py isn't really needed, now are the R features given how this repo is setup. |
@HChughtai I just pushed some documentation and docker file changes. I think given what we discussed last week and the complications about making usage assumptions (pre-installing pre-commit to clear jupyter cells etc) that this is some reasonable changes that could be folded back to main. |
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.
Hi @AoifeHughes - the addition of pre-commit and changes to the Dockerfile broadly look good to me. I've made some suggestions on updating dependencies and some specific pre-commit hooks. Some of these may be more personal preferences, so feel free to ignore!
There also looks to be a merge conflict to resolve, and I'd recommend ensuring running pre-commit passess locally on all files in the branch too before merging (I got some alerts about secrets detected in users/sample-user.env
so they may need to be ignored)
(I also noticed that when I try to run some of the scripts that the execution bit isn't set, so that might also be a good addition to the pre-commit checks)
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 |
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.
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v4 |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 |
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.
- uses: actions/setup-python@v4 | |
- uses: actions/setup-python@v5 |
pip install pre-commit | ||
- name: Run pre-commit | ||
run: | | ||
pre-commit run --all-files |
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.
pre-commit run --all-files | |
pre-commit run --all-files --color always --verbose |
Suggesting this so that debugging is a bit easier. You might also want to consider caching pre-commit using https://github.com/marketplace/actions/cache to speed things up.
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'd suggest updating the versions of the repos here to the latest. It might also be worth considering setting up Dependabot or another automated dependency update tool to help, but I think that's out of scope of this PR and could be considered seperatly
- repo: https://github.com/psf/black | ||
rev: 22.8.0 | ||
hooks: | ||
- id: black | ||
name: black - consistent Python code formatting (auto-fixes) | ||
language_version: python | ||
exclude: test_example_module.py|run_pipeline.py | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 5.0.4 | ||
hooks: | ||
- id: flake8 | ||
name: flake8 - Python linting | ||
exclude: test_example_module.py|run_pipeline.py |
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.
You might want to consider using https://github.com/astral-sh/ruff-pre-commit instead as it's gaining popularity in the Python community and is faster
- repo: https://github.com/nbQA-dev/nbQA | ||
rev: 1.5.3 | ||
hooks: | ||
- id: nbqa-black | ||
name: nbqa-black - Format Jupyter Notebooks with black | ||
additional_dependencies: [ black==22.8.0 ] | ||
- id: nbqa-isort | ||
name: nbqa-isort - Sort imports in Jupyter Notebooks with isort | ||
additional_dependencies: [ isort==5.12.0 ] |
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.
https://github.com/astral-sh/ruff-pre-commit can also run on Jupyter notebooks too but I haven't used it there so I can't comment on how it performs vs nbQA
This project is based on Jon Ghillam's repository. https://github.com/space-safety/jupyter/ | ||
This project is based on Jon Ghillam's repository: [space-safety/jupyter](https://github.com/space-safety/jupyter/). | ||
|
||
## Getting Started |
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 might be worth including a bit on how the different scripts under scripts
are used to create the image, and document that the configs under users
are Docker Compose yaml as it could help people new to the repo figure things out - again, just a suggestion and could be out of scope here.
RUN wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.4.543/quarto-1.4.543-linux-amd64.deb && \ | ||
rm -f ./google-chrome-stable_current_amd64.deb && \ | ||
wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.4.543/quarto-1.4.543-linux-amd64.deb && \ | ||
apt-get install --yes --no-install-recommends ./quarto-1.4.543-linux-amd64.deb && \ | ||
rm -f ./quarto-1.4.543-linux-amd64.deb |
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.
Thinking out loud, and again maybe out of scope for this PR - would it be useful to set the version number of Quarto elsewhere as a variable so that it can be easily updated in a single place?
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 outside your PR, but I'm also wondering if the base image here needs to be updated?
Moving this PR to here