Skip to content

Commit

Permalink
ENH: remove toml dependency (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer authored Oct 14, 2024
1 parent b8c669c commit 6d22e49
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
10 changes: 9 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@
".vscode/*",
"pyproject.toml"
],
"ignoreWords": ["elif", "mhutchie", "noqa", "noreply", "taplo", "tomlkit"],
"ignoreWords": [
"elif",
"mhutchie",
"noqa",
"noreply",
"taplo",
"tomlkit",
"tomllib"
],
"language": "en-US",
"version": "0.2",
"words": []
Expand Down
2 changes: 0 additions & 2 deletions create-pytest-matrix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ runs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install toml
shell: bash
- id: set-matrix
name: Create run matrix in JSON form
run: |
Expand Down
7 changes: 3 additions & 4 deletions create-pytest-matrix/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

import json
import os
import tomllib
from argparse import ArgumentParser
from configparser import ConfigParser
from typing import TYPE_CHECKING

import toml

if TYPE_CHECKING:
from collections.abc import Sequence

Expand Down Expand Up @@ -130,8 +129,8 @@ def __get_classifiers_from_cfg(path: str) -> list[str]:


def __get_classifiers_from_toml(path: str) -> list[str]:
with open(path) as f:
cfg = toml.load(f)
with open(path, "rb") as f:
cfg = tomllib.load(f)
classifiers = cfg.get("project", {}).get("classifiers")
if classifiers is None:
raise ValueError(CLASSIFIERS_ERROR_MSG)
Expand Down
2 changes: 0 additions & 2 deletions create-python-version-matrix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ runs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install toml
shell: bash
- id: set-matrix
name: Create run matrix in JSON form
run: |
Expand Down
7 changes: 3 additions & 4 deletions create-python-version-matrix/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

import json
import os
import tomllib
from configparser import ConfigParser

import toml

PYPROJECT_TOML = "pyproject.toml"
SETUP_CFG = "setup.cfg"

Expand Down Expand Up @@ -52,8 +51,8 @@ def __get_classifiers_from_cfg(path: str) -> list[str]:


def __get_classifiers_from_toml(path: str) -> list[str]:
with open(path) as f:
cfg = toml.load(f)
with open(path, "rb") as f:
cfg = tomllib.load(f)
classifiers = cfg.get("project", {}).get("classifiers")
if classifiers is None:
raise ValueError(CLASSIFIERS_ERROR_MSG)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python",
]
dependencies = ["toml"]
description = "Python scripts used by the ComPWA/actions repository"
dynamic = ["version"]
license = {text = "License :: OSI Approved :: MIT License"}
Expand Down

0 comments on commit 6d22e49

Please sign in to comment.