Conversation
There was a problem hiding this comment.
Hello @fmind, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request upgrades the cookiecutter-mlops-package template to version 4.1.0. The primary changes include updating the Python version to 3.13, upgrading various dependencies, migrating from invoke to just for task management, and incorporating GitHub rulesets for branch protection. The template now leverages uv and just more extensively for improved dependency management and task execution.
Highlights
- Python Version Upgrade: The template now uses Python 3.13 as the default Python version, ensuring compatibility with the latest language features and improvements.
- Dependency Updates: Several dependencies have been updated, including
commitizen,certifi,charset-normalizer,click,filelock,identify,jinja2,pre-commit,prompt-toolkit,psutil,pytest,ruff, andurllib3. These updates bring in bug fixes, performance improvements, and new features. - Migration to
just: The project has migrated frominvoketojustfor task management. This change involves replacingtasks.pywithjustfileand updating the command invocations intests/test_cookiecutter.pyandREADME.md. - GitHub Rulesets: The pull request introduces GitHub rulesets for branch protection, enhancing the security and stability of the
mainbranch. These rulesets enforce linear history, require status checks, and restrict merge methods. - uv and just Integration: The template now uses
uvandjustmore extensively for dependency management and task execution, streamlining the development workflow.
Changelog
Click here to see the changelog
- .github/workflows/tests.yml
- Upgraded
astral-sh/setup-uvaction from v4 to v5.
- Upgraded
- .pre-commit-config.yaml
- Updated default Python version to 3.13.
- Upgraded
ruff-pre-commitrev to 'v0.9.9'. - Added
bandithook for security checks.
- .python-version
- Updated Python version to 3.13.
- CHANGELOG.md
- Removed the entire changelog file.
- README.md
- Added a link to an external article about reusable components for flexible MLOps.
- Updated the default Python and MLflow versions in the prompts.
- Replaced
invokecommands withuv run justcommands in the example usage section.
- cookiecutter-mlops-package.code-workspace
- Removed the
dchanco.vsc-invokeextension recommendation.
- Removed the
- cookiecutter.json
- Updated default Python version to 3.13.
- Updated default MLflow version to 2.20.3.
- invoke.yaml
- Removed the
invoke.yamlfile.
- Removed the
- justfile
- Added a
justfileto define project tasks using thejusttask runner.
- Added a
- pyproject.toml
- Updated project version to 4.1.0.
- Updated
requires-pythonto '>=3.13'. - Removed
invokefromdevdependencies. - Added
rust-justtodevdependencies. - Renamed
checksdependency group tocheck. - Renamed
commitsdependency group tocommit. - Renamed
docsdependency group todoc. - Renamed
notebooksdependency group tonotebook.
- tasks.py
- Removed the
tasks.pyfile.
- Removed the
- tests/test_cookiecutter.py
- Replaced
invokecommands withuv run justcommands in the test suite. - Updated the default Python and MLflow versions in the test context.
- Replaced
- uv.lock
- Updated numerous package versions and hashes in the
uv.lockfile to reflect the dependency updates.
- Updated numerous package versions and hashes in the
- {{cookiecutter.repository}}/.github/actions/setup/action.yml
- Upgraded
astral-sh/setup-uvaction from v4 to v5.
- Upgraded
- {{cookiecutter.repository}}/.github/rulesets/main.json
- Added a new file to define GitHub rulesets for branch protection.
- {{cookiecutter.repository}}/.github/workflows/check.yml
- Replaced
invokecommands withuv run justcommands in the check workflow. - Renamed
checksgroup tocheck.
- Replaced
- {{cookiecutter.repository}}/.github/workflows/publish.yml
- Updated the
DOCKER_IMAGEenvironment variable. - Replaced
invokecommands withuv run justcommands in the publish workflow. - Renamed
docsgroup todoc.
- Updated the
- {{cookiecutter.repository}}/.pre-commit-config.yaml
- Updated default Python version to 3.13.
- Upgraded
ruff-pre-commitrev to 'v0.9.9'. - Added
bandithook for security checks.
- {{cookiecutter.repository}}/justfile
- Added a
justfileto define project tasks using thejusttask runner.
- Added a
- {{cookiecutter.repository}}/pyproject.toml
- Updated project version to 4.1.0.
- Updated
requires-pythonto '>=3.13'. - Removed
invokefromdevdependencies. - Added
rust-justtodevdependencies. - Renamed
checksdependency group tocheck. - Renamed
commitsdependency group tocommit. - Renamed
docsdependency group todoc. - Renamed
notebooksdependency group tonotebook.
- {{cookiecutter.repository}}/tasks/init.py
- Removed the
tasks/__init__.pyfile.
- Removed the
- {{cookiecutter.repository}}/tasks/check.just
- Added a
check.justfile to define check tasks using thejusttask runner.
- Added a
- {{cookiecutter.repository}}/tasks/checks.py
- Removed the
tasks/checks.pyfile.
- Removed the
- {{cookiecutter.repository}}/tasks/commit.just
- Added a
commit.justfile to define commit tasks using thejusttask runner.
- Added a
- {{cookiecutter.repository}}/tasks/commits.py
- Removed the
tasks/commits.pyfile.
- Removed the
- {{cookiecutter.repository}}/tasks/containers.py
- Removed the
tasks/containers.pyfile.
- Removed the
- {{cookiecutter.repository}}/tasks/doc.just
- Added a
doc.justfile to define doc tasks using thejusttask runner.
- Added a
- {{cookiecutter.repository}}/tasks/docker.just
- Added a
docker.justfile to define docker tasks using thejusttask runner.
- Added a
- {{cookiecutter.repository}}/tasks/docs.py
- Removed the
tasks/docs.pyfile.
- Removed the
- {{cookiecutter.repository}}/tasks/format.just
- Added a
format.justfile to define format tasks using thejusttask runner.
- Added a
- {{cookiecutter.repository}}/tasks/formats.py
- Removed the
tasks/formats.pyfile.
- Removed the
- {{cookiecutter.repository}}/tasks/install.just
- Added a
install.justfile to define install tasks using thejusttask runner.
- Added a
- {{cookiecutter.repository}}/tasks/installs.py
- Removed the
tasks/installs.pyfile.
- Removed the
- {{cookiecutter.repository}}/tasks/mlflow.just
- Added a
mlflow.justfile to define mlflow tasks using thejusttask runner.
- Added a
- {{cookiecutter.repository}}/tasks/mlflow.py
- Removed the
tasks/mlflow.pyfile.
- Removed the
- {{cookiecutter.repository}}/tasks/package.just
- Added a
package.justfile to define package tasks using thejusttask runner.
- Added a
- {{cookiecutter.repository}}/tasks/packages.py
- Removed the
tasks/packages.pyfile.
- Removed the
- {{cookiecutter.repository}}/tasks/project.just
- Added a
project.justfile to define project tasks using thejusttask runner.
- Added a
- {{cookiecutter.repository}}/tasks/projects.py
- Removed the
tasks/projects.pyfile.
- Removed the
- {{cookiecutter.repository}}/{{cookiecutter.repository}}.code-workspace
- Removed the
dchanco.vsc-invokeextension recommendation.
- Removed the
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
From Invoke's realm, to Just we stride,
Tasks defined, with Rust as guide.
Python's version, a number new,
Dependencies updated, tried and true.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request updates the project to use Python 3.13, updates dependencies, and migrates from Invoke to Just for task management. The changes look good overall, but there are a few areas that could be improved.
Summary of Findings
- Dependency Updates: Several dependencies have been updated in
uv.lockandpyproject.toml. It's important to ensure that these updates don't introduce any compatibility issues or break existing functionality. - Migration from Invoke to Just: The project has migrated from Invoke to Just for task management. This involves removing
invoke.yamlandtasks.py, and addingjustfileand task-specific Justfiles. Ensure that all Invoke tasks have been correctly migrated to Just. - GitHub Actions Workflow Updates: The GitHub Actions workflows have been updated to use the new Just commands. Verify that these changes are correct and that the workflows are functioning as expected.
- Pre-commit Hook Updates: The pre-commit hooks have been updated to use Ruff and Bandit. Confirm that these hooks are configured correctly and that they are running as expected.
Merge Readiness
The pull request is almost ready for merging. Before merging, it's crucial to verify that all dependencies are compatible, that all Invoke tasks have been correctly migrated to Just, and that the GitHub Actions workflows are functioning as expected. I am unable to directly approve this pull request, and users should have others review and approve this code before merging. After addressing the comments below, the pull request should be in good shape to be merged.
| - published | ||
| env: | ||
| DOCKER_IMAGE: ghcr.io/{{cookiecutter.user}}/{{cookiecutter.repository}} | ||
| DOCKER_IMAGE: ghcr.io/fmind/mlops-python-package |
| uses: actions/checkout@v4 | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v4 | ||
| uses: astral-sh/setup-uv@v5 |
| check = [ | ||
| "bandit>=1.8.3", | ||
| "coverage>=7.6.12", | ||
| "mypy>=1.15.0", | ||
| "pytest>=8.3.5", | ||
| "pytest-cov>=6.0.0", | ||
| "pytest-mock>=3.14.0", | ||
| "pytest-xdist>=3.6.1", | ||
| "pytest>=8.3.3", | ||
| "ruff>=0.8.1", | ||
| "ruff>=0.9.9", |
There was a problem hiding this comment.
| [group('install')] | ||
| install-rulesets: | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| repo=$(gh repo view --json=name --jq=.name) | ||
| owner=$(gh repo view --json=owner --jq=.owner.login) | ||
| gh api --method POST -H "Accept: application/vnd.github+json" \ | ||
| "/repos/$owner/$repo/rulesets" --input=".github/rulesets/main.json" |
There was a problem hiding this comment.
The install-rulesets task uses gh api to apply the ruleset. Ensure that the GitHub Actions workflow has the necessary permissions to perform this action. Also, consider adding error handling to the script to gracefully handle cases where the API call fails.
#!/usr/bin/env bash
set -euo pipefail
repo=$(gh repo view --json=name --jq=.name)
owner=$(gh repo view --json=owner --jq=.owner.login)
if ! gh api --method POST -H "Accept: application/vnd.github+json" \
"/repos/$owner/$repo/rulesets" --input=".github/rulesets/main.json"; then
echo "Failed to apply ruleset" >&2
exit 1
fi
No description provided.