Skip to content

v1: Migrated poetry to uv #5253

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 8 commits into from
Apr 28, 2025
Merged

v1: Migrated poetry to uv #5253

merged 8 commits into from
Apr 28, 2025

Conversation

FeodorFitsner
Copy link
Contributor

@FeodorFitsner FeodorFitsner commented Apr 28, 2025

Summary by Sourcery

Migrate Python dependency management and building from Poetry to uv.

Build:

  • Convert pyproject.toml files to use standard PEP 621 metadata and setuptools build backend.
  • Configure the Python SDK as a uv workspace.
  • Replace poetry.lock files with uv.lock.

CI:

  • Update CI workflows and scripts to install and use uv instead of poetry.
  • Adapt build artifact paths and dependency patching scripts for uv.
  • Download Pyodide core during the web build process.

Documentation:

  • Update developer contribution guide (CONTRIBUTING.md) with uv installation and commands.

@ndonkoHenri ndonkoHenri requested a review from Copilot April 28, 2025 19:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Migrates the project's dependency management and build configuration from Poetry to uv.

  • Converted all pyproject.toml files to use PEP 621 metadata with uv-specific configuration and setuptools.
  • Updated CI workflows and build scripts (including Appveyor) to install, build, test, and publish using uv commands.
  • Revised the developer documentation in CONTRIBUTING.md to reflect the new uv installation and command usage.

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sdk/python/pyproject.toml Switched dependency and workspace configuration from Poetry to uv.
sdk/python/packages/flet/pyproject.toml Migrated dependency declarations, optional dependencies, and URLs to PEP 621 format.
sdk/python/packages/flet-web/pyproject.toml Updated package-data and URL declarations with new build settings.
sdk/python/packages/flet-desktop/pyproject.toml Simplified dependencies and shifted build backend from poetry-core to setuptools.build_meta.
sdk/python/packages/flet-cli/pyproject.toml Updated package metadata and entry-points, and replaced poetry-specific config with project configuration.
ci/update-flet-wheel-deps.py Adjusted dependency version insertion to use strict equality matches.
ci/patch_toml_versions.py Changed dependency patching to iterate over a list per the new PEP 621 structure.
CONTRIBUTING.md Updated installation and command instructions from Poetry to uv.
.appveyor.yml Revised build, test, and publish steps to install uv, build wheels with uv, and adjust wheel artifact paths.
Files not reviewed (1)
  • ci/common.sh: Language not supported

Comment on lines +28 to 35
for i in range(0, len(deps)):
dep = deps[i]
if dep == dep_name:
deps[i] = f"{dep_name}=={ver}"
elif dep.startswith(f"{dep_name};"):
deps[i] = dep.replace(f"{dep_name};", f"{dep_name}=={ver};")


Copy link
Preview

Copilot AI Apr 28, 2025

Choose a reason for hiding this comment

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

The dependency version update logic in patch_dep relies on simple string matching, which might not correctly handle cases where dependencies already contain version constraints or extras. Consider using a more robust parser or regex to accurately update dependency strings.

Suggested change
for i in range(0, len(deps)):
dep = deps[i]
if dep == dep_name:
deps[i] = f"{dep_name}=={ver}"
elif dep.startswith(f"{dep_name};"):
deps[i] = dep.replace(f"{dep_name};", f"{dep_name}=={ver};")
for i in range(len(deps)):
dep = deps[i]
# Parse dependency into components
if ";" in dep:
base, marker = dep.split(";", 1)
else:
base, marker = dep, None
if "[" in base:
name, extras = base.split("[", 1)
extras = "[" + extras # Add back the opening bracket
else:
name, extras = base, ""
# Update version if the dependency name matches
if name.strip() == dep_name:
new_base = f"{name.strip()}{extras}=={ver}"
deps[i] = f"{new_base};{marker}" if marker else new_base

Copilot uses AI. Check for mistakes.

- poetry build
- sh: |
if [[ "$PACKAGE_NAME" == "flet-desktop-light" ]]; then
sed -i 's/flet-desktop/flet-desktop-light/g' pyproject.toml
Copy link
Preview

Copilot AI Apr 28, 2025

Choose a reason for hiding this comment

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

[nitpick] Ensure that the sed substitution for replacing 'flet-desktop' with 'flet-desktop-light' in pyproject.toml is idempotent and targets only the intended configuration lines. Consider refining the match pattern to avoid inadvertent changes to unrelated parts of the file.

Suggested change
sed -i 's/flet-desktop/flet-desktop-light/g' pyproject.toml
sed -i '/^name = "flet-desktop"$/s/flet-desktop/flet-desktop-light/' pyproject.toml

Copilot uses AI. Check for mistakes.

@FeodorFitsner FeodorFitsner merged commit 0ccd53b into v1 Apr 28, 2025
1 of 2 checks passed
@FeodorFitsner FeodorFitsner deleted the feodor/v1-uv branch April 28, 2025 20:52
FeodorFitsner added a commit that referenced this pull request Jun 17, 2025
* poetry replaced with uv

* Try building with CI

* add uv to path

* Fix sdk path

* Support for desktop light

* unpack pyodide

* Update contributing guide

* Enable Ruff
FeodorFitsner added a commit that referenced this pull request Jun 19, 2025
* v1: Migrated `poetry` to `uv` (#5253)

* poetry replaced with uv

* Try building with CI

* add uv to path

* Fix sdk path

* Support for desktop light

* unpack pyodide

* Update contributing guide

* Enable Ruff

* Cleanup after merge
FeodorFitsner added a commit that referenced this pull request Jun 20, 2025
…le()` call (#5378)

* v1: Migrated `poetry` to `uv` (#5253)

* poetry replaced with uv

* Try building with CI

* add uv to path

* Fix sdk path

* Support for desktop light

* unpack pyodide

* Update contributing guide

* Enable Ruff

* Cleanup after merge

* Filepicker entitlements for macOS

* Android and iOS: allow passing `src_bytes` in FilePicker.save_file() call

Fix #5373

* Added `com.apple.security.files.user-selected.read-write` to default macOS entitlements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants