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: ⭐ Introducing UV as package manager #1785

Merged
merged 30 commits into from
Jan 22, 2025
Merged

feat: ⭐ Introducing UV as package manager #1785

merged 30 commits into from
Jan 22, 2025

Conversation

Anselmoo
Copy link
Owner

@Anselmoo Anselmoo commented Jan 21, 2025

All PR-Submissions:


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open
    Pull Requests for the same
    update/change?

New ✨✨ Feature-Submissions:


Changes to ⚙️ Core-Features:


  • Have you added an explanation of what your changes do and why you'd like
    us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

Summary by Sourcery

Update project dependencies and migrate from Poetry to UV.

Enhancements:

  • Update pre-commit hooks.
  • Update Python version compatibility.
  • Remove Poetry configuration and lock file.
  • Add UV configuration and lock file.

Build:

  • Migrate from Poetry to UV as the build system.

CI:

  • Update CI workflows to use UV.

Tests:

  • Update test dependencies.

Copy link

semanticdiff-com bot commented Jan 21, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  renovate.json  100% smaller
  spectrafit/plugins/rixs_converter.py  100% smaller
  .devcontainer/devcontainer.json  73% smaller
  spectrafit/report.py  70% smaller
  .devcontainer/setup.sh Unsupported file format
  .github/labeler.yml Unsupported file format
  .github/workflows/codeql.yml Unsupported file format
  .github/workflows/conda_check.yml Unsupported file format
  .github/workflows/docker-ci.yml Unsupported file format
  .github/workflows/python-ci.yml Unsupported file format
  .github/workflows/update-changelog.yaml Unsupported file format
  .github/workflows/weekly-poetry-bot.yml Unsupported file format
  .pre-commit-config.yaml Unsupported file format
  .trunk/trunk.yaml Unsupported file format
  CONTRIBUTING.md Unsupported file format
  INSTALLATION.md Unsupported file format
  codecov.yml Unsupported file format
  docs/api/converter_api.md Unsupported file format
  docs/changelogs/v0.x.x.md Unsupported file format
  docs/doc/fitting.md Unsupported file format
  docs/doc/models.md Unsupported file format
  docs/doc/statistics.md Unsupported file format
  docs/examples/example4.md Unsupported file format
  docs/examples/example7.md Unsupported file format
  docs/interface/features.md Unsupported file format
  docs/interface/usage.md Unsupported file format
  docs/plugins/data_converter.md Unsupported file format
  docs/plugins/pptx_converter.md Unsupported file format
  poetry.lock Unsupported file format
  pyproject.toml Unsupported file format
  spectrafit/__init__.py  0% smaller
  spectrafit/test/test_init.py  0% smaller
  spectrafit/test/test_models.py  0% smaller
  uv.lock Unsupported file format

Copy link
Contributor

sourcery-ai bot commented Jan 21, 2025

Reviewer's Guide by Sourcery

This pull request migrates the project from Poetry to Hatch for build management. It also updates the project metadata, dependencies, and development tooling configurations.

Class diagram showing project metadata changes

classDiagram
    class ProjectMetadata {
        +name: SpectraFit
        +version: str
        +description: str
        +authors: List
        +dependencies: List
        +optional_dependencies: Dict
    }

    class BeforePoetry {
        +version: 1.1.0
        +tool.poetry: Dict
        +tool.poetry.dependencies: Dict
        +tool.poetry.group.dev.dependencies: Dict
        +tool.poetry.group.docs.dependencies: Dict
    }

    class AfterHatch {
        +version: 1.2.0
        +project: Dict
        +project.dependencies: List
        +dependency-groups.dev: List
        +dependency-groups.docs: List
        +tool.hatch: Dict
    }

    ProjectMetadata <|-- BeforePoetry
    ProjectMetadata <|-- AfterHatch
    note for BeforePoetry "Poetry configuration"
    note for AfterHatch "Hatch configuration"
Loading

File-Level Changes

Change Details Files
Migrate from Poetry to Hatch
  • Replaced the [tool.poetry] section with [project] and [build-system] sections.
  • Updated project metadata such as name, version, description, authors, license, and classifiers.
  • Modified the dependencies to be compatible with Hatch.
  • Added optional dependencies for jupyter, graph, and all.
  • Added dependency groups for dev and docs.
  • Configured uv for dependency management.
  • Configured hatch build targets for sdist and wheel.
  • Updated project URLs.
  • Updated scripts section.
