From 56a553646d09e7cc645b0b25210769f8811fcaeb Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Tue, 27 Feb 2024 13:58:49 +0100 Subject: [PATCH] Update gh action and dependencies for Python 3.11 --- .github/workflows/build-and-upload-installers.yml | 5 ++--- pruner.py | 5 ++--- pyproject.toml | 1 - src/tailor/config.py | 6 +++--- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-and-upload-installers.yml b/.github/workflows/build-and-upload-installers.yml index eefe510..ea9c49f 100644 --- a/.github/workflows/build-and-upload-installers.yml +++ b/.github/workflows/build-and-upload-installers.yml @@ -17,10 +17,9 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" - - run: python -m pip install briefcase==0.3.14 + python-version: "3.11" + - run: python -m pip install briefcase==0.3.17 - run: briefcase create - - run: python -m pip install tomli - run: python pruner.py - run: briefcase build - run: briefcase package diff --git a/pruner.py b/pruner.py index 36580ed..fb2edf5 100644 --- a/pruner.py +++ b/pruner.py @@ -1,11 +1,10 @@ import os import shutil import sys +import tomllib from glob import glob from pathlib import Path -import tomli - def prune(base_dir, exclude, include): excludes = set() @@ -34,7 +33,7 @@ def prune(base_dir, exclude, include): def main(): with open("pyproject.toml", "rb") as f: - config = tomli.load(f) + config = tomllib.load(f) pruner_config = config["tool"]["pruner"][sys.platform] prune(pruner_config["base_dir"], pruner_config["exclude"], pruner_config["include"]) diff --git a/pyproject.toml b/pyproject.toml index c9c7d79..930e6f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,6 @@ test_sources = ["tests"] requires = [ 'std-nslog', 'appdirs>=1.4.4,<2.0.0', - 'tomli>=2.0.1,<3.0.0', 'tomli_w>=1.0.0,<2.0.0', 'numpy>=1.22.1,<2.0.0', 'pandas>=2.0.0,<3.0.0', diff --git a/src/tailor/config.py b/src/tailor/config.py index bffecf4..4520bd1 100644 --- a/src/tailor/config.py +++ b/src/tailor/config.py @@ -1,8 +1,8 @@ import importlib.metadata import pathlib +import tomllib import appdirs -import tomli import tomli_w metadata = importlib.metadata.metadata("tailor") @@ -16,8 +16,8 @@ def read_config(): if config_path.is_file(): try: with open(config_path, "rb") as f: - return tomli.load(f) - except (tomli.TOMLDecodeError, UnicodeDecodeError): + return tomllib.load(f) + except (tomllib.TOMLDecodeError, UnicodeDecodeError): # error parsing TOML return {} else: