Skip to content

Commit c6bc43d

Browse files
TY-Chengtvattergagrawal009KiranReddy0808
authored
non-parametric bicops (tll, fastKDE); examples (#38)
* onto torch.nn.Module based on fastkde, built by uv poetry -> uv bicop.BiCop vinecop.VineCop examples/*cop.ipynb ================== TODO: bicop: fastkde.pdf vinecop: rosenblatt examples: app jupyterNB Co-Authored-By: Thibault Vatter <[email protected]> * update uv cuda cmd; update .toml file uv for cuda user: uv sync --extra cu126 -U * use fastkde.pdf instead of pdf_at_points * `pdf_at_points()` is potentially slow relative to `pdf()` cuz it does not take advantage of the inverse FFT for transforming from Fourier space to data space; * num_step_grid has to be a power of 2; * padding/trimming incurred; * update .toml, readme * marginals of kdeCDFPPF1D, inside VineCop util.kdeCDFPPF1D: a small class, fit at init time; stored inside VineCop.marginals * Create 2_num_hfunc.ipynb * BUGFIX: vinecop: cond sample marginal cdf added apply marginal cdf if user is giving obs (conditional simulation) * update VineCop.sample() for QR if top lv then marginal cdf, else nothing happen (quantile regression for experienced users) * no_grad onto bidepfunc; use ferreiraTDC symmetry experiments: randomsearch, more data/alpha/repeats/pipelineparaspace * benchmark fit/sample/pdf on cpu/cuda * update .toml, README, benchmark * create readme for examples/benchmark * examples/vinecop monotonic tests; examples/vinecop monotonic tests; examples/bicop range tests; examples/num_hfunc fig; minor tidying. * Add tll * update examples/bicop for tll * clamp guard for [0,1] * minor tidying * add pred intvl experiment scripts drop QR scripts * pred_intvl: readme; LICENSE (credit); * update docstring * Add issues * Add issues * Add issues+1 * Add issues+2 * transpose, fliplr * Final MNIST experiment * Final MNIST experiment * Squashed commit of the following: commit a9f6811f44fbbcebd908e5595241e4f0258c4365 Merge: 4688a0d 5ac1502 Author: Tuoyuan Cheng <[email protected]> Date: Tue May 20 13:31:31 2025 +0800 Merge branch 'pr/34' into dev_ian commit 4688a0d Author: Tuoyuan Cheng <[email protected]> Date: Mon Apr 28 10:05:55 2025 +0800 WIP poetry -> uv many parametric bicops: parameter as torch.Tensor commit 5ac1502 Author: gagrawal009 <[email protected]> Date: Sat Jan 11 14:32:29 2025 +0530 par changed to torch.tensor commit c7bfedc Author: gagrawal009 <[email protected]> Date: Sat Jan 11 14:03:00 2025 +0530 par changed to torch.tensor commit 1dddbfb Author: Tuoyuan Cheng <[email protected]> Date: Tue Jan 7 14:02:19 2025 +0800 Dev ian (#33) * par changed to torch.tensor --------- Co-authored-by: gagrawal009 <[email protected]> commit ef95b6f Author: gagrawal009 <[email protected]> Date: Sat Jan 4 21:58:52 2025 +0530 par changed to torch.tensor commit 311d196 Author: gagrawal009 <[email protected]> Date: Fri Jan 3 23:56:10 2025 +0530 par changed to torch.tensor commit 976e040 Author: gagrawal009 <[email protected]> Date: Fri Jan 3 23:47:11 2025 +0530 par changed to torch.tensor commit 7ee503a Author: gagrawal009 <[email protected]> Date: Fri Jan 3 16:46:26 2025 +0530 par changed to torch.tensor commit f5a8d0e Author: Tuoyuan Cheng <[email protected]> Date: Wed Jan 1 13:55:33 2025 +0800 main branch only: publish-package and static commit 814be0b Author: Tuoyuan Cheng <[email protected]> Date: Wed Jan 1 13:04:04 2025 +0800 rm in-place ops commit 81301d2 Author: Tuoyuan Cheng <[email protected]> Date: Sun Dec 22 18:25:50 2024 +0800 ruff commit 4d059ff Merge: bf0d8a1 a7b356f Author: Tuoyuan Cheng <[email protected]> Date: Sun Dec 22 18:23:11 2024 +0800 Merge branch 'main' into dev_ian commit bf0d8a1 Author: ian <[email protected]> Date: Thu Dec 5 13:53:25 2024 +0800 _EPS: abc, bb1678 commit c4fad3d Author: ian <[email protected]> Date: Mon Dec 2 23:57:37 2024 +0800 tawn1,2; bb1678 par2tau commit bb89a0b Author: ian <[email protected]> Date: Tue Nov 26 21:18:32 2024 +0800 BiCopExtremeValue (bb5); BiCopArchimedean (bb1,6,7,8); solve_ITP_vectorize for hinv1_0 commit 5b8ab4c Author: ian <[email protected]> Date: Thu Nov 7 22:28:08 2024 +0800 archimedean: par2tau_0, numint by Simpson's rule commit a98436e Author: ian <[email protected]> Date: Tue Nov 5 17:37:50 2024 +0800 bb1: hinv newton, tau2par quasi mle TODO: test refactoring, abc hinv1_num invert_f commit 5f8149e Author: ian <[email protected]> Date: Mon Nov 4 23:21:49 2024 +0800 solve_ITP; bb1: cdf, pdf, l_pdf, hfun1 TODO: hinv1, tau2par, par2tau commit 0b64f8e Merge: 8346878 7fa729b Author: ian <[email protected]> Date: Mon Nov 4 17:30:53 2024 +0800 Merge remote-tracking branch 'forked_repo/feature/bb1' into dev_ian commit 7fa729b Author: Sai Kiran Reddy Poreddy <[email protected]> Date: Mon Nov 4 17:23:04 2024 +0800 Bb1 Test resolution commit 8346878 Merge: 7aa9508 c3a4776 Author: ian <[email protected]> Date: Mon Nov 4 16:39:20 2024 +0800 Merge branch 'main' into dev_ian commit 7aa9508 Merge: 67457bb aff8a9d Author: ian <[email protected]> Date: Wed Oct 23 09:57:13 2024 +0800 Merge remote-tracking branch 'origin/benchmark_tvc_pvc' into dev_ian commit aff8a9d Author: Thibault Vatter <[email protected]> Date: Tue Oct 22 16:50:24 2024 +0200 Proper simulation study commit 8a788fa Author: Thibault Vatter <[email protected]> Date: Tue Oct 22 15:21:08 2024 +0200 benchmarking notebook commit 67457bb Merge: aaf91f2 41bacc9 Author: ian <[email protected]> Date: Thu Oct 17 00:20:12 2024 +0800 Merge branch 'main' into dev_ian commit a2972d6 Author: Sai Kiran Reddy Poreddy <[email protected]> Date: Wed Oct 16 23:25:31 2024 +0800 Support bb1 bicop commit aaf91f2 Author: ian <[email protected]> Date: Wed Oct 16 21:05:33 2024 +0800 gh-pages branch for docs (Sai); Dvine one set empty commit 9385803 Merge: d5121e0 1532674 Author: ian <[email protected]> Date: Wed Oct 16 19:35:32 2024 +0800 Merge remote-tracking branch 'forked_repo/main' into dev_ian commit 1532674 Author: Sai Kiran Reddy Poreddy <[email protected]> Date: Wed Oct 16 15:09:10 2024 +0800 Remove html files commit 18aad45 Author: Sai Kiran Reddy Poreddy <[email protected]> Date: Wed Oct 16 15:07:27 2024 +0800 Ignore html files commit 6902e6f Author: Sai Kiran Reddy Poreddy <[email protected]> Date: Wed Oct 16 15:06:57 2024 +0800 Add clean option commit 034c4ab Author: Sai Kiran Reddy Poreddy <[email protected]> Date: Wed Oct 16 15:06:28 2024 +0800 Use sphinx_pyproject for config commit dd9b534 Author: Sai Kiran Reddy Poreddy <[email protected]> Date: Wed Oct 16 15:05:05 2024 +0800 commit to gh-pages commit d5121e0 Merge: c451e67 ad544de Author: ian <[email protected]> Date: Tue Oct 8 11:52:19 2024 +0800 Merge branch 'main' into dev_ian commit c451e67 Author: ian <[email protected]> Date: Tue Oct 8 11:17:54 2024 +0800 dvine: s_first can be in the middle! sim: sobol seq dvine: TSP with precedence constraints or clustered TSP cvine/rvine: min heap DataBiCop.sim: is_sobol DataVineCop.sim: is_sobol commit 11566f1 Merge: 9c26242 687c4bb Author: TYCheng <[email protected]> Date: Wed Sep 25 20:17:00 2024 +0800 Merge branch 'main' into dev_ian commit 9c26242 Author: TYCheng <[email protected]> Date: Wed Sep 25 20:14:05 2024 +0800 update source files commit db1fd00 Author: TYCheng <[email protected]> Date: Wed Sep 25 20:13:09 2024 +0800 Squashed commit of the following: commit 687c4bb Author: Tuoyuan Cheng <[email protected]> Date: Fri Aug 23 18:03:40 2024 +0800 sampling order (tpl_sim) and vcp_from_sim (#25) * Update python-package.yml util.__init__ : ref_count_hfunc() to greedily find tpl_sim with min hfunc calls vinecop._data_vcp : one visit() for both hfunc and hinv in sim vinecop._factory_vcp: code refactoring to include the above * pyproject.toml, stdtr/stdtrit, README drop torch dependency for user customization * Update .yml pytest ./tests matrix.os * README, test_vinecop * sampling order, simplified commit 7a713c2 Author: TYCheng <[email protected]> Date: Wed Sep 25 20:10:33 2024 +0800 _data_vcp: sim, is_antithetic commit a587c0a Author: TYCheng <[email protected]> Date: Wed Sep 25 20:04:51 2024 +0800 Squashed commit of the following: commit 687c4bb Author: Tuoyuan Cheng <[email protected]> Date: Fri Aug 23 18:03:40 2024 +0800 sampling order (tpl_sim) and vcp_from_sim (#25) * Update python-package.yml util.__init__ : ref_count_hfunc() to greedily find tpl_sim with min hfunc calls vinecop._data_vcp : one visit() for both hfunc and hinv in sim vinecop._factory_vcp: code refactoring to include the above * pyproject.toml, stdtr/stdtrit, README drop torch dependency for user customization * Update .yml pytest ./tests matrix.os * README, test_vinecop * sampling order, simplified commit b62dfa4 Author: ian <[email protected]> Date: Thu Aug 29 10:20:08 2024 +0800 _data_vcp: sim, antithetic variates commit 8acf040 Author: ian <[email protected]> Date: Fri Aug 23 17:48:18 2024 +0800 sampling order, simplified commit 25646ba Merge: ea8f5c1 ac42d78 Author: ian <[email protected]> Date: Fri Aug 23 17:46:32 2024 +0800 Merge branch 'main' into dev_ian commit ea8f5c1 Merge: c9559cf f932d88 Author: ian <[email protected]> Date: Wed Jul 17 23:03:29 2024 +0800 Merge branch 'main' into dev_ian commit c9559cf Author: ian <[email protected]> Date: Wed Jul 17 23:03:23 2024 +0800 README, test_vinecop commit 64ec149 Author: ian <[email protected]> Date: Tue Jul 16 11:30:55 2024 +0800 Update .yml pytest ./tests matrix.os commit 203dd87 Merge: 2576acc a8de187 Author: ian <[email protected]> Date: Tue Jul 16 11:30:38 2024 +0800 Merge branch 'main' into dev_ian commit 2576acc Author: ian <[email protected]> Date: Tue Jul 16 11:08:36 2024 +0800 pyproject.toml, stdtr/stdtrit, README drop torch dependency for user customization commit acfc50e Merge: 33022c0 20dece8 Author: ian <[email protected]> Date: Tue Jul 2 21:43:48 2024 +0800 Merge branch 'main' into dev_ian commit 33022c0 Author: ian <[email protected]> Date: Tue Jul 2 21:15:36 2024 +0800 v2024.7.0 util.__init__ : ref_count_hfunc() to greedily find tpl_sim with min hfunc calls vinecop._data_vcp : one visit() for both hfunc and hinv in sim vinecop._factory_vcp: code refactoring to include the above commit d203c34 Merge: 1d367d7 72a37a3 Author: ian <[email protected]> Date: Mon Jun 24 19:55:55 2024 +0800 Merge branch 'main' into dev_ian commit 1d367d7 Merge: b943dc0 057d3ef Author: ian <[email protected]> Date: Mon Jun 24 14:49:51 2024 +0800 Merge branch 'main' into dev_ian commit b943dc0 Author: Tuoyuan Cheng <[email protected]> Date: Mon Jun 24 14:42:01 2024 +0800 Update python-package.yml commit 48b0aab Author: Tuoyuan Cheng <[email protected]> Date: Mon Jun 24 14:39:30 2024 +0800 Update python-package.yml commit 4e87861 Author: ian <[email protected]> Date: Mon Jun 24 14:31:09 2024 +0800 Update python-package.yml * update tests, docs; remove num_obs_max; Co-Authored-By: Gaurav Agrawal <[email protected]> * Final MNIST experiment+1 (#37) Co-authored-by: Thibault Vatter <[email protected]> * update tests, docs; format by ruff. * minor updates for docs * Add usage of uv * github action .yml; pyproject.toml * flake8 compliance uv run docformatter --in-place torchvinecopulib uvx ruff format ./**/*.py ./**/*.ipynb uv run flake8 ./torchvinecopulib --exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics uv run flake8 ./torchvinecopulib --count --exit-zero --max-complexity=10 --max-line-length=127 --ignore=E203,W503,E501,C901 --statistics Whitespace before ':' (E203) Line break occurred before a binary operator (W503) Line too long (82 > 79 characters) (E501) Function is too complex (C901) * Update python-package.yml * Update python-package.yml --------- Co-authored-by: Thibault Vatter <[email protected]> Co-authored-by: Gaurav Agrawal <[email protected]> Co-authored-by: Sai Kiran Reddy Poreddy <[email protected]>
1 parent a7b356f commit c6bc43d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+7401
-7454
lines changed
Lines changed: 115 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,119 @@
1+
# This workflow builds a Python package and publishes it to PyPI and TestPyPI.
12
name: Publish to PyPI and TestPyPI
23

3-
on: push
4-
4+
on:
5+
push:
6+
branches: ["main"]
7+
tags:
8+
- "v*.*.*" # Match semantic version tags like v1.0.0, v2.1.3, etc.
9+
workflow_dispatch:
10+
# Allow manual dispatch for testing or immediate releases
11+
512
jobs:
6-
build:
7-
name: Build Distribution Package
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v4
11-
- name: Set up Python 3.12
12-
uses: actions/setup-python@v2
13-
with:
14-
python-version: 3.12
15-
- name: Install dependencies and build package
16-
run: |
17-
python3 -m pip install --upgrade pip
18-
python3 -m pip install poetry
19-
python3 -m poetry install
20-
python3 -m poetry build
21-
- name: Store the distribution packages
22-
uses: actions/upload-artifact@v4
23-
with:
24-
name: python-distribution-packages
25-
path: dist/*
26-
publish-testpypi:
27-
name: Publish to TestPyPI
28-
needs: build
29-
runs-on: ubuntu-latest
30-
environment:
31-
name: testpypi
32-
url: https://test.pypi.org/p/torchvinecopulib/
33-
permissions:
34-
id-token: write
35-
# contents: write
36-
37-
steps:
38-
- name: Download the distribution packages
39-
uses: actions/download-artifact@v4
40-
with:
41-
name: python-distribution-packages
42-
path: dist/
43-
- name: Publish distribution
44-
uses: pypa/gh-action-pypi-publish@release/v1
45-
with:
46-
verbose: true
47-
skip-existing: true
48-
repository-url: https://test.pypi.org/legacy/
13+
build:
14+
name: Build distributions
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python 3.12
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: 3.12
24+
25+
- name: Cache pip
26+
uses: actions/cache@v4
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
30+
31+
- name: Install uv and sync deps, build sdist and wheel
32+
run: |
33+
python3 -m pip install --upgrade pip
34+
python3 -m pip install uv
35+
python3 -m uv sync --extra cpu
36+
python3 -m uv build
37+
38+
- name: Upload dist/*
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: python-distribution-packages
42+
path: dist/*
43+
44+
publish-testpypi:
45+
name: Publish to TestPyPI
46+
needs: build
47+
runs-on: ubuntu-latest
48+
environment:
49+
name: testpypi
50+
url: https://test.pypi.org/p/torchvinecopulib/
51+
permissions:
52+
id-token: write
53+
# contents: write
54+
steps:
55+
- name: Download dist/*
56+
uses: actions/download-artifact@v4
57+
with:
58+
name: python-distribution-packages
59+
path: dist/
60+
61+
- name: Publish to TestPyPI
62+
uses: pypa/gh-action-pypi-publish@release/v1
63+
with:
64+
verbose: true
65+
skip-existing: true
66+
repository-url: https://test.pypi.org/legacy/
67+
68+
publish-pypi:
69+
name: Publish to PyPI
70+
runs-on: ubuntu-latest
71+
needs: publish-testpypi
72+
if: startsWith(github.ref, 'refs/tags/v')
73+
environment:
74+
name: pypi
75+
url: https://pypi.org/project/torchvinecopulib/
76+
permissions:
77+
id-token: write
78+
# contents: write
79+
steps:
80+
- name: Download dist/*
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: python-distribution-packages
84+
path: dist/
85+
86+
- name: Publish to PyPI
87+
uses: pypa/gh-action-pypi-publish@release/v1
88+
with:
89+
verbose: true
90+
skip-existing: true
4991

50-
publish-pypi:
51-
name: Publish to PyPI
52-
if: startsWith(github.ref, 'refs/tags/')
53-
needs: publish-testpypi
54-
runs-on: ubuntu-latest
55-
environment:
56-
name: pypi
57-
url: https://pypi.org/project/torchvinecopulib/
58-
permissions:
59-
id-token: write
60-
# contents: write
61-
62-
steps:
63-
- name: Download the distribution packages
64-
uses: actions/download-artifact@v4
65-
with:
66-
name: python-distribution-packages
67-
path: dist/
68-
- name: Publish distribution
69-
uses: pypa/gh-action-pypi-publish@release/v1
70-
with:
71-
verbose: true
72-
skip-existing: true
73-
74-
github-release:
75-
name: Create GitHub Release
76-
if: startsWith(github.ref, 'refs/tags/')
77-
needs: publish-testpypi
78-
runs-on: ubuntu-latest
79-
permissions:
80-
id-token: write
81-
contents: write
82-
83-
steps:
84-
- name: Download the distribution packages
85-
uses: actions/download-artifact@v4
86-
with:
87-
name: python-distribution-packages
88-
path: dist/
89-
- name: Sign the distribution packages
90-
uses: sigstore/[email protected]
91-
with:
92-
inputs: >-
93-
./dist/*.tar.gz
94-
./dist/*.whl
95-
- name: Github Release
96-
env:
97-
GITHUB_TOKEN: ${{ github.token }}
98-
run: >-
99-
gh release create
100-
'${{ github.ref_name }}'
101-
--repo '${{ github.repository }}'
102-
--notes ""
92+
github-release:
93+
name: Create GitHub Release
94+
if: startsWith(github.ref, 'refs/tags/v')
95+
needs: publish-testpypi
96+
runs-on: ubuntu-latest
97+
permissions:
98+
id-token: write
99+
contents: write
100+
steps:
101+
- name: Download dist/*
102+
uses: actions/download-artifact@v4
103+
with:
104+
name: python-distribution-packages
105+
path: dist/
106+
- name: Sign the distribution packages
107+
uses: sigstore/[email protected]
108+
with:
109+
inputs: |
110+
./dist/*.tar.gz
111+
./dist/*.whl
112+
- name: Create GitHub Release
113+
env:
114+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115+
run: |
116+
gh release create
117+
'${{ github.ref_name }}'
118+
--repo '${{ github.repository }}'
119+
--notes ""

.github/workflows/python-package.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,59 @@ name: Lint Pytest
55

66
on:
77
push:
8-
branches: ["main", "dev_ian"]
8+
branches: ["main"]
99
pull_request:
1010
branches: ["main"]
1111

1212
workflow_dispatch:
1313

1414
jobs:
15-
build:
15+
lint-pytest:
1616
runs-on: ${{ matrix.os }}
1717
strategy:
1818
fail-fast: false
1919
matrix:
2020
os: [ubuntu-latest, windows-latest, macos-latest]
21-
python-version: ["3.10", "3.11", "3.12"]
22-
21+
python-version: ["3.12", "3.13"]
2322
steps:
24-
- name: Check out repository
23+
- name: Checkout code
2524
uses: actions/checkout@v4
25+
2626
- name: Set up Python ${{ matrix.python-version }}
2727
uses: actions/setup-python@v5
2828
with:
2929
python-version: ${{ matrix.python-version }}
30-
- name: Install dependencies
30+
31+
- name: Cache pip
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.cache/pip
35+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
36+
37+
- name: Install uv and sync deps
3138
run: |
32-
python -m pip install --upgrade pip
33-
python -m pip install "pyvinecopulib==0.6.6"
34-
python -m pip install flake8 pytest numpy scipy torch pot matplotlib scikit-learn pandas coverage
39+
python3 -m pip install --upgrade pip
40+
python3 -m pip install uv
41+
python3 -m uv sync --extra cpu
3542
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
43+
3644
- name: Lint with flake8
3745
run: |
3846
# stop the build if there are Python syntax errors or undefined names
39-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
47+
uv run flake8 ./torchvinecopulib --exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics
4048
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
41-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --ignore=E203,W503 --statistics
49+
uv run flake8 ./torchvinecopulib --count --exit-zero --max-complexity=10 --max-line-length=127 --ignore=E203,W503,E501,C901 --statistics
50+
4251
- name: Test with pytest
4352
run: |
44-
python -c "import sys; print(sys.version)"
45-
python -c "import torch; print(torch.cuda.is_available())"
46-
coverage run -m pytest ./tests
47-
coverage xml
48-
coverage report
49-
coverage html
50-
51-
- name: Upload test coverage to Codacy
52-
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }}
53+
uv run python -c "import sys; print(sys.version)"
54+
uv run python -c "import torch; print(torch.cuda.is_available())"
55+
uv run coverage run --source=torchvinecopulib -m pytest tests
56+
uv run coverage report
57+
uv run coverage xml -o coverage.xml
58+
59+
- name: Upload coverage to Codacy
60+
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' }}
5361
run: |
5462
export CODACY_API_BASE_URL=${{ secrets.CODACY_API_BASE_URL }}
5563
export CODACY_PROJECT_TOKEN=${{ secrets.CODACY_PROJECT_TOKEN }}

.github/workflows/static.yml

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Simple workflow for deploying static content to GitHub Pages
1+
# This workflow builds and deploys the documentation to GitHub Pages
22
name: Deploy Docs
33

44
on:
5-
# Run static when Lint Pytest workflow completes
5+
# Trigger after your Lint Pytest workflow completes on main branch
66
workflow_run:
7-
workflows: [Lint Pytest]
8-
types:
9-
- completed
7+
workflows: ["Lint Pytest"]
8+
types: [completed]
9+
branches: ["main"]
1010

11-
# Allows you to run this workflow manually from the Actions tab
11+
# ALso allow manual dispatch
1212
workflow_dispatch:
1313

1414
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
@@ -18,46 +18,45 @@ concurrency:
1818
cancel-in-progress: false
1919

2020
jobs:
21-
# Single deploy job since we're just deploying
2221
deploy:
23-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
24-
strategy:
25-
matrix:
26-
python-version: ["3.12"]
27-
22+
if: ${{github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
2823
runs-on: ubuntu-latest
29-
# Give commit access to the workflow
3024
permissions:
31-
contents: write
25+
contents: write # for pushing to gh-pages branch
26+
3227
steps:
33-
- name: Checkout
28+
- name: Checkout code
3429
uses: actions/checkout@v4
35-
- name: Set up Python ${{ matrix.python-version }}
30+
31+
- name: Set up Python 3.12
3632
uses: actions/setup-python@v5
3733
with:
38-
python-version: ${{ matrix.python-version }}
39-
# Install dependencies
40-
- name: Install dependencies
34+
python-version: "3.12"
35+
36+
- name: Cache pip
37+
uses: actions/cache@v4
38+
with:
39+
path: ~/.cache/pip
40+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
41+
42+
- name: Install uv and sync deps
4143
run: |
42-
python -m pip install --upgrade pip
43-
python -m pip install sphinx sphinx-pyproject furo torch scipy numpy
44-
# Build the docs using Sphinx
45-
- name: Sphinx build
44+
python3 -m pip install --upgrade pip
45+
python3 -m pip install uv
46+
python3 -m uv sync --extra cpu
47+
48+
- name: Build Sphinx docs
49+
# regenerate module RST files (force) and build HTML docs
4650
run: |
47-
sphinx-apidoc -o docs torchvinecopulib/ --separate
48-
sphinx-build docs docs/_build/html
49-
# Deploy sphinx documentation and commit to gh-pages branch
50-
- name: Deploy
51-
uses: peaceiris/actions-gh-pages@v3
51+
uv run sphinx-apidoc --force -o docs torchvinecopulib/ --separate
52+
uv run sphinx-build -b html docs/ docs/_build/html
53+
54+
# Deploy to gh-pages branch
55+
56+
- name: Deploy to gh-pages branch
57+
uses: peaceiris/actions-gh-pages@v4
5258
with:
53-
publish_branch: gh-pages
59+
force_orphan: true
5460
github_token: ${{ secrets.GITHUB_TOKEN }}
61+
publish_branch: gh-pages
5562
publish_dir: docs/_build/html
56-
force_orphan: true
57-
58-
deploy-ignore:
59-
if: ${{ github.event.workflow_run.conclusion != 'success' }}
60-
runs-on: ubuntu-latest
61-
steps:
62-
- name: Skip
63-
run: echo "Skipping deployment as Lint Pytest workflow run was not successful."

0 commit comments

Comments
 (0)