hatch.toml•7.7 kB
[envs.all]
[[envs.all.matrix]]
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]
[envs."all.py3.14"]
# Make sys.warnoptions non-empty so that Kedro doesn't turn its Python 3.14 warning into an error.
# This means we can ignore it like others in tool.pytest.ini_options.filterwarnings.
env-vars = {PYTHONWARNINGS = "default"}
[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",
"pytest-rerunfailures",
"pytest-split",
"pytest-json-ctrf",
"pytest-order",
"freezegun>=1.5.0",
"dash[testing]",
"chromedriver-autoinstaller>=0.6.4",
"toml",
"pyyaml",
"openpyxl",
"jupyter",
"pre-commit",
"PyGithub",
"pyhamcrest",
"gunicorn",
"pixelmatch",
"playwright",
# seaborn and scikit-learn are needed for tests of kedro integration on real project.
# We don't use kedro-datasets since it can lower our versions of important dependencies like plotly where
# we want to be testing the latest.
"seaborn",
"scikit-learn"
]
features = ["kedro"]
installer = "uv"
# Pin Python version so that `hatch run test` etc. give consistent behavior.
python = "3.13"
[envs.default.env-vars]
PYTHONPATH = "tests/e2e/vizro/dashboards/default:tests/e2e/vizro/dashboards/yaml:tests/tests_utils:tests/e2e/vizro/custom_components"
[envs.default.scripts]
download-static-files = "python tools/download_static_files.py"
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/_static_template_generator.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/_static_template_generator.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 -vs tests/e2e/component_library/test_component_library.py --headless {args}"
test-e2e-vizro-dom-elements = [
"gunicorn dashboard:app -b 0.0.0.0:5002 -w 1 --timeout 90 &",
"gunicorn dashboard_yaml:app -b 0.0.0.0:5007 -w 1 --timeout 90 &",
"tests/tests_utils/e2e/vizro/dashboards/wait-for-it.sh 127.0.0.1:5002 -t 30",
"tests/tests_utils/e2e/vizro/dashboards/wait-for-it.sh 127.0.0.1:5007 -t 30",
"pytest -vs --reruns 1 --ctrf ../.ctrf/ctrf-report.json tests/e2e/vizro/test_dom_elements --headless {args}"
]
test-e2e-vizro-http-requests = [
"gunicorn dashboard_http_requests:app -b 0.0.0.0:5002 -w 1 --timeout 90 &",
"tests/tests_utils/e2e/vizro/dashboards/wait-for-it.sh 127.0.0.1:5002 -t 30",
"pytest -vs --reruns 1 tests/e2e/vizro/test_http_requests --headless {args}"
]
test-e2e-vizro-screenshots = [
"gunicorn dashboard:app -b 0.0.0.0:5002 -w 1 --timeout 90 &",
"gunicorn dashboard_one_page:app -b 0.0.0.0:5003 -w 1 --timeout 90 &",
"gunicorn dashboard_navbar_accordions:app -b 0.0.0.0:5004 -w 1 --timeout 90 &",
"gunicorn dashboard_navbar_pages:app -b 0.0.0.0:5005 -w 1 --timeout 90 &",
"gunicorn dashboard_navbar_navlink:app -b 0.0.0.0:5006 -w 1 --timeout 90 &",
"tests/tests_utils/e2e/vizro/dashboards/wait-for-it.sh 127.0.0.1:5002 -t 30",
"tests/tests_utils/e2e/vizro/dashboards/wait-for-it.sh 127.0.0.1:5003 -t 30",
"tests/tests_utils/e2e/vizro/dashboards/wait-for-it.sh 127.0.0.1:5004 -t 30",
"tests/tests_utils/e2e/vizro/dashboards/wait-for-it.sh 127.0.0.1:5005 -t 30",
"tests/tests_utils/e2e/vizro/dashboards/wait-for-it.sh 127.0.0.1:5006 -t 30",
"pytest -vs --reruns 1 --ctrf ../.ctrf/ctrf-report.json tests/e2e/vizro/test_screenshots/ --headless {args}"
]
test-integration = "pytest --ctrf ../.ctrf/ctrf-report.json 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]",
"griffe-warnings-deprecated",
"mkdocs-llmstxt-md",
"mkdocs-llmstxt>=0.5.0",
"linkchecker",
"mkdocs-open-in-new-tab",
"mkdocs-pycafe",
"PyGithub",
"playwright"
]
installer = "uv"
template = "docs" # Can't be detached = true since griffe_extensions:DynamicallyInspect needs vizro to be importable.
[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/ --ignore-url=https://platform.ploomber.io/register --ignore-url=https://huggingface.co/join --ignore-url=https://www.ag-grid.com/"
# Check if link to QB logo is not deleted from the docs.
logo-check = "grep -q 'logo_watermark_extended.svg' docs/pages/user-guides/install.md"
pip = '"{env:HATCH_UV}" pip {args}'
pycafe-links = "../tools/pycafe/docs_links_filtering.sh"
serve = "mkdocs serve --open {args}"
[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==6.0.0" # 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 = [
"dash==3.1.1",
"dash-bootstrap-components==2.0.0",
"dash-ag-grid==31.3.1",
"dash-mantine-components==1.0.0",
"plotly==5.24.0",
"pydantic==2.7.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/.
"kedro==0.19.9"
]
python = "3.10"
[publish.index]
disable = true
[version]
path = "src/vizro/__init__.py"