8000 Migrate from poetry to uv for dependency and package management by sdb9696 · Pull Request #986 · python-kasa/python-kasa · GitHub
[go: up one dir, main page]

Skip to content

Migrate from poetry to uv for dependency and package management #986

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

Merged
merged 5 commits into from
Sep 6, 2024

Conversation

sdb9696
Copy link
Collaborator
@sdb9696 sdb9696 commented Jun 18, 2024

As of uv 0.3 there is now official support for package management/projects.

To use the environment (.venv) simply run:

uv sync --all-extras  # uses default python installation
uv sync --python pypy-3.9  # downloads and runs with isolated python version
uv run --python 3.9 pytest  # does the sync and runs any command
source .venv/bin/activate # activates the current venv, can stay activated between python version switches

Obviously the speed is great but also the support for downloading and using multiple python versions is really great.

Notes:

  • Uses the hatchling.build backend which is the default for new uv projects until uv has it's own build backend. N.B. I initially tried setuptools but it was more clunky/limited to determine includes/excludes and required MANIFEST.in to be added.
  • The pyproject.toml file is now much more in line with python packaging guidelines for pyproject.toml
  • There's currently no equivalent of poetry version to update the project version so the RELEASING.md step uses sed. (hatch has some support for this but I think it's better to keep it simple for now.)
  • The nested uv run works fine so was able to drop the run-in-env.sh script required for a couple of pre-commit checks. (This may have actually worked with poetry too although I seem to recall it had problems in the CI on windows)
  • Adds a pre-commit check for the uv.lock file.
  • As with poetry it's best to install uv via pipx.
  • The latest versions of yarl>=1.9.5 released since the 31st August break our tests as the str(URL) now omits port 80 so I've fixed those tests.
  • Removed the old tox.ini file

Replaces #985

Copy link
codecov bot commented Sep 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.55%. Comparing base (1773f98) to head (416ccb2).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #986   +/-   ##
=======================================
  Coverage   92.55%   92.55%           
=======================================
  Files          96       96           
  Lines        6100     6100           
  Branches     1504     1504           
=======================================
  Hits         5646     5646           
  Misses        354      354           
  Partials      100      100           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sdb9696 sdb9696 added the maintenance Project improvements and maintenance label Sep 6, 2024
@sdb9696 sdb9696 added this to the 0.7.3 milestone Sep 6, 2024
@sdb9696 sdb9696 marked this pull request as ready for review September 6, 2024 12:02
@sdb9696 sdb9696 requested a review from rytilahti September 6, 2024 12:02
Copy link
Member
@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

A couple of quick comments. For some reason I need to manually define -p python for uv commands, or it fails otherwise like this:

uv sync --all-extras 
error: No interpreter found for executable name `kasa37` in managed installations or system path

@sdb9696
Copy link
Collaborator Author
sdb9696 commented Sep 6, 2024

A couple of quick comments. For some reason I need to manually define -p python for uv commands, or it fails otherwise like this:

uv sync --all-extras 
error: No interpreter found for executable name `kasa37` in managed installations or system path

Which version of uv are you using? I have been using 0.4.5 installed via pipx

Copy link
Member
@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@sdb9696 sdb9696 changed the title Migrate from poetry to uv Migrate from poetry to uv for dependency and package management Sep 6, 2024
@sdb9696 sdb9696 merged commit a967d5c into python-kasa:master Sep 6, 2024
30 checks passed
@sdb9696 sdb9696 deleted the feat/poetry_to_uv branch September 6, 2024 14:48
@sdb9696 sdb9696 mentioned this pull request Sep 10, 2024
sdb9696 added a commit that referenced this pull request Sep 10, 2024
## [0.7.3](https://github.com/python-kasa/python-kasa/tree/0.7.3) (2024-09-10)

[Full Changelog](0.7.2...0.7.3)

**Release summary:**

- Migrate from `poetry` to `uv` for package/project management.
- Various minor code improvements

**Project maintenance:**

- Do not regenerate aes key pair [\#1114](#1114) (@sdb9696)
- Fix tests due to yarl URL str output change [\#1112](#1112) (@sdb9696)
- Add missing type hints to alarm module [\#1111](#1111) (@rytilahti)
- Add KH100 EU fixtures [\#1109](#1109) (@rytilahti)
- Migrate from poetry to uv for dependency and package management [\#986](#986) (@sdb9696)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Project improvements and maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0