-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtox.ini
More file actions
107 lines (78 loc) · 5.76 KB
/
tox.ini
File metadata and controls
107 lines (78 loc) · 5.76 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
[tox]
envlist =
py{310, 311, 312, 313}-test{,-oldestdeps,-devdeps,-predeps}{,-buildhtml}
requires =
pip >= 19.3.1
[testenv]
description = run tests
setenv =
FIREFLY_URL = https://irsa.ipac.caltech.edu/irsaviewer # fallback url for firefly notebooks if not defined in code
devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/scientific-python-nightly-wheels/simple https://pypi.anaconda.org/astropy/simple
passenv = CI, CIRCLECI, GITHUB_EVENT_NAME, GITHUB_EVENT_PATH, BASE_URL
deps =
# We use these files to specify all the dependencies, and below we override
# versions for specific testing schenarios
-rtest_requirements.txt
-rsite_requirements.txt
-rtutorial_requirements.txt
# Notebooks sets minimums for photutils, astroquery, sep, pyvo, pandas;
# the rest is indirect minimums for those
oldestdeps: numpy==1.24.0
oldestdeps: matplotlib==3.7.0
oldestdeps: scipy==1.10.0
oldestdeps: astropy==5.3.0
oldestdeps: photutils==2.0.0
oldestdeps: astroquery==0.4.10
oldestdeps: firefly_client==3.4.0
oldestdeps: sep==1.4.0
oldestdeps: pyvo==1.5.0
oldestdeps: pandas==1.5.2
# Oldest lsdb is not compatible with the versions above, we skip lsdb notebooks for oldestdeps job
# oldestdeps: lsdb==0.6.6
devdeps: astropy>0.0.dev0
devdeps: git+https://github.com/astropy/pyvo.git#egg=pyvo
devdeps: git+https://github.com/astropy/astroquery.git#egg=astroquery
allowlist_externals = bash
install_command =
# lsdb has tighter minimum dependencies, deal with it here for now, long term handle it from the notebook metadata
# We need to do this here before the dependencies are installed to work around deps conflicts
oldestdeps: bash -c "echo tutorials/techniques-and-tools/irsa-hats-with-lsdb >> ignore_testing; sed -i -e 's|lsdb|\#lsdb|g' tutorial_requirements.txt && python -I -m pip install $@"
# Adding back the default install command
!oldestdeps: python -I -m pip install {opts} {packages}
commands =
pip freeze
# Ignore some tutorials for various types of testing. The individual lists are stored in the `ignore_tutorials`
# directory and are documented about the specific reasons of them included in the ignores. These files are kept under version control.
# The files `ignore_testing` and `ignore_execution` are generated during the CI jobs and are not under version control.
bash -c 'cat ignore_tutorials/ignore_all_testing >> ignore_testing'
bash -c 'if python -c "import platform; print(platform.platform())" | grep -i macos; then cat ignore_tutorials/ignore_osx_testing >> ignore_testing; fi'
bash -c 'if python -c "import platform; print(platform.platform())" | grep -i win; then cat ignore_tutorials/ignore_windows_testing >> ignore_testing; fi'
bash -c 'if [[ $CI == true ]]; then cat ignore_tutorials/ignore_gha_testing >> ignore_testing; fi'
bash -c 'if [[ $CIRCLECI == true ]]; then cat ignore_tutorials/ignore_circleci_testing >> ignore_testing; fi'
buildhtml: bash -c 'cat ignore_tutorials/ignore_rendering_execution >> ignore_testing'
# We use astroquery 0.4.11+ feature in some of the notebooks, ignore them for oldestdeps testing
oldestdeps: bash -c 'for i in tutorials/euclid/4_Euclid_intro_PHZ_catalog tutorials/euclid/5_Euclid_intro_SPE_catalog tutorials/euclid/euclid-cloud-access; do echo $i ; done >> ignore_testing'
# Make a list of all the tutorials to be reused in multiple filtering commands below
bash -c 'find tutorials -name "*md" | xargs grep kernelspec: | awk -F :kernelspec: "{print \$1}" > all_tutorials'
# Make a list of the tutorials changed, we only need this in CI. Also deal with grep's non-zero exit code. Deleted files are ignored.
bash -c 'if [[ $CI == true ]]; then git fetch origin main --depth=1; git diff origin/main --name-only --diff-filter=d tutorials | (grep ".md" || true); fi > changed_tutorials'
# We only skip testing untouched tutorials in PRs; in cron and dispatch all should be tested. Make sure we don't jupytext non-notebook files.
!buildhtml: bash -c 'if [[ $GITHUB_EVENT_NAME == pull_request && -z "$(grep force_run:all_tests ${GITHUB_EVENT_PATH})" ]]; then grep -f changed_tutorials all_tutorials; else cat all_tutorials; fi | grep -vf ignore_testing | xargs jupytext --to notebook '
!buildhtml: bash -c "echo 'Notebooks ignored (not tested/executed) in this job:'; cat ignore_testing | sort | uniq"
!buildhtml: pytest --nbval-lax -vv --suppress-no-test-exit-code --durations=10 tutorials
# We don't want to execute in rendering the ones we ignore for testing
buildhtml: bash -c '(grep -f ignore_testing all_tutorials || true) > ignore_execute'
# On CircleCI rendering preview, we also don't want to execute anything that hasn't been modified
buildhtml: bash -c 'if [[ $CIRCLECI == true ]]; then (grep -vf changed_tutorials all_tutorials || true) >> ignore_execute; fi'
# sed -i needs a bit of hacky conditional on ubuntu to cover the case of an empty ignore
buildhtml: bash -c 'if [ -s ignore_execute ]; then for name in $(cat ignore_execute | sort| uniq); do if [ -z "$(head -n 20 ${name}| grep execute:)" ]; then sed -i -e "s|kernelspec:|execute:\n skip: true\nkernelspec:|g" ${name}; fi; done;fi'
buildhtml: bash -c "echo 'Notebooks ignored (not tested/executed) in this job:'; cat ignore_execute | sort | uniq"
# Build the MyST plugin bundle before building the site with jupyter-book
buildhtml: bash -c "cd plugins && npm install && npm run build"
# Using srtict so we fail with trackbacks and debug mode to have a richer log
# For full build we disable parallel runs to easy server load
buildhtml: bash -c "jupyter-book build --execute --execute-parallel 1 --html --strict -d"
pip_pre =
predeps: true
!predeps: false
skip_install = true