Switch to tomllib/tomli for pyproject.toml parsing#5714
Merged
FeodorFitsner merged 1 commit intomainfrom Oct 15, 2025
Merged
Conversation
Replaces the toml dependency with tomli for Python <3.11 and tomllib for Python >=3.11. Updates pyproject.toml and utility code to use the appropriate library for parsing pyproject.toml files, ensuring compatibility with newer Python versions. Fix #5701
Contributor
There was a problem hiding this comment.
Pull Request Overview
Modernizes TOML parsing by switching from the external toml package to Python's built-in tomllib (Python ≥3.11) with a fallback to tomli for older versions, reducing external dependencies and leveraging standard library capabilities.
Key Changes:
- Added conditional import logic to use
tomllibfor Python ≥3.11, falling back totomlifor earlier versions - Updated dependency specification to only require
tomlifor Python <3.11 - Modified TOML parsing call to use the aliased
tomllibmodule
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sdk/python/packages/flet-cli/src/flet_cli/utils/pyproject_toml.py | Added version-specific import logic and updated parsing call to use tomllib alias |
| sdk/python/packages/flet-cli/pyproject.toml | Replaced unconditional toml dependency with conditional tomli dependency for Python <3.11 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Deploying flet-docs with
|
| Latest commit: |
de303e6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1c955fab.flet-docs.pages.dev |
| Branch Preview URL: | https://feodor-tomli.flet-docs.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the toml dependency with tomli for Python <3.11 and tomllib for Python >=3.11. Updates pyproject.toml and utility code to use the appropriate library for parsing pyproject.toml files, ensuring compatibility with newer Python versions.
Fix #5701
Summary by Sourcery
Switch to tomllib/tomli for parsing pyproject.toml and remove the external toml dependency
Enhancements:
Build: