Converting `toml` dependency to `tomllib`
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
`toml` project has not had activity in quite a while and downstream packagers have already deprecated it and it will be removed from Fedora soon.
As poetry is a barrier of contribution, I am offering the required change to move from `toml` to stdlib `tomllib` in this issue, this should also include the dependency
```toml
dependencies = [
"tomli;python_version<'3.11'",
]
```
```patch
Subject: [PATCH] Convert toml dependency to tomllib
---
Index: teampulls/teampulls.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/teampulls/teampulls.py b/teampulls/teampulls.py
--- a/teampulls/teampulls.py (revision c9cfa0ef11c666cc28b45b4984c21c96314b2b86)
+++ b/teampulls/teampulls.py (date 1756831477502)
@@ -13,7 +13,10 @@
import os
import sys
-import toml
+if sys.version_info < (3, 11):
+ import tomli as tomllib
+else:
+ import tomllib
import requests
from functools import partial
from os.path import expanduser
@@ -125,8 +128,8 @@
path = expanduser(path)
if os.path.isfile(path) and not os.path.isdir(path) and not os.path.islink(path):
try:
- settings = toml.load(path)
- except toml.decoder.TomlDecodeError:
+ settings = tomllib.load(path)
+ except tomllib.TOMLDecodeError:
print(
"TOML file at \"{}\" seems to be malformed".format(path),
file=sys.stderr,
```
Contributor guide
No contributing guide indexed for this repository
Research direction
The proposed change targets teampulls/teampulls.py and the dependency list shown in the issue. Start by reviewing TOML loading around the path handling near line 125 and the project's supported Python versions. Run the project's existing checks, if available, and confirm malformed TOML still produces the documented error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100