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

fix: make uv plugin re-entrant on code changes #956

Merged
merged 6 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/security-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ jobs:
uses: canonical/starflow/.github/workflows/scan-python.yaml@main
with:
packages: python-apt-dev
uv-export: false # can't use `--all-extras` due to the different versions of python-apt conflicting
1 change: 1 addition & 0 deletions craft_parts/plugins/uv_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def _get_package_install_commands(self) -> list[str]:
"sync",
"--no-dev",
"--no-editable",
"--reinstall",
]

for extra in sorted(self._options.uv_extras):
Expand Down
8 changes: 8 additions & 0 deletions docs/reference/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Changelog
*********

2.2.2 (2025-MM-DD)
------------------

Bug fixes:

- Make sure the :ref:`uv plugin<craft_parts_uv_plugin>` is re-entrant on code
medubelko marked this conversation as resolved.
Show resolved Hide resolved
changes

2.2.1 (2024-12-19)
------------------

Expand Down
43 changes: 38 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,21 @@ dependencies = [
]

[project.optional-dependencies]
apt = [
"python-apt>=2.4.0;sys_platform=='linux'"
apt-jammy = [
# Stay on 2.4 for Jammy
"python-apt~=2.4.0;sys_platform=='linux'",
]
apt-noble = [
# 2.7 for Noble
"python-apt~=2.7.0;sys_platform=='linux'",
]
apt-oracular = [
# 2.9 for Oracular+
"python-apt~=2.9.0;sys_platform=='linux'",
]
apt-plucky = [
# While Plucky is in development, it should use the latest
"python-apt>=2.9.0;sys_platform=='linux'",
]
docs = [
"canonical-sphinx",
Expand Down Expand Up @@ -133,6 +146,19 @@ dev-dependencies = [
"types-requests",
"types-setuptools",
]
conflicts = [
[
{ extra = "apt-jammy" },
{ extra = "apt-noble" },
{ extra = "apt-oracular" },
{ extra = "apt-plucky" },
]
]


[[tool.uv.index]]
name = "python-apt-wheels"
url = "https://people.canonical.com/~lengau/python-apt-ubuntu-wheels/"


[project.scripts]
Expand Down Expand Up @@ -171,7 +197,16 @@ version_scheme = "post-release"
# deviations from the default 'git describe' command:
# - only match annotated tags
# - only match tags formatted as 'X.Y.Z'
git_describe_command = "git describe --dirty --long --match '[0-9]*.[0-9]*.[0-9]*' --exclude '*[^0-9.]*'"
git_describe_command = [
"git",
"describe",
"--dirty",
"--long",
"--match",
"'[0-9]*.[0-9]*.[0-9]*'",
"--exclude",
"'*[^0-9.]*'",
]

[tool.black]
target-version = ["py310"]
Expand Down Expand Up @@ -305,7 +340,6 @@ lint.select = [ # Base linting rule selections.
"RUF200", # If ruff fails to parse pyproject.toml...
]
lint.ignore = [
"ANN10", # Type annotations for `self` and `cls`
#"E203", # Whitespace before ":" -- Commented because ruff doesn't currently check E203
"E501", # Line too long (reason: black will automatically fix this for us)
"D105", # Missing docstring in magic method (reason: magic methods already have definitions)
Expand Down Expand Up @@ -350,7 +384,6 @@ classmethod-decorators = ["pydantic.validator", "pydantic.root_validator"]
"S108", # Allow Probable insecure usage of temporary file or directory
"PLR0913", # Allow many arguments for test functions (useful if we need many fixtures)
"PLR2004", # Allow magic values in tests
"PT004", # Allow fixture no return in tests
"SLF", # Allow accessing private members from tests.
"INP001", # Allow implicit namespace package
"RUF012", # Allow mutable class attributes without `typing.ClassVar`
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/plugins/test_uv_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_get_install_commands(
uv_plugin = UvPlugin(part_info=part_info, properties=properties)

assert uv_plugin._get_package_install_commands() == [
f"uv sync --no-dev --no-editable{extras_expected}{groups_expected}"
f"uv sync --no-dev --no-editable --reinstall{extras_expected}{groups_expected}"
]


Expand Down
Loading
Loading