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

Replace toml by tomllib #168

Open
bkmgit opened this issue Oct 19, 2024 · 4 comments · May be fixed by #169
Open

Replace toml by tomllib #168

bkmgit opened this issue Oct 19, 2024 · 4 comments · May be fixed by #169

Comments

@bkmgit
Copy link

bkmgit commented Oct 19, 2024

The tomli package should no longer be used. Instead tomlib from the standard library and tomli_w should be used.

Possible Solution

Modify files which use the older methods.

@bkmgit bkmgit linked a pull request Oct 19, 2024 that will close this issue
5 tasks
@FriedrichFroebel
Copy link
Contributor

I cannot find any information on this on the PyPI page. Where is this documented?

@bkmgit
Copy link
Author

bkmgit commented Oct 19, 2024

The PyPi page states, A version of Tomli, the tomllib module, was added to the standard library in Python 3.11 via [PEP 680](https://www.python.org/dev/peps/pep-0680/). Tomli continues to provide a backport on PyPI for Python versions where the standard library module is not available and that have not yet reached their end-of-life.

It suggests making the following change to allow for a wider compatibility of Python versions

import sys

if sys.version_info >= (3, 11):
    import tomllib
else:
    import tomli as tomllib

tomllib.loads("['This parses fine with Python 3.6+']")

Though would still need tomli_w for output.

@FriedrichFroebel
Copy link
Contributor

Doesn't your PR drop support for Python < 3.11 then? Python 3.8 recently went EOL, but Python 3.9 and 3.10 are still supported for one and two years.

@bkmgit
Copy link
Author

bkmgit commented Oct 19, 2024

Updated the PR to continue using methods available in Python 3.9 and 3.10

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 a pull request may close this issue.

2 participants