Skip to content

Commit 4bb2349

Browse files
committed
update and fmt
1 parent 2a32673 commit 4bb2349

File tree

7 files changed

+82
-61
lines changed

7 files changed

+82
-61
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ jobs:
88
fail-fast: false
99
matrix:
1010
os: [ubuntu-latest, macos-latest, windows-latest]
11-
config_file: ['./test/setup.cfg', './test/pyproject.toml']
11+
config_file: [./test/setup.cfg, ./test/pyproject.toml]
1212
steps:
13-
- uses: actions/checkout@v3
14-
- name: run local action code
15-
uses: ./
16-
with:
17-
file: ${{ matrix.config_file }}
18-
output: 'environment_test.yml'
19-
channels: 'conda-forge defaults'
20-
extras: 'test pip_only'
21-
setup_requires: 'include'
22-
pip: 'bidict'
23-
- uses: mamba-org/setup-micromamba@v1.4.3
24-
with:
25-
environment-file: ./environment_test.yml
26-
environment-name: demo
27-
init-shell: >-
28-
bash
29-
powershell
30-
cache-environment: true
13+
- uses: actions/checkout@v3
14+
- name: run local action code
15+
uses: ./
16+
with:
17+
file: ${{ matrix.config_file }}
18+
output: environment_test.yml
19+
channels: conda-forge defaults
20+
extras: test pip_only
21+
setup_requires: include
22+
pip: bidict
23+
- uses: mamba-org/setup-micromamba@v1.4.3
24+
with:
25+
environment-file: ./environment_test.yml
26+
environment-name: demo
27+
init-shell: >-
28+
bash
29+
powershell
30+
cache-environment: true

.pre-commit-config.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v4.1.0
44
hooks:
5-
- id: trailing-whitespace
6-
args: [--markdown-linebreak-ext=md]
7-
- id: end-of-file-fixer
8-
- id: check-yaml
5+
- id: trailing-whitespace
6+
args: [--markdown-linebreak-ext=md]
7+
- id: end-of-file-fixer
8+
- id: check-yaml
99
# ----- Python formatting -----
1010
- repo: https://github.com/charliermarsh/ruff-pre-commit
1111
rev: v0.1.13
@@ -17,3 +17,17 @@ repos:
1717
- --fix
1818
# Run ruff formatter.
1919
- id: ruff-format
20+
# ----- repo maintenance -----
21+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
22+
rev: v2.12.0
23+
hooks:
24+
- id: pretty-format-yaml
25+
args: [--autofix, --indent, '2']
26+
- repo: https://github.com/tox-dev/pyproject-fmt
27+
rev: 1.6.0
28+
hooks:
29+
- id: pyproject-fmt
30+
- repo: https://github.com/abravalheri/validate-pyproject
31+
rev: v0.15
32+
hooks:
33+
- id: validate-pyproject

action.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
name: 'pydeps2env'
2-
description: 'create conda environment file from python project dependencies'
1+
name: pydeps2env
2+
description: create conda environment file from python project dependencies
33
inputs:
44
file:
55
description: >-
66
Specify the location of the 'setup.cfg' file to parse. (defaults to 'setup.cfg')
77
required: true
8-
default: 'setup.cfg'
8+
default: setup.cfg
99
output:
1010
description: >-
1111
Specify the location and name of the conda environment file to generate. (defaults to 'environment.yml')
1212
required: true
13-
default: 'environment.yml'
13+
default: environment.yml
1414
channels:
1515
description: >-
1616
List the conda channels to include in the environment file. (defaults to 'defaults')
1717
Separate a list of multiple channels by spaces (e.g. 'conda-forge defaults').
1818
required: true
19-
default: 'defaults'
19+
default: defaults
2020
extras:
2121
description: >-
2222
Specify one or more optional [extras_require] sections to add to the environment
@@ -27,24 +27,24 @@ inputs:
2727
if set to 'include' the dependencies listed under [options]:setup_requires will be added to the environment
2828
(default is 'omit' so no setup dependencies will be installed)
2929
required: false
30-
default: 'omit'
30+
default: omit
3131
pip:
3232
description: >-
3333
List of packages to install via pip instead of conda.
3434
The dependencies will be listet under the pip section in the environment file.
3535
required: false
3636
runs:
37-
using: "composite"
37+
using: composite
3838
steps:
39-
- name: create environment file
40-
run: >
41-
pip3 install tomli packaging &&
42-
python3 $GITHUB_ACTION_PATH/generate_environment.py ${{ inputs.file }} ${{ inputs.output }}
43-
--channels ${{ inputs.channels }}
44-
--extras ${{ inputs.extras }}
45-
--setup_requires ${{ inputs.setup_requires }}
46-
--pip ${{ inputs.pip }}
47-
shell: bash
48-
- name: show environment file
49-
run: cat ${{ inputs.output }}
50-
shell: bash
39+
- name: create environment file
40+
run: >
41+
pip3 install tomli packaging pyyaml &&
42+
python3 $GITHUB_ACTION_PATH/generate_environment.py ${{ inputs.file }} ${{ inputs.output }}
43+
--channels ${{ inputs.channels }}
44+
--extras ${{ inputs.extras }}
45+
--setup_requires ${{ inputs.setup_requires }}
46+
--pip ${{ inputs.pip }}
47+
shell: bash
48+
- name: show environment file
49+
run: cat ${{ inputs.output }}
50+
shell: bash

pydeps2env/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@
88
from ._version import __version__
99
except ModuleNotFoundError:
1010
__version__ = ""
11-

pydeps2env/environment.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,12 @@ def load_pyproject(self):
7777
for dep in extra_deps:
7878
add_requirement(dep, self.requirements)
7979

80-
8180
def load_config(self):
8281
"""Load contents from a cfg file (assume setup.cfg layout)."""
8382
cp = configparser.ConfigParser(
84-
converters={"list": lambda x: [i.strip() for i in x.split("\n") if i.strip()]}
83+
converters={
84+
"list": lambda x: [i.strip() for i in x.split("\n") if i.strip()]
85+
}
8586
)
8687
cp.read(self.filename)
8788

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name = "pydeps2env"
33
description = "A python helper to generate conda environment files from project dependencies."
44
readme = {file = "README.md", content-type="text/markdown"}
55
keywords = [
6-
"conda", "pyproject",
6+
"conda",
7+
"pyproject",
78
]
89
license = {file = "LICENSE", name="BSD License"}
910
authors = [
@@ -28,9 +29,9 @@ dynamic = [
2829
"version", # version gets derived from git by setuptools_scm.
2930
]
3031
dependencies = [
31-
"tomli",
3232
"packaging",
3333
"pyyaml",
34+
"tomli",
3435
]
3536
[project.optional-dependencies]
3637
test = [

test/pyproject.toml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
[project]
22
name = "test"
3-
author = "Cagtay Fabry <cagtay.fabry@bam.de>"
4-
author_email = "cagtay.fabry@bam.de"
5-
63
requires-python = ">=3.8,<3.10"
4+
classifiers = [
5+
"Programming Language :: Python :: 3 :: Only",
6+
"Programming Language :: Python :: 3.8",
7+
"Programming Language :: Python :: 3.9",
8+
]
79
dependencies = [
8-
"numpy >=1.20",
9-
"pandas >=1.0",
10-
"IPython",
11-
"boltons",
10+
"boltons",
11+
"IPython",
12+
"numpy>=1.20",
13+
"pandas>=1",
1214
]
1315
[project.optional-dependencies]
14-
test = ["pytest"]
15-
pip_only = ["bidict"]
16-
16+
pip_only = [
17+
"bidict",
18+
]
19+
test = [
20+
"pytest",
21+
]
1722
[project.urls]
1823
home_page = "https://github.com/CagtayFabry/pydeps2env"
24+
author = "Cagtay Fabry <cagtay.fabry@bam.de>"
25+
author_email = "cagtay.fabry@bam.de"
1926

20-
# Build system config, pip creates a temporary env with "requires" pkgs.
2127
[build-system]
28+
build-backend = "setuptools.build_meta"
2229
requires = [
23-
"wheel",
24-
"setuptools >= 40.9.0",
30+
"setuptools>=40.9",
2531
"setuptools_scm",
32+
"wheel",
2633
]
27-
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)