Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Switch to tomllib/tomli for pyproject.toml parsing#5714

Merged
FeodorFitsner merged 1 commit intomainfrom
feodor/tomli
Oct 15, 2025
Merged

Switch to tomllib/tomli for pyproject.toml parsing#5714
FeodorFitsner merged 1 commit intomainfrom
feodor/tomli

Conversation

@FeodorFitsner
Copy link
Contributor

@FeodorFitsner FeodorFitsner commented Oct 15, 2025

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:

  • Add conditional import of tomllib for Python >=3.11 and tomli for older versions
  • Update parsing logic to use tomllib alias instead of toml.loads

Build:

  • Replace the toml dependency in pyproject.toml with tomli for Python <3.11

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
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.

We've reviewed this pull request using the Sourcery rules engine

Copy link
Contributor

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

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 tomllib for Python ≥3.11, falling back to tomli for earlier versions
  • Updated dependency specification to only require tomli for Python <3.11
  • Modified TOML parsing call to use the aliased tomllib module

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.

@cloudflare-workers-and-pages
Copy link

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: de303e6
Status: ✅  Deploy successful!
Preview URL: https://1c955fab.flet-docs.pages.dev
Branch Preview URL: https://feodor-tomli.flet-docs.pages.dev

View logs

Copy link
Contributor

@ndonkoHenri ndonkoHenri left a comment

Choose a reason for hiding this comment

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

LGTM

@FeodorFitsner FeodorFitsner merged commit 15ac9b9 into main Oct 15, 2025
34 of 44 checks passed
@FeodorFitsner FeodorFitsner deleted the feodor/tomli branch October 15, 2025 19:18
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.

Enhancement: Replace legacy toml with modern TOML library

3 participants