Update configparser SafeConfigParser and readfp, new in python 3.12 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docs | |
on: [push, release] | |
jobs: | |
fast_notebooks: | |
name: "Build the fast notebooks" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: install latex | |
uses: xu-cheng/texlive-action/small@v1 | |
- name: Init Environment | |
shell: bash -l {0} | |
run: | | |
set -e | |
# brew update | |
# brew install --cask basictex | |
pip install -U cython | |
pip install -U numpy scipy matplotlib | |
pip install -U jupytext jupyterthemes jupyter_latex_envs | |
pip install -U astropy | |
pip install emcee ultranest | |
pip install zeus-mcmc | |
#pip install git+https://github.com/desihub/speclite.git | |
pip install --upgrade speclite | |
pip install "black<24" | |
pip install astromodels | |
- name: Install the package | |
shell: bash -l {0} | |
run: | | |
if [[ "${ISDEV}" == "true" ]]; then | |
pip install --upgrade --pre astromodels | |
#pip install git+https://github.com/threeML/astromodels.git@dev | |
else | |
pip install --upgrade astromodels | |
fi | |
pip install -e . | |
env: | |
ISDEV: ${{contains(github.ref, 'dev') || contains(github.base_ref, 'dev')}} | |
- name: Execute the notebooks | |
shell: bash -l {0} | |
run: | | |
# Make sure we fail in case of error | |
set -e | |
# copy the doc configuration over | |
mkdir -p ~/.config/threeML | |
cp threeML/data/doc_config.yml ~/.config/threeML/ | |
jupytext --to ipynb --pipe black --execute docs/md_docs/fast_execute/*.md | |
mv docs/md_docs/fast_execute/*.ipynb docs/notebooks/ | |
ls docs/notebooks | |
env: | |
OMP_NUM_THREADS: 1 | |
MKL_NUM_THREADS: 1 | |
NUMEXPR_NUM_THREADS: 1 | |
MPLBACKEND: "Agg" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: notebooks-for-fast-${{ github.sha }} | |
path: docs/notebooks | |
hal_notebooks: | |
name: "Build the HAL notebooks" | |
runs-on: macos-12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache conda | |
uses: actions/cache@v4 | |
env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: conda-hal_notebooks-python-3.9-${{ hashFiles('ci/environment_hal.yml') }} | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
auto-activate-base: false | |
#mamba-version: "*" | |
activate-environment: test_env | |
python-version: 3.9 | |
channels: conda-forge, threeml, defaults | |
environment-file: ci/environment_hal.yml | |
use-only-tar-bz2: true | |
- name: Init Environment | |
shell: bash -l {0} | |
run: | | |
# Make sure we fail in case of error | |
set -e | |
# miniconda_os=Linux | |
# compilers="gcc_linux-64 gxx_linux-64 gfortran_linux-64" | |
miniconda_os=MacOSX | |
compilers="clang_osx-64 clangxx_osx-64 gfortran_osx-64" | |
brew update | |
brew install --cask basictex | |
eval "$(/usr/libexec/path_helper)" | |
#sudo apt-get install texlive | |
conda install ${compilers} jupytext jupyterthemes jupyter_latex_envs emcee pymultinest ultranest | |
- name: Install the package | |
shell: bash -l {0} | |
run: | | |
pip install "black<24" | |
pip install --upgrade speclite | |
pip install git+https://github.com/threeml/hawc_hal.git | |
if [[ "${ISDEV}" == "true" ]]; then | |
pip install --upgrade --pre astromodels | |
#pip install git+https://github.com/threeML/astromodels.git@dev | |
else | |
pip install --upgrade astromodels | |
fi | |
pip install -e . | |
env: | |
ISDEV: ${{contains(github.ref, 'dev') || contains(github.base_ref, 'dev')}} | |
- name: Execute the notebooks | |
shell: bash -l {0} | |
run: | | |
# Make sure we fail in case of error | |
set -e | |
# copy the doc configuration over | |
mkdir -p ~/.config/threeML | |
cp threeML/data/doc_config.yml ~/.config/threeML/ | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/hal_example.md | |
mv docs/md_docs/slow_execute/hal_example.ipynb docs/notebooks/ | |
ls docs/notebooks | |
env: | |
OMP_NUM_THREADS: 1 | |
MKL_NUM_THREADS: 1 | |
NUMEXPR_NUM_THREADS: 1 | |
MPLBACKEND: "Agg" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: notebooks-for-hal-${{ github.sha }} | |
path: docs/notebooks | |
fermi_notebooks: | |
name: "Build the Fermi notebooks" | |
runs-on: macos-12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache conda | |
uses: actions/cache@v4 | |
env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: conda-fermi_notebooks-python-3.7-${{ hashFiles('ci/environment_fermi.yml') }} | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
auto-activate-base: false | |
#mamba-version: "*" | |
activate-environment: test_env | |
python-version: 3.9 | |
channels: conda-forge, fermi, threeml, defaults | |
environment-file: ci/environment_fermi.yml | |
use-only-tar-bz2: true | |
- name: Init Environment | |
shell: bash -l {0} | |
run: | | |
# Make sure we fail in case of error | |
set -e | |
# miniconda_os=Linux | |
# compilers="gcc_linux-64 gxx_linux-64 gfortran_linux-64" | |
miniconda_os=MacOSX | |
compilers="clang_osx-64 clangxx_osx-64 gfortran_osx-64" | |
brew update | |
brew install --cask basictex | |
eval "$(/usr/libexec/path_helper)" | |
#sudo apt-get install texlive | |
conda install ${compilers} jupytext jupyterthemes jupyter_latex_envs emcee pymultinest ultranest | |
- name: Install the package | |
shell: bash -l {0} | |
run: | | |
pip install "black<24" fermipy | |
pip install --upgrade speclite | |
if [[ "${ISDEV}" == "true" ]]; then | |
pip install --upgrade --pre astromodels | |
#pip install git+https://github.com/threeML/astromodels.git@dev | |
else | |
pip install --upgrade astromodels | |
fi | |
pip install -e . | |
env: | |
ISDEV: ${{contains(github.ref, 'dev') || contains(github.base_ref, 'dev')}} | |
- name: Execute the notebooks | |
shell: bash -l {0} | |
run: | | |
# Make sure we fail in case of error | |
set -e | |
# copy the doc configuration over | |
mkdir -p ~/.config/threeML | |
cp threeML/data/doc_config.yml ~/.config/threeML/ | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/Fermipy_LAT.md | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/LAT_Transient_Builder_Example.md | |
#jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/optimizer_docs.md | |
mv docs/md_docs/slow_execute/*.ipynb docs/notebooks/ | |
ls docs/notebooks | |
env: | |
OMP_NUM_THREADS: 1 | |
MKL_NUM_THREADS: 1 | |
NUMEXPR_NUM_THREADS: 1 | |
MPLBACKEND: "Agg" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: notebooks-for-fermi-${{ github.sha }} | |
path: docs/notebooks | |
xspec_notebooks: | |
name: "Build the XSPEC notebooks" | |
runs-on: macos-12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache conda | |
uses: actions/cache@v4 | |
env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: conda-xspec_notebooks-python-3.9-${{ hashFiles('ci/environment_xspec.yml') }} | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
auto-activate-base: false | |
miniforge-variant: Mambaforge | |
activate-environment: test_env | |
python-version: 3.9 | |
channels: threeml, conda-forge, xspecmodels, defaults | |
environment-file: ci/environment_xspec.yml | |
use-only-tar-bz2: true | |
- name: Init Environment | |
shell: bash -l {0} | |
run: | | |
# Make sure we fail in case of error | |
set -e | |
# miniconda_os=Linux | |
# compilers="gcc_linux-64 gxx_linux-64 gfortran_linux-64" | |
miniconda_os=MacOSX | |
compilers="clang_osx-64 clangxx_osx-64 gfortran_osx-64" | |
brew update | |
brew install --cask basictex | |
eval "$(/usr/libexec/path_helper)" | |
#sudo apt-get install texlive | |
mamba install ${compilers} jupytext jupyterthemes jupyter_latex_envs emcee pymultinest ultranest | |
- name: Install the package | |
shell: bash -l {0} | |
run: | | |
pip install zeus_mcmc dynesty "black<24" | |
pip install --upgrade speclite | |
#pip install git+https://github.com/desihub/speclite.git | |
if [[ "${ISDEV}" == "true" ]]; then | |
pip install --upgrade --pre astromodels | |
#pip install git+https://github.com/threeML/astromodels.git@dev | |
else | |
pip install --upgrade astromodels | |
fi | |
pip install -e . | |
env: | |
ISDEV: ${{contains(github.ref, 'dev') || contains(github.base_ref, 'dev')}} | |
- name: Execute the notebooks | |
shell: bash -l {0} | |
run: | | |
# Make sure we fail in case of error | |
set -e | |
# copy the doc configuration over | |
mkdir -p ~/.config/threeML | |
cp threeML/data/doc_config.yml ~/.config/threeML/ | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/xspec_models.md | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/joint_fitting_xrt_and_gbm_xspec_models.md | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/Photometry_demo.md | |
mv docs/md_docs/slow_execute/*.ipynb docs/notebooks/ | |
ls docs/notebooks | |
env: | |
OMP_NUM_THREADS: 1 | |
MKL_NUM_THREADS: 1 | |
NUMEXPR_NUM_THREADS: 1 | |
MPLBACKEND: "Agg" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: notebooks-for-xspec-${{ github.sha }} | |
path: docs/notebooks | |
multinest_notebooks: | |
name: "Build the multinest notebooks" | |
runs-on: macos-12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache conda | |
uses: actions/cache@v4 | |
env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: conda-hal_notebooks-python-3.7-${{ hashFiles('ci/environment_hal.yml') }} | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
auto-activate-base: false | |
#mamba-version: "*" | |
activate-environment: test_env | |
python-version: ${{ matrix.python-version }} | |
channels: conda-forge, threeml, defaults | |
environment-file: ci/environment_hal.yml | |
use-only-tar-bz2: true | |
- name: Init Environment | |
shell: bash -l {0} | |
run: | | |
# Make sure we fail in case of error | |
set -e | |
# miniconda_os=Linux | |
# compilers="gcc_linux-64 gxx_linux-64 gfortran_linux-64" | |
miniconda_os=MacOSX | |
compilers="clang_osx-64 clangxx_osx-64 gfortran_osx-64" | |
brew update | |
brew install --cask basictex | |
eval "$(/usr/libexec/path_helper)" | |
#sudo apt-get install texlive | |
conda install ${compilers} jupytext jupyterthemes jupyter_latex_envs emcee ultranest | |
- name: Install the package | |
shell: bash -l {0} | |
run: | | |
pip install zeus_mcmc dynesty "black<24" | |
pip install --upgrade speclite | |
#pip install git+https://github.com/desihub/speclite.git | |
#pip install --no-binary :all: root_numpy | |
if [[ "${ISDEV}" == "true" ]]; then | |
pip install --upgrade --pre astromodels | |
#pip install git+https://github.com/threeML/astromodels.git@dev | |
else | |
pip install --upgrade astromodels | |
fi | |
pip install -e . | |
env: | |
ISDEV: ${{contains(github.ref, 'dev') || contains(github.base_ref, 'dev')}} | |
- name: Execute the notebooks | |
shell: bash -l {0} | |
run: | | |
# Make sure we fail in case of error | |
set -e | |
# copy the doc configuration over | |
mkdir -p ~/.config/threeML | |
cp threeML/data/doc_config.yml ~/.config/threeML/ | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/Bayesian_tutorial.md | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/sampler_docs.md | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/Minimization_tutorial.md | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/grb080916C.md | |
jupytext --to ipynb --pipe black --execute docs/md_docs/slow_execute/joint_BAT_gbm_demo.md | |
mv docs/md_docs/slow_execute/*.ipynb docs/notebooks/ | |
ls docs/notebooks | |
env: | |
OMP_NUM_THREADS: 1 | |
MKL_NUM_THREADS: 1 | |
NUMEXPR_NUM_THREADS: 1 | |
MPLBACKEND: "Agg" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: notebooks-for-multinest-${{ github.sha }} | |
path: docs/notebooks | |
upload_notebooks: | |
needs: [fast_notebooks, fermi_notebooks, hal_notebooks, xspec_notebooks, multinest_notebooks] | |
name: "Upload notebooks and trigger RTD" | |
runs-on: macos-12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@master | |
with: | |
name: notebooks-for-fermi-${{ github.sha }} | |
path: docs/notebooks | |
- uses: actions/download-artifact@master | |
with: | |
name: notebooks-for-fast-${{ github.sha }} | |
path: docs/notebooks | |
- uses: actions/download-artifact@master | |
with: | |
name: notebooks-for-hal-${{ github.sha }} | |
path: docs/notebooks | |
- uses: actions/download-artifact@master | |
with: | |
name: notebooks-for-xspec-${{ github.sha }} | |
path: docs/notebooks | |
- uses: actions/download-artifact@master | |
with: | |
name: notebooks-for-multinest-${{ github.sha }} | |
path: docs/notebooks | |
- name: Check that all notebooks are there | |
shell: bash -l {0} | |
run: | | |
ls docs/notebooks | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: notebooks-for-${{ github.sha }} | |
path: docs/notebooks | |
- name: Sleep for 10 min | |
uses: juliangruber/sleep-action@v1 | |
with: | |
time: 10m | |
- name: Trigger RTDs build | |
uses: dfm/rtds-action@main | |
with: | |
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }} | |
webhook_token: ${{ secrets.RTDS_WEBHOOK_TOKEN }} | |
commit_ref: ${{ github.ref }} | |
api_doc: | |
name: "Create the API stubs" | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Build the API doc | |
run: | | |
brew install c-blosc | |
brew install hdf5 | |
pip3 install cython tempita | |
pip3 install cython blosc2 h5py | |
pip3 install numpy scipy numba astropy pandas | |
pip3 install wheel pkgconfig numexpr | |
#python setup.py develop | |
pip3 install -e . | |
brew install sphinx-doc pandoc | |
pip3 install mock recommonmark | |
pip3 install sphinx-rtd-dark-mode | |
pip3 install -U sphinx | |
sphinx-apidoc -f -o docs/api/ threeML | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: api-stubs-for-${{ github.sha }} | |
path: docs/api | |
build_docs: | |
name: "Build the Documentation" | |
runs-on: macos-12 | |
needs: [upload_notebooks, api_doc] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Install package | |
run: | | |
brew install c-blosc | |
brew install hdf5 | |
pip3 install wheel pkgconfig | |
pip3 install tempita | |
pip3 install cython blosc2 h5py | |
pip3 install numpy scipy numba astropy | |
brew install sphinx-doc pandoc | |
pip3 install mock recommonmark | |
pip3 install sphinx-rtd-dark-mode sphinx-math-dollar | |
pip3 install -U sphinx | |
pip3 install -r docs/requirements.txt | |
if [[ "${ISDEV}" == "true" ]]; then | |
pip install --upgrade --pre astromodels | |
#pip install git+https://github.com/threeML/astromodels.git@dev | |
else | |
pip install --upgrade astromodels | |
fi | |
pip install -e . | |
rm -rf docs/md_docs/* | |
env: | |
ISDEV: ${{contains(github.ref, 'dev') || contains(github.base_ref, 'dev')}} | |
- uses: actions/download-artifact@master | |
with: | |
name: notebooks-for-${{ github.sha }} | |
path: docs/notebooks | |
- uses: actions/download-artifact@master | |
with: | |
name: api-stubs-for-${{ github.sha }} | |
path: docs/notebooks/api | |
- name: Build and Commit | |
uses: sphinx-notes/pages@v2 | |
with: | |
documentation_path: docs | |
sphinx_version: 5.1.1 | |
requirements_path: docs/requirements.txt | |
- name: Push changes | |
if: github.event_name == 'push' #&& startsWith(github.event.ref, 'refs/tags') | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages |