Skip to content

Commit

Permalink
Merge branch 'main' into custom_deps
Browse files Browse the repository at this point in the history
# Conflicts:
#	pydeps2env/environment.py
  • Loading branch information
CagtayFabry committed May 3, 2024
2 parents f8428c7 + 47e59bc commit dbfacdd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
# ----- Python formatting -----
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
rev: v0.4.2
hooks:
# Run ruff linter.
- id: ruff
Expand All @@ -19,12 +19,12 @@ repos:
- id: ruff-format
# ----- repo maintenance -----
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
rev: v2.13.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
rev: 1.8.0
hooks:
- id: pyproject-fmt
- repo: https://github.com/abravalheri/validate-pyproject
Expand Down
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
15 changes: 12 additions & 3 deletions pydeps2env/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@
from pathlib import Path
from collections import defaultdict
import configparser
import tomli as tomllib
import sys
import yaml
import warnings
from io import StringIO, BytesIO
from warnings import warn

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."""
pass


def split_extras(filename: str) -> tuple[str, set]:
"""Split extras requirements indicated in []."""
Expand Down Expand Up @@ -264,7 +273,7 @@ def export(
outfile.writelines("\n".join(deps))
else:
if p.suffix not in [".yaml", ".yml"]:
warnings.warn(
warn(
f"Unknown environment format `{p.suffix}`, generating conda yaml output."
)
with open(p, "w") as outfile:
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 dbfacdd

Please sign in to comment.