-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
186 lines (158 loc) · 5.39 KB
/
pyproject.toml
File metadata and controls
186 lines (158 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
build-backend = "setuptools.build_meta"
[project]
name = "dirac-cwl"
description = "Prototype of CWL used as a production/job workflow language"
readme = "README.md"
requires-python = ">=3.11"
license = "GPL-3.0-only"
license-files = ["LICENSE"]
authors = [{ name = "DIRAC consortium" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
"Topic :: System :: Distributed Computing"
]
dynamic = ["version"]
# Runtime dependencies (what your package needs when installed)
dependencies = [
"cwl-utils",
"cwlformat",
"cwltool",
"dirac>=9.0.0",
"diracx-core>=0.0.8",
"diracx-api>=0.0.8",
"diracx-client>=0.0.8",
"diracx-cli>=0.0.8",
"lbprodrun",
"pydantic",
"pyyaml",
"typer",
"referencing>=0.30",
"rich",
"ruamel.yaml"
]
[project.optional-dependencies]
testing = ["pytest>=6", "pytest-mock", "mypy"]
[project.scripts]
dirac-cwl = "dirac_cwl:app"
crypto = "dirac_cwl.modules.crypto:app"
pi-simulate = "dirac_cwl.modules.pi_simulate:app"
pi-gather = "dirac_cwl.modules.pi_gather:app"
dirac-cwl-run = "dirac_cwl.job.executor.__main__:cli"
dirac-run-lbprodrun-app = "dirac_cwl.job.executor.run_lbprodrun:main"
[project.entry-points."dirac_cwl.execution_hooks"]
QueryBasedPlugin = "dirac_cwl.execution_hooks.plugins:QueryBasedPlugin"
[project.entry-points."dirac_cwl.input_dataset_plugins"]
NoOpInputDatasetPlugin = "dirac_cwl.production.plugins.core:NoOpInputDatasetPlugin"
LHCbBookkeepingPlugin = "dirac_cwl.production.plugins.lhcb:LHCbBookkeepingPlugin"
[tool.setuptools_scm]
[tool.ruff]
line-length = 120
src = ["src", "tests"]
[tool.ruff.lint]
select = ["E", "F", "B", "I", "PLE", "D", "G"]
ignore = ["B905", "B008", "B006"]
[tool.ruff.lint.pydocstyle]
convention = "pep257" # Base convention for Sphinx/reST style docstrings
[tool.mypy]
plugins = ["pydantic.mypy"]
exclude = ["^tests/", "^build/"]
allow_redefinition = true
enable_error_code = ["import", "attr-defined"]
[[tool.mypy.overrides]]
module = ["requests", "yaml"]
ignore_missing_imports = true
[tool.pytest.ini_options]
addopts = [
"-v",
"--ignore=test/test_metadata_plugins_lhcb.py",
"--ignore=test/test_plugins_lhcb.py",
]
asyncio_mode = "auto"
# -------------------------
# Pixi configuration
# -------------------------
[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["linux-64", "osx-64", "osx-arm64"]
# Additional dev-only dependencies (not published with your package)
[tool.pixi.dependencies]
pytest = ">=6"
pytest-mock = "*"
jsonschema = "*" # used in validation
mypy = "*" # if you prefer not to list it under [project].dependencies
ruff = "*" # linter, optional
pre-commit = "*" # git hooks manager
# conda dependencies
python-gfal2 = "*"
m2crypto = "*"
pytest-asyncio = ">=1.3.0,<2"
# Ensure the package is installed in editable mode in the Pixi environment
[tool.pixi.pypi-dependencies]
dirac-cwl = { path = ".", editable = true }
gitlint-core = "*"
[tool.pixi.tasks]
help = "echo 'Available tasks: test, lint, schemas, schemas-json, schemas-yaml, clean-schemas, test-schemas, check-schemas, validate-schemas'"
# Testing
test = "pytest test/ -v"
test-schemas = "pytest test/test_workflows.py::test_run_job_success -k 'test_meta' -v"
# Linting
lint = "mypy src"
# Schema generation tasks
schemas-json = """
echo "Generating JSON schemas..." && \
python scripts/generate_schemas.py \
--output-dir generated_schemas \
--format json \
--individual \
--unified && \
echo "Copying schemas to test locations..." && \
cp generated_schemas/dirac-metadata.json test/schemas/dirac-metadata.json && \
cp generated_schemas/plugins-summary.json test/schemas/plugins-summary.json
"""
schemas-yaml = """
echo "Generating YAML schemas..." && \
python scripts/generate_schemas.py \
--output-dir generated_schemas \
--format yaml \
--unified
"""
schemas = { depends-on = ["schemas-json", "schemas-yaml"] }
# Cleanup
clean-schemas = """
echo "Cleaning generated schemas..." && \
rm -rf generated_schemas/ && \
rm -f test/schemas/dirac-metadata.json \
test/schemas/plugins-summary.json
"""
# Schema validation
check-schemas = """
echo "Checking if schemas are up to date..." && \
python scripts/generate_schemas.py --output-dir /tmp/check_schemas --format json --unified > /dev/null 2>&1 && \
if ! diff -q generated_schemas/dirac-metadata.json /tmp/check_schemas/dirac-metadata.json > /dev/null 2>&1; then \
echo "❌ Schemas are out of date. Run 'pixi run schemas' to update them." && \
exit 1; \
else \
echo "✅ Schemas are up to date."; \
fi && \
rm -rf /tmp/check_schemas
"""
validate-schemas = """
echo "Validating generated schemas..." && \
python -c "
import json, yaml
from pathlib import Path
[print(f'✓ {f}') or json.load(open(f)) for f in Path('generated_schemas').glob('**/*.json')]
[print(f'✓ {f}') or yaml.safe_load(open(f)) for f in Path('generated_schemas').glob('**/*.yaml')]
print('All schemas are valid!')
"
"""
pre-commit-install = "pre-commit install --hook-type pre-commit --hook-type commit-msg"
pre-commit-run = "pre-commit run -a"
# Validate commit messages on current branch against main
check-commits = { cmd = "bash -c 'gitlint --commits ${BASE_SHA:-$(git merge-base HEAD origin/main)}..HEAD'" }