Skip to content

Commit

Permalink
use tomllib and update action (#30)
Browse files Browse the repository at this point in the history
* use tomllib and update action

* update action

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* detect runner os

* syntax

* use single step

* use version_info

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
CagtayFabry and pre-commit-ci[bot] committed Apr 30, 2024
1 parent fb588de commit f7b11ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ runs:
steps:
- name: create environment file
run: >
pip3 install tomli packaging pyyaml &&
pip3 install tomli packaging pyyaml $PIP_OPTIONS &&
python3 $GITHUB_ACTION_PATH/pydeps2env/generate_environment.py ${{ inputs.files }}
--output ${{ inputs.output }}
--channels ${{ inputs.channels }}
--extras ${{ inputs.extras }}
--build_system ${{ inputs.build_system }}
--pip ${{ inputs.pip }}
shell: bash
env:
PIP_OPTIONS: ${{ runner.os == 'macOS' && '--break-system-packages' || '' }}
- name: show environment file
run: cat ${{ inputs.output }}
shell: bash
7 changes: 6 additions & 1 deletion pydeps2env/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
from pathlib import Path
from collections import defaultdict
import configparser
import tomli as tomllib
import sys
import yaml
import warnings

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


def clean_list(item: list, sort: bool = True) -> list:
"""Remove duplicate entries from a list."""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dynamic = [
dependencies = [
"packaging",
"pyyaml",
"tomli",
'tomli; python_version < "3.11"',
]
[project.optional-dependencies]
test = [
Expand Down

0 comments on commit f7b11ee

Please sign in to comment.