Skip to content

feat(release): create v4.1.0 from mlops-python-package#2

Merged
fmind merged 1 commit intomainfrom
v4.1.0
Mar 6, 2025
Merged

feat(release): create v4.1.0 from mlops-python-package#2
fmind merged 1 commit intomainfrom
v4.1.0

Conversation

@fmind
Copy link
Owner

@fmind fmind commented Mar 6, 2025

No description provided.

@fmind fmind added the enhancement New feature or request label Mar 6, 2025
@fmind fmind self-assigned this Mar 6, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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, and urllib3. These updates bring in bug fixes, performance improvements, and new features.
  • Migration to just: The project has migrated from invoke to just for task management. This change involves replacing tasks.py with justfile and updating the command invocations in tests/test_cookiecutter.py and README.md.
  • GitHub Rulesets: The pull request introduces GitHub rulesets for branch protection, enhancing the security and stability of the main branch. These rulesets enforce linear history, require status checks, and restrict merge methods.
  • uv and just Integration: The template now uses uv and just more 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-uv action from v4 to v5.
  • .pre-commit-config.yaml
    • Updated default Python version to 3.13.
    • Upgraded ruff-pre-commit rev to 'v0.9.9'.
    • Added bandit hook 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 invoke commands with uv run just commands in the example usage section.
  • cookiecutter-mlops-package.code-workspace
    • Removed the dchanco.vsc-invoke extension recommendation.
  • cookiecutter.json
    • Updated default Python version to 3.13.
    • Updated default MLflow version to 2.20.3.
  • invoke.yaml
    • Removed the invoke.yaml file.
  • justfile
    • Added a justfile to define project tasks using the just task runner.
  • pyproject.toml
    • Updated project version to 4.1.0.
    • Updated requires-python to '>=3.13'.
    • Removed invoke from dev dependencies.
    • Added rust-just to dev dependencies.
    • Renamed checks dependency group to check.
    • Renamed commits dependency group to commit.
    • Renamed docs dependency group to doc.
    • Renamed notebooks dependency group to notebook.
  • tasks.py
    • Removed the tasks.py file.
  • tests/test_cookiecutter.py
    • Replaced invoke commands with uv run just commands in the test suite.
    • Updated the default Python and MLflow versions in the test context.
  • uv.lock
    • Updated numerous package versions and hashes in the uv.lock file to reflect the dependency updates.
  • {{cookiecutter.repository}}/.github/actions/setup/action.yml
    • Upgraded astral-sh/setup-uv action from v4 to v5.
  • {{cookiecutter.repository}}/.github/rulesets/main.json
    • Added a new file to define GitHub rulesets for branch protection.
  • {{cookiecutter.repository}}/.github/workflows/check.yml
    • Replaced invoke commands with uv run just commands in the check workflow.
    • Renamed checks group to check.
  • {{cookiecutter.repository}}/.github/workflows/publish.yml
    • Updated the DOCKER_IMAGE environment variable.
    • Replaced invoke commands with uv run just commands in the publish workflow.
    • Renamed docs group to doc.
  • {{cookiecutter.repository}}/.pre-commit-config.yaml
    • Updated default Python version to 3.13.
    • Upgraded ruff-pre-commit rev to 'v0.9.9'.
    • Added bandit hook for security checks.
  • {{cookiecutter.repository}}/justfile
    • Added a justfile to define project tasks using the just task runner.
  • {{cookiecutter.repository}}/pyproject.toml
    • Updated project version to 4.1.0.
    • Updated requires-python to '>=3.13'.
    • Removed invoke from dev dependencies.
    • Added rust-just to dev dependencies.
    • Renamed checks dependency group to check.
    • Renamed commits dependency group to commit.
    • Renamed docs dependency group to doc.
    • Renamed notebooks dependency group to notebook.
  • {{cookiecutter.repository}}/tasks/init.py
    • Removed the tasks/__init__.py file.
  • {{cookiecutter.repository}}/tasks/check.just
    • Added a check.just file to define check tasks using the just task runner.
  • {{cookiecutter.repository}}/tasks/checks.py
    • Removed the tasks/checks.py file.
  • {{cookiecutter.repository}}/tasks/commit.just
    • Added a commit.just file to define commit tasks using the just task runner.
  • {{cookiecutter.repository}}/tasks/commits.py
    • Removed the tasks/commits.py file.
  • {{cookiecutter.repository}}/tasks/containers.py
    • Removed the tasks/containers.py file.
  • {{cookiecutter.repository}}/tasks/doc.just
    • Added a doc.just file to define doc tasks using the just task runner.
  • {{cookiecutter.repository}}/tasks/docker.just
    • Added a docker.just file to define docker tasks using the just task runner.
  • {{cookiecutter.repository}}/tasks/docs.py
    • Removed the tasks/docs.py file.
  • {{cookiecutter.repository}}/tasks/format.just
    • Added a format.just file to define format tasks using the just task runner.
  • {{cookiecutter.repository}}/tasks/formats.py
    • Removed the tasks/formats.py file.
  • {{cookiecutter.repository}}/tasks/install.just
    • Added a install.just file to define install tasks using the just task runner.
  • {{cookiecutter.repository}}/tasks/installs.py
    • Removed the tasks/installs.py file.
  • {{cookiecutter.repository}}/tasks/mlflow.just
    • Added a mlflow.just file to define mlflow tasks using the just task runner.
  • {{cookiecutter.repository}}/tasks/mlflow.py
    • Removed the tasks/mlflow.py file.
  • {{cookiecutter.repository}}/tasks/package.just
    • Added a package.just file to define package tasks using the just task runner.
  • {{cookiecutter.repository}}/tasks/packages.py
    • Removed the tasks/packages.py file.
  • {{cookiecutter.repository}}/tasks/project.just
    • Added a project.just file to define project tasks using the just task runner.
  • {{cookiecutter.repository}}/tasks/projects.py
    • Removed the tasks/projects.py file.
  • {{cookiecutter.repository}}/{{cookiecutter.repository}}.code-workspace
    • Removed the dchanco.vsc-invoke extension recommendation.
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

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.lock and pyproject.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.yaml and tasks.py, and adding justfile and 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

Choose a reason for hiding this comment

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

high

The DOCKER_IMAGE is hardcoded to ghcr.io/fmind/mlops-python-package. This should be parameterized to use the {{cookiecutter.user}} and {{cookiecutter.repository}} variables.

DOCKER_IMAGE: ghcr.io/{{cookiecutter.user}}/{{cookiecutter.repository}}

uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
uses: astral-sh/setup-uv@v5

Choose a reason for hiding this comment

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

medium

Consider using a more specific version pin for the astral-sh/setup-uv action to avoid unexpected breakages due to future updates.

uses: astral-sh/setup-uv@v5.0.0

Comment on lines +37 to +45
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",

Choose a reason for hiding this comment

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

medium

Consider using more specific version pins for the dependencies in the check group to avoid unexpected breakages due to future updates.

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",
    "ruff==0.9.9",
]

Comment on lines +17 to +24
[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"

Choose a reason for hiding this comment

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

medium

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

@fmind fmind merged commit b930d91 into main Mar 6, 2025
1 check passed
irod973 added a commit to irod973/python-project-template that referenced this pull request Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant