Skip to content
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: Use Pixi, pyradiomics fork #40

Merged
merged 4 commits into from
Oct 22, 2024
Merged

feat: Use Pixi, pyradiomics fork #40

merged 4 commits into from
Oct 22, 2024

Conversation

jjjermiah
Copy link
Contributor

@jjjermiah jjjermiah commented Oct 21, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new CI/CD workflow for improved automation of integration and deployment processes.
    • Added support for multiple Python environments and operating systems in testing.
    • Implemented a new package management system using Pixi.
  • Bug Fixes

    • Updated the workflow to ensure successful execution of jobs based on prior job completions.
  • Documentation

    • Enhanced .gitignore to exclude additional files and directories.
  • Refactor

    • Restructured pyproject.toml to transition from Poetry to Pixi, improving modularity and task management.
  • Chores

    • Added configuration files for coverage and linting to streamline development processes.

@jjjermiah jjjermiah changed the title Jjjermiah/add pixi feat: Use Pixi, pyradiomics fork Oct 21, 2024
@jjjermiah jjjermiah marked this pull request as ready for review October 21, 2024 20:16
Copy link
Contributor

coderabbitai bot commented Oct 21, 2024

Walkthrough

The changes involve a comprehensive update to the CI/CD workflow, transitioning from a Poetry-based to a Pixi-based configuration. The workflow now includes expanded triggers, matrix strategies for testing across multiple environments, and a focus on using Pixi for dependency management. Several jobs have been restructured or commented out, reflecting a shift in the build and release process. Additionally, new configuration files for linting and coverage have been introduced, and the .gitignore file has been updated to exclude specific files and directories.

Changes

File Change Summary
.github/workflows/ci-cd.yml Updated workflow name, expanded triggers, restructured jobs using matrix strategy, replaced Poetry with Pixi, commented out old jobs.
.github/workflows/ci-cd.yml.disabled New CI/CD workflow with jobs for Unit-Testing, Continuous-Deployment, Publish-To-PyPI, and Build-Docker-Images.
.gitignore Added entries for .pixi, *.egg-info, and .old; confirmed ignoring tests/output/*.
config/coverage.toml Added sections [tool.coverage.run] and [tool.coverage.report] with placeholders.
config/hatch.toml Introduced [build] section specifying output directory and wheel package target.
config/ruff.toml New configuration for the Ruff linter with settings for linting, formatting, and exclusions.
old_pyproject.toml New pyproject.toml for the readii package with metadata, dependencies, and semantic release settings.
pyproject.toml Transitioned to Pixi configuration, updated dependencies, added environment management, and restructured tasks.

Poem

In the garden where changes bloom,
Pixi hops in, dispelling gloom.
CI/CD dances, swift and bright,
With tests that run from day to night.
Old jobs tucked away with care,
New paths ahead, let’s hop and share! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jjjermiah jjjermiah requested a review from strixy16 October 21, 2024 20:21
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Outside diff range and nitpick comments (11)
config/hatch.toml (1)

1-5: Overall, the Hatch configuration looks good.

This new hatch.toml file establishes a clear build configuration for the project, which is crucial for the transition to a Pixi-based setup. It defines the build output directory and specifies the package to be included in the wheel. These changes should improve the project's build process and align it with modern Python project management practices.

However, please ensure that the relative path "../src/readii" is correct in relation to where this config file is located in the project structure. If the path is incorrect, it could lead to build failures.

Consider placing this configuration file in the project root to avoid potential path-related issues and to make the configuration more intuitive for other developers.

config/ruff.toml (2)

20-40: Comprehensive lint selection, but consider allowing removal of commented-out code.

The selection of linting rules is thorough and covers various aspects of code quality, which is excellent. The decision to ignore "ANN101" (missing type annotation for self in method) is a common and acceptable practice.

However, preventing the automatic removal of commented-out code (ERA rules set as unfixable) might hinder code cleanliness in the long run. Commented-out code often becomes outdated and irrelevant over time.

Consider removing the ERA rule from the unfixable list to allow automatic cleanup of commented-out code:

 unfixable = [
-  "ERA", # Don't remove commented-out code
 ]

If you decide to keep this setting, it's recommended to periodically review and clean up commented-out code manually to maintain code quality.


59-66: Good docstring and formatting choices, but consider adjusting docstring code line length.

The configuration makes good choices for docstring convention and string quoting:

  • Using the Google convention for docstrings promotes consistency and readability.
  • Preferring single quotes for strings is a common stylistic choice in Python.

However, the docstring code line length of 20 characters seems overly restrictive and might lead to excessive line breaks in code examples within docstrings.

Consider increasing the docstring code line length to a more comfortable value, perhaps matching or slightly less than the main line length:

 [format]
 quote-style = "single"
 docstring-code-format = true
-docstring-code-line-length = 20
+docstring-code-line-length = 88  # or another value that suits your project
old_pyproject.toml (2)

20-30: LGTM: Comprehensive development dependencies.

The development dependencies cover essential areas including testing, documentation, and release management. The version constraints are appropriately set to allow for compatible updates.

For consistency, consider adding Python version constraints to other dependencies that might have specific Python version requirements, similar to the myst-nb dependency.


32-42: Semantic release configuration looks good, with a note on patch releases.

The semantic release configuration is well-structured and covers essential aspects of versioning and release management.

The patch_without_tag = true setting allows for patch releases without requiring a tag. While this can be convenient, it might lead to unexpected version bumps. Consider if this aligns with your versioning strategy and team workflows.

pyproject.toml (3)

41-66: LGTM: Comprehensive test configuration with a suggestion.

The test configuration is well-defined, including dependencies, pytest setup with coverage reporting, and a separate coverage task. This is a good setup for maintaining code quality.

Consider adding a minimum coverage threshold to ensure code quality standards are maintained. You can add this to your pytest command:

  "pytest",
  "--numprocesses=auto",
  "-s",
  "--verbose",
  "--cov=readii",
  "--cov-report=xml:coverage-report/coverage.xml",
  "--cov-config=config/coverage.toml",
+ "--cov-fail-under=80",

This will cause the tests to fail if coverage falls below 80% (adjust the percentage as needed).


68-85: TODO: Implement documentation and style check tasks.

While the dependencies for documentation and style checking are correctly specified, the tasks for building documentation and running style checks are missing. These tasks are crucial for maintaining code quality and up-to-date documentation.

Would you like assistance in implementing these tasks? Here's a suggested implementation for the style check task:

[tool.pixi.feature.style.tasks.lint]
cmd = "ruff check src tests"
inputs = ["src", "tests", "config/ruff.toml"]
description = "Run ruff linter"

[tool.pixi.feature.style.tasks.format]
cmd = "ruff format src tests"
inputs = ["src", "tests", "config/ruff.toml"]
description = "Run ruff formatter"

For the documentation build task:

[tool.pixi.feature.docs.tasks.build-docs]
cmd = "sphinx-build -b html docs/source docs/build"
inputs = ["docs/source", "src"]
outputs = ["docs/build"]
description = "Build documentation using Sphinx"

Let me know if you'd like me to implement these tasks or if you need any modifications.


Line range hint 119-129: Consider refining the branch matching pattern for semantic release.

The semantic release configuration looks good overall, but the branches.main.match setting might be too permissive:

[tool.semantic_release.branches.main]
match = "*"

This could potentially trigger releases on unintended branches.

Consider using a more specific pattern to match only the main branch and potentially release branches. For example:

[tool.semantic_release.branches.main]
match = "^main$"
prerelease = false

[tool.semantic_release.branches.release]
match = "^release/"
prerelease = true

This configuration ensures that releases are only triggered on the main branch and release branches, providing better control over the release process.

.github/workflows/ci-cd.yml (2)

13-45: Approve Unit-Tests job with a suggestion.

The Unit-Tests job has been significantly improved:

  1. Matrix strategy for multiple OS and Python versions enhances test coverage.
  2. Transition to Pixi aligns with the PR objectives.

However, consider the following suggestion:

The 15-minute timeout (line 18) might be too short for complex test suites. Consider increasing it to 30 minutes to prevent premature job termination:

-    timeout-minutes: 15 # Consider increasing timeout
+    timeout-minutes: 30

97-147: Fix minor formatting issues.

The static analysis tool reported some minor formatting issues:

  1. Trailing spaces on lines 97, 99, 101, 104, 110, and 144.
  2. Missing newline at the end of the file.

To resolve these, consider:

  1. Using a linter or EditorConfig to automatically trim trailing spaces.
  2. Ensuring your editor is configured to add a newline at the end of files.

These changes will improve the overall code quality and consistency.

🧰 Tools
🪛 yamllint

[error] 97-97: trailing spaces

(trailing-spaces)


[error] 99-99: trailing spaces

(trailing-spaces)


[error] 101-101: trailing spaces

(trailing-spaces)


[error] 104-104: trailing spaces

(trailing-spaces)


[error] 110-110: trailing spaces

(trailing-spaces)


[error] 144-144: trailing spaces

(trailing-spaces)


[error] 147-147: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/ci-cd.yml.disabled (1)

47-47: Remove extra '#' in comment

The comment line appears to have an extra '#' symbol, which may cause confusion.

Apply this diff to fix the comment:

-      # # Only run this job if new work is pushed to "main"
+      # Only run this job if new work is pushed to "main"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3b57b49 and 790ae04.

⛔ Files ignored due to path filters (2)
  • pixi.lock is excluded by !**/*.lock
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • .github/workflows/ci-cd.yml (2 hunks)
  • .github/workflows/ci-cd.yml.disabled (1 hunks)
  • .gitignore (1 hunks)
  • config/coverage.toml (1 hunks)
  • config/hatch.toml (1 hunks)
  • config/ruff.toml (1 hunks)
  • old_pyproject.toml (1 hunks)
  • pyproject.toml (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • .gitignore
  • config/coverage.toml
🧰 Additional context used
🪛 yamllint
.github/workflows/ci-cd.yml

[error] 97-97: trailing spaces

(trailing-spaces)


[error] 99-99: trailing spaces

(trailing-spaces)


[error] 101-101: trailing spaces

(trailing-spaces)


[error] 104-104: trailing spaces

(trailing-spaces)


[error] 110-110: trailing spaces

(trailing-spaces)


[error] 144-144: trailing spaces

(trailing-spaces)


[error] 147-147: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (17)
config/hatch.toml (2)

1-2: LGTM: Build configuration is well-defined.

The [build] section correctly specifies "dist" as the output directory for build artifacts. This is a standard practice and aligns well with the project's transition to a Pixi-based setup.


4-5: Verify the relative package path.

The [build.targets] section correctly defines a wheel target. However, the package location "../src/readii" is relative to this config file. Ensure that this path is correct relative to the project root.

Let's verify the project structure and package location:

✅ Verification successful

Verified the relative package path.

The [build.targets] section correctly defines the wheel target with the relative path ../src/readii, and the src/readii directory exists as expected relative to config/hatch.toml.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the project structure and package location

# Test 1: Check if the config file is in a subdirectory
if [ "$(dirname "$(pwd)")" != "$(git rev-parse --show-toplevel)" ]; then
  echo "Warning: config/hatch.toml is not in the project root."
fi

# Test 2: Verify the existence of the src/readii directory
if [ -d "../src/readii" ]; then
  echo "src/readii directory exists relative to config/hatch.toml"
else
  echo "Warning: src/readii directory not found relative to config/hatch.toml"
fi

# Test 3: List the content of the src directory for context
echo "Content of the src directory:"
ls -R ../src

Length of output: 552


Script:

#!/bin/bash
# Description: Locate the src/readii directory within the repository

# Search for the src/readii directory from the repository root
fd -t d readii src

Length of output: 32

config/ruff.toml (3)

43-44: Appropriate exception for assert statements in test files.

The configuration to ignore rule "S101" (which typically flags the use of assert statements) for test files is appropriate. Assert statements are common and often necessary in test code.


47-48: Appropriate maximum complexity setting.

Setting the maximum McCabe complexity to 10 is a common and reasonable threshold. This helps maintain code readability and testability by encouraging the breakdown of complex functions.


51-57: Well-configured import sorting settings.

The isort configuration promotes consistent and organized import statements:

  • Specifying known first-party packages helps maintain clear separation between project and third-party imports.
  • Forcing wrap aliases and combining as-imports enhances readability.
  • Setting a line after imports improves code structure.
  • Ordering relative imports from closest to furthest is intuitive and maintainable.

These settings align well with Python best practices for import organization.

old_pyproject.toml (3)

1-7: LGTM: Project metadata is well-defined.

The project metadata is complete and follows best practices. The version number adheres to semantic versioning, and the MIT license is appropriate for open-source projects.


44-49: LGTM: Script entry point and build system configuration are appropriate.

The script entry point for "readii" is well-defined, and the build system configuration is standard for a Poetry project. These sections are correctly set up for the package's build and execution.


9-18: Verify the stability of pyradiomics alpha version.

The dependencies are well-defined with appropriate version constraints. However, there are two points to consider:

  1. The commented-out git dependency for pyradiomics suggests a recent switch from a forked version to a specific release.
  2. The current pyradiomics version "3.0.1a3" is an alpha release, which may not be stable for production use.

Please confirm that the alpha version of pyradiomics (3.0.1a3) is stable enough for your production environment. Consider using a stable release if available.

pyproject.toml (4)

1-16: LGTM: Project configuration updated for Pixi.

The transition from Poetry to Pixi in the project configuration looks good. The author information has been updated to include an email address, and the Python version requirement has been appropriately specified.


18-24: LGTM: Pixi-specific configurations added.

The new Pixi-specific configurations look good. The channels and platforms are correctly specified, and the package is appropriately listed as an editable dependency for development purposes.


25-39: LGTM: Well-defined environments for different scenarios.

The environment configurations for development, publishing, and specific Python versions (3.10, 3.11, 3.12) are well-defined. This setup allows for efficient management of different development and testing scenarios.


86-117: LGTM: Well-configured build and release setup.

The build and release configurations are well-defined:

  • The build system has been correctly updated to use hatchling.
  • Build and release tasks are appropriately configured using hatch and semantic-release.
  • The semantic release configuration looks good, allowing for automated versioning and changelog generation.

These changes should streamline the build and release process.

.github/workflows/ci-cd.yml (3)

1-10: LGTM: Improved workflow name and trigger conditions.

The changes to the workflow name and trigger conditions are beneficial:

  1. The capitalized "CI-CD" name improves readability.
  2. Expanded trigger conditions now cover pushes to all branches and PRs to both main and development, ensuring comprehensive CI/CD coverage.

These changes will help catch issues earlier in the development process.


Line range hint 47-109: LGTM: Well-structured Semantic-Release job.

The Semantic-Release job is well-designed:

  1. Dependency on Unit-Tests ensures releases are based on passing tests.
  2. Pixi usage aligns with PR objectives for dependency management.
  3. Steps for printing semantic version and running the release process are clear and logical.

This structure should facilitate consistent and automated versioning and releases.


117-147: Clarify the strategy for PyPI publishing.

The Publish-To-PyPi job has been commented out. While this might be part of the transition to Pixi, it's unclear if PyPI publishing is still needed or if it will be implemented differently.

Could you please clarify:

  1. Is PyPI publishing still part of the release strategy?
  2. If so, how will it be handled in the new Pixi-based workflow?
  3. If not, should this commented section be removed entirely?

This clarification will help ensure the CI/CD pipeline meets all necessary release requirements.

🧰 Tools
🪛 yamllint

[error] 144-144: trailing spaces

(trailing-spaces)


[error] 147-147: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/ci-cd.yml.disabled (2)

152-153: Check Docker Buildx action version

You're using docker/setup-buildx-action@v3, but the latest stable version is v2. Ensure that this version exists or update to the correct version.

Confirm the correct action version by checking the action's repository.


125-130: Verify package installation from TestPyPI

Ensure that the package name is correct after the transition to Pixi. If the package name has changed, update the installation command accordingly.

Run the following script to check the package name in pyproject.toml:

✅ Verification successful

Package name verification successful

The package name in pyproject.toml is correctly set to "readii".

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the package name in pyproject.toml

# Test: Extract the package name. Expect: Correct package name displayed.
grep -E '^name = ' pyproject.toml

Length of output: 51

config/ruff.toml Show resolved Hide resolved
.github/workflows/ci-cd.yml.disabled Show resolved Hide resolved
.github/workflows/ci-cd.yml.disabled Show resolved Hide resolved
.github/workflows/ci-cd.yml.disabled Show resolved Hide resolved
.github/workflows/ci-cd.yml.disabled Show resolved Hide resolved
.github/workflows/ci-cd.yml.disabled Show resolved Hide resolved
.github/workflows/ci-cd.yml.disabled Show resolved Hide resolved
.github/workflows/ci-cd.yml.disabled Show resolved Hide resolved
Copy link
Collaborator

@strixy16 strixy16 left a comment

Choose a reason for hiding this comment

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

Looks good, only worried about Python version in the new ci-cd.yml

.github/workflows/ci-cd.yml Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants