-
Notifications
You must be signed in to change notification settings - Fork 151
/
Copy pathhatch.toml
134 lines (122 loc) · 4.62 KB
/
hatch.toml
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
[envs.all]
[[envs.all.matrix]]
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
[envs.all.overrides]
# Kedro is currently not compatible with Python 3.13 and returns exceptions when trying to run the unit tests on
# Python 3.13. These exceptions turned out to be difficult to ignore: https://github.com/mckinsey/vizro/pull/216
matrix.python.features = [
{value = "kedro", if = ["3.9", "3.10", "3.11", "3.12"]}
]
[envs.changelog]
dependencies = ["scriv"]
detached = true
installer = "uv"
scripts = {add = "scriv create --add", collect = ["scriv collect --add", "- pre-commit run --files=CHANGELOG.md > /dev/null"]}
[envs.default]
dependencies = [
"devtools[pygments]",
"coverage[toml]>=6.5",
"pytest",
"pytest-mock",
"freezegun>=1.5.0",
"dash[testing]",
"chromedriver-autoinstaller>=0.6.4",
"toml",
"pyyaml",
"openpyxl",
"jupyter",
"pre-commit",
"PyGithub",
"imutils",
"opencv-python",
"pyhamcrest"
]
installer = "uv"
[envs.default.scripts]
example = "hatch run examples:example {args:scratch_dev}" # shortcut script to underlying example environment script.
lint = "pre-commit run {args} --all-files"
pip = '"{env:HATCH_UV}" pip {args}'
prep-release = [
"hatch version release",
"hatch run changelog:collect",
"hatch run changelog:add",
"rm -rf schemas/*json",
"schema",
"git add schemas",
'echo "Now raise a PR to merge into main with title: [Release] Release of vizro $(hatch version)"'
]
pypath = "python -c 'import sys; print(sys.executable)'"
# Only run pre-commit hooks when schema is generated, not when it's checked. This keeps the check fast in CI.
schema = ["python schemas/generate.py", '- pre-commit run --files="schemas/$(hatch version).json" > /dev/null']
schema-check = ["python schemas/generate.py --check"]
templates = [
"python src/vizro/_themes/generate_plotly_templates.py",
'- pre-commit run --files src/vizro/_themes/vizro_dark.json src/vizro/_themes/vizro_light.json > /dev/null'
]
templates-check = ["python src/vizro/_themes/generate_plotly_templates.py --check"]
# Note `hatch run test` currently fails due to interference between integration tests and unit tests. Ideally we would
# fix this, but we don't actually use `hatch run test` anywhere right now.
# See comments added in https://github.com/mckinsey/vizro/pull/444.
test = "pytest tests --headless {args}"
test-e2e-component-library = "pytest tests/e2e/test_component_library.py --headless {args}"
test-integration = "pytest tests/integration --headless {args}"
test-js = "./tools/run_jest.sh {args}"
test-unit = "pytest tests/unit {args}"
test-unit-coverage = [
"coverage run -m pytest tests/unit {args}",
"- coverage combine",
"coverage report"
]
[envs.docs]
dependencies = [
"mkdocs>=1.6",
"mkdocs-material",
"mkdocs-git-revision-date-localized-plugin>=1.2.5",
"mkdocstrings[python]",
"linkchecker",
"mkdocs-pycafe"
]
detached = true
installer = "uv"
[envs.docs.scripts]
build = "mkdocs build --strict"
# Disable warnings on the linkcheck so that HTTP redirects are accepted. We could ignore only that warning and specify
# more advanced settings using a linkcheckerrc config file.
link-check = "linkchecker site --check-extern --no-warnings --ignore=404.html --ignore-url=127.0.0.1 --ignore-url=https://vizro.readthedocs.io/"
pip = '"{env:HATCH_UV}" pip {args}'
serve = "mkdocs serve --open"
[envs.examples]
# TODO: once the visual-vocabulary dashboard has moved out of this repo, this environment should be removed fully and
# examples should just run in the default environment like they used to so that there's only one Python interpreter
# used while debugging. Remember to update devcontainer hatch run command to not use examples environment then.
dependencies = [
"pyyaml",
"openpyxl",
# black, autoflake and isort required to run the example visual-vocabulary. This is completely independent of the
# tools used in linting our code. When this moves to HuggingFace we can remove the requirement from here.
"autoflake==2.3.1",
"black==24.4.2",
"isort==5.13.2",
"plotly==5.24.1" # to leverage new MapLibre features in visual-vocabulary
]
installer = "uv"
scripts = {example = "cd examples/{args:scratch_dev}; python app.py"}
# This environment doesn't inherit from default but does install Vizro.
template = "examples"
[envs.examples.env-vars]
DASH_DEBUG = "true"
VIZRO_LOG_LEVEL = "DEBUG"
[envs.lower-bounds]
extra-dependencies = [
"pydantic==1.10.16",
"dash==2.18.0",
"plotly==5.12.0",
"pandas==2.0.0",
"numpy==1.23.0" # Need numpy<2 to work with pandas==2.0.0. See https://stackoverflow.com/questions/78634235/.
]
features = ["kedro"]
python = "3.9"
[publish.index]
disable = true
[version]
path = "src/vizro/__init__.py"