pyproject.toml
Update GitHub Actions workflows
  • Replaced Poetry with uv for dependency management in the weekly update bot workflow.
  • Updated the python CI workflow to use uv for dependency management and testing.
  • Updated the update changelog workflow to use uv for dependency management.
  • Removed poetry specific commands and configurations.
.github/workflows/weekly-poetry-bot.yml
.github/workflows/python-ci.yml
.github/workflows/update-changelog.yaml
Update installation documentation
  • Replaced the Poetry installation instructions with uv installation instructions.
  • Deprecated the Poetry installation method.
INSTALLATION.md
Update labeler configuration
  • Added uv.lock to the dependencies label.
  • Removed poetry.lock from the dependencies label.
.github/labeler.yml
Update trunk configuration
  • Updated the trunk cli version.
  • Updated the versions of several linters.
  • Added pre-commit-hooks to the enabled linters.
.trunk/trunk.yaml
Update init file
  • Updated the version to 1.2.0.
spectrafit/__init__.py
Update test init file
  • Updated the test to check for version 1.2.0.
spectrafit/test/test_init.py
Update devcontainer configuration
  • Replaced poetry with uv in the devcontainer setup script.
  • Updated the devcontainer configuration to use uv.
.devcontainer/setup.sh
.devcontainer/devcontainer.json
Update report file
  • Added stacklevel to the warn function calls.
spectrafit/report.py
Remove poetry lock file
  • Removed the poetry lock file.
poetry.lock
Add uv lock file
  • Added the uv lock file.
uv.lock

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added testing Improve testing & coverage maintenance Maintenance & Security dependencies Pull requests that update a dependency file github-actions Pull requests that update Github_actions code python Pull requests that update Python code release Release pre-commit root labels Jan 21, 2025
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4011a88) to head (f421c63).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1785   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           45        45           
  Lines         4535      4535           
=========================================
  Hits          4535      4535           
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
spectrafit/__init__.py 100.00% <100.00%> (ø)
spectrafit/plugins/rixs_converter.py 100.00% <ø> (ø)
spectrafit/report.py 100.00% <100.00%> (ø)
spectrafit/test/test_init.py 100.00% <100.00%> (ø)
spectrafit/test/test_models.py 100.00% <100.00%> (ø)

@github-actions github-actions bot added the codespaces Everything connected to GitHub's Codespaces label Jan 22, 2025
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 22, 2025
@Anselmoo Anselmoo marked this pull request as ready for review January 22, 2025 20:44
@Anselmoo Anselmoo changed the title Feature/uv feat: ⭐ Introducing UV as package manager Jan 22, 2025
@Anselmoo Anselmoo added the enhancement New feature or request label Jan 22, 2025
@Anselmoo Anselmoo merged commit 3596f33 into main Jan 22, 2025
60 of 61 checks passed
@Anselmoo Anselmoo deleted the feature/uv branch January 22, 2025 20:45
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Anselmoo - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding documentation about the rationale for migrating from Poetry to UV in the PR description or changelog, to help users understand the benefits and motivation behind this tooling change.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -262,11 +296,11 @@ available plugins are:
[2]: https://conda.io/docs/
[3]: https://anaconda.org/conda-forge/spectrafit
[4]: https://github.com/Anselmoo/spectrafit/pkgs/container/spectrafit
[5]:
https://github.com/jupyter/docker-stacks/blob/main/scipy-notebook/Dockerfile
[5]: https://github.com/jupyter/docker-stacks/blob/main/scipy-notebook/Dockerfile
[6]: ../../plugins/jupyter-spectrafit-interface
[7]: https://github.com/conda-forge/spectrafit-feedstock
[8]: https://python-poetry.org/docs/
[9]: https://github.com/Anselmoo/spectrafit/
[10]: https://www.sigstore.dev
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: Incorrect link for UV.

This link points to sigstore.dev. It should point to the UV documentation.

```
_Usage_:

```bash
poetry run spectrafit --help
uv run spectrafit --help
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Potential issue with uv run command.

uv run might not execute within the project's virtual environment. Consider using uv exec spectrafit --help instead.

Suggested change
uv run spectrafit --help
uv exec spectrafit --help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codespaces Everything connected to GitHub's Codespaces dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation enhancement New feature or request github-actions Pull requests that update Github_actions code maintenance Maintenance & Security pre-commit python Pull requests that update Python code release Release root size/XXL testing Improve testing & coverage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Change from poetry to uv by astral
1 participant