-
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
feat: add Python CI #2
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request introduces a comprehensive set of Python CI workflows and actions, focusing on setting up the environment, running various code quality checks, tests, and publishing to PyPI. The changes are implemented by adding multiple YAML configuration files for different GitHub Actions, utilizing the Poetry package manager for Python dependency management. File-Level Changes
Tips
|
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.
Hey @JaeAeich - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider pinning the external action to a specific version or commit hash instead of using
@main
to ensure stability and avoid unexpected changes. - Enhance the pull request description to provide more context and details about the changes and their purpose.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
.yamllint
Outdated
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.
TODO: remove before merge and add this as another PR.
@sourcery-ai review |
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.
Hey @JaeAeich - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟡 Security: 1 issue found
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
- name: Compare current docs with latest docs | ||
shell: bash | ||
run: | | ||
shasum /tmp/docs/source/pages/* > /tmp/docs.sha |
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.
suggestion: Using shasum for doc comparison may be overly sensitive
Consider using a more robust method for comparing documentation that isn't as sensitive to minor formatting changes.
diff -rq /tmp/docs/source/pages/ ${{ inputs.auto_doc_dir }}/ | grep -v "Only in" > /tmp/docs_diff.txt
if [ -s /tmp/docs_diff.txt ]; then
echo "Differences found in documentation:"
cat /tmp/docs_diff.txt
else
echo "No significant differences found in documentation."
fi
file_path: | ||
description: File path for which the docs will be generated | ||
required: true |
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.
TODO: Make this an optional fields too, grep and awk name of the project from pyproject and search if that dir exists, if so take that as file_path otherwise check if user has provided a file_path, else err.
We should aim to make all the fields non required, or atleast the input should not depend on project, ie codecov_token will be secret.CODECOV_TOKEN regardless of the project hence this will be easier to template. Essentially if we can ideally make all the deafults such that their is no values passed that are related to project, we can template all the CI work in one single repo.
TODO: Remember to add below code in example ci, below code stops previously running ci if a new commit is pushed, saving ci time. concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true |
@uniqueg Im testing this CI on my private repo, and another good feature that I think would be nice to implement would be to add debug steps for CI. So basically for each CI that fails, comment on the PR, what went wrong or, how to improve it, or who to tag and ask for help. Check out this example. I propose, for each CI we document the most common way to fix it. Lets say the format CI fails, the bot will comment, please run Then we also let the PR creator know who to tag, this we fetch from a list of mainteiners from somewhere (a gitst perhaphs), this way we can have updated list of maintainer for a particular language or porject, maybe, lets say I have a gist uniqueg I provide gist link to the actions, and it fetches, does data sanitisation, and suggest the PR creator to tag the mainter if in need. Thoughts?? PS: Yess Im testing on windows as well, imma make it compatible even if we don;t use it. |
Hi @JaeAeich - this sounds all great. However, let's keep incremental improvements. Long PRs always take long to get over the line. Let's see that we merge this one soon - I don't think it depends on this idea. |
@uniqueg, yeah makes sense, I've some more improvements but I'll have a safe point here. The commenting func is done, some other things mentioned aren't. Please go through the PR, I have some more changes but those probably won't require reviews. I would prefer to merge this pr first so I can use python does using poetry action in common and rust ci. |
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 have already looked at these and they look good to me, so I'm okay with merging. It's a bit hard to review these and spot mistakes are sth, so I guess we'll have to see how they perform in the wild - and if they're issues, we can address them.
@uniqueg There are a couple of changes that need to be made, pretty easy, but would be good feat and need discussion so mentioning them. The current poetry action that we have assumes that it is running on a proj with poetry stack or atleast pyporject.toml, but I wanna extend it to also take in only list of deps, why? so that we are able to use its caching feat for different env where we need python deps, eg rust project, or py project that doesn;t have pyproject. - name: Set up environment
uses: ./.github/actions/setup/poetry
with:
os: ${{ job.os }}
python-version: '3.11'
poetry-install-options: "--with=test" # Defines the group to install, using poetry's api, eg with mean install main as
# well as test.
poetry-export-options: "--with=test" # Defines which group to look at for cache invalidation via poetry's api, why
# a separate arg, one of the reason is because sometimes we don;t care if the main deps have changes as the
# other group mainly focuses on if or not cache should be invalidated. Ill probably add an extra arg callled deps, but since I haven't tested this I would wait before merge, and also I saw some minor issues in logs while testing this so I need to get that too. // thoughts? For the time being if oyu can, please go through the comments for each action, is there a specific way you'd like the commetns to be? Those are all obv scrath and rough commetns. If you can give me one good comment (basically set the standards) for any action, I think I can make the rest. |
I have made changes to poetry setupr and also tested it. |
Add python ci
Summary by Sourcery
Introduce multiple CI workflows for Python projects, including setup, testing, code quality checks, vulnerability assessments, and package publishing to PyPI. These workflows utilize Poetry for dependency management and caching, and integrate tools like Bandit, mypy, ruff, and typos for various checks.
CI: