Skip to content

Commit 3196c31

Browse files
committed
Add requirements regenerator script and action
1 parent 785b1ee commit 3196c31

File tree

11 files changed

+144
-37
lines changed

11 files changed

+144
-37
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ jobs:
309309
# Python
310310
- name: Install python dependencies
311311
run: yarn _requires_python
312+
env:
313+
PSP_FROZEN_REQUIREMENTS: "1"
312314

313315
################
314316
# Linux
@@ -508,6 +510,8 @@ jobs:
508510
# Python
509511
- name: Install python dependencies
510512
run: yarn _requires_python
513+
env:
514+
PSP_FROZEN_REQUIREMENTS: "1"
511515

512516
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
513517
#~~~~~~~~~ Build Pipelines ~~~~~~~~~#
@@ -641,6 +645,8 @@ jobs:
641645
# Python
642646
- name: Install python dependencies
643647
run: yarn _requires_python
648+
env:
649+
PSP_FROZEN_REQUIREMENTS: "1"
644650

645651
################
646652
# Rust
@@ -1029,6 +1035,8 @@ jobs:
10291035
- name: Install python dependencies
10301036
run: yarn _requires_python
10311037
if: ${{ runner.os != 'Linux' }} # skip on manylinux2014
1038+
env:
1039+
PSP_FROZEN_REQUIREMENTS: "1"
10321040

10331041
################
10341042
# Linux
@@ -1323,6 +1331,8 @@ jobs:
13231331
# Python
13241332
- name: Install python dependencies
13251333
run: yarn _requires_python
1334+
env:
1335+
PSP_FROZEN_REQUIREMENTS: "1"
13261336

13271337
# Download artifact
13281338
- uses: actions/download-artifact@v3
@@ -1491,6 +1501,8 @@ jobs:
14911501
# Python
14921502
- name: Install python dependencies
14931503
run: yarn _requires_python
1504+
env:
1505+
PSP_FROZEN_REQUIREMENTS: "1"
14941506

14951507
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
14961508
#~~~~~~~~~ Build Pipelines ~~~~~~~~~#
@@ -1636,6 +1648,8 @@ jobs:
16361648
# Python
16371649
- name: Install python dependencies
16381650
run: yarn _requires_python
1651+
env:
1652+
PSP_FROZEN_REQUIREMENTS: "1"
16391653

16401654
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
16411655
#~~~~~~~~~ Build Pipelines ~~~~~~~~~#
@@ -1751,6 +1765,8 @@ jobs:
17511765
# Python
17521766
- name: Install python dependencies
17531767
run: yarn _requires_python
1768+
env:
1769+
PSP_FROZEN_REQUIREMENTS: "1"
17541770

17551771
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
17561772
#~~~~~~~~~ Build Pipelines ~~~~~~~~~#

.github/workflows/python-deps.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Regenerate Python Dependencies
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
8+
cancel-in-progress: true
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
generate:
15+
strategy:
16+
matrix:
17+
python-version:
18+
- "3.7"
19+
- "3.8"
20+
- "3.9"
21+
- "3.10"
22+
- "3.11"
23+
node-version: [18.x]
24+
25+
# NOTE: don't fail fast as sometimes npm blocks the burst of fetches from GHA
26+
fail-fast: false
27+
28+
runs-on: ubuntu-20.04
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
34+
- name: Set up Python ${{ matrix.python-version }}
35+
uses: actions/setup-python@v4
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
cache: "pip"
39+
40+
- name: Use Node.js ${{ matrix.node-version }}
41+
uses: actions/setup-node@v3
42+
with:
43+
node-version: ${{ matrix.node-version }}
44+
cache: "yarn"
45+
cache-dependency-path: yarn.lock
46+
47+
- name: Install js dependencies
48+
run: yarn
49+
env:
50+
PSP_SKIP_EMSDK_INSTALL: 1
51+
52+
- name: Install python dependencies
53+
run: yarn _requires_python
54+
env:
55+
PSP_GENERATE_FROZEN_REQUIREMENTS: "1"
56+
57+
- name: Push changes to well-known branch name
58+
run: |
59+
git checkout -b tkp/update-frozen-python-dependencies
60+
git add python/perspective/ci-requirements/
61+
git commit --author="3105306+timkpaine@users.noreply.github.com" -m "Update frozen python dependencies"
62+
git push origin tkp/update-frozen-python-dependencies -f

.gitignore

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ website/i18n/*
132132
!website/i18n/en.json
133133
website/static/css/material-dark.css
134134
website/static/css/pro-dark.css
135+
docs/static/features
136+
docs/.docusaurus
137+
docs/static/blocks
135138

136139
# test artifacts
137140
.ipynb_checkpoints
@@ -143,6 +146,10 @@ coverage
143146
screenshots/
144147
junit.xml
145148
results.debug.json
149+
test-results/
150+
playwright-report/
151+
playwright/.cache/
152+
.cache
146153

147154
# CPP Compile
148155
/src/include/boost
@@ -204,21 +211,10 @@ vcpkg
204211
# jupyterlab test artifacts
205212
packages/perspective-jupyterlab/test/config/jupyter/lab
206213
packages/perspective-jupyterlab/test/config/jupyter/migrated
207-
docs/static/features
208-
results.debug.json
209-
210-
tools/perspective-build/lib
211-
docs/.docusaurus
212-
packages/perspective-esbuild-plugin/lib
213-
docs/static/blocks
214-
.vscode/c_cpp_properties.json
215-
test-results/
216-
playwright-report/
217-
playwright/.cache/
218214

215+
# Build envs / virtualenvs / other local
219216
.pyodide-xbuildenv
220217
benchmark_venv
221-
222218
venv/
219+
.venvs/
223220
testenv
224-
.cache

python/perspective/MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ prune bench
3131
# Don't ship scripts
3232
prune scripts
3333

34+
# Don't ship test artifacts
35+
prune ci-requirements
36+
3437
# Patterns to exclude from any directory
3538
global-exclude *~
3639
global-exclude *.pyc
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tools/perspective-scripts/_requires_python.mjs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,17 @@
1313
import {
1414
default as sh,
1515
python_version,
16-
copy_files_to_python_folder,
17-
py_requirements,
16+
generate_py_requirements,
17+
install_py_requirements_dynamic,
18+
install_py_requirements_frozen,
1819
} from "./sh_perspective.mjs";
1920

2021
let PYTHON = sh(python_version());
2122

22-
if (process.env.PSP_OLD_SHITTY_INSTALL_METHOD) {
23-
const requires_script = `import distutils.core; setup = distutils.core.run_setup('python/perspective/setup.py'); print(' '.join(['"' + requirement + '"' for requirement in setup.extras_require['dev']]))`;
24-
25-
// copy build/config files into python folder
26-
copy_files_to_python_folder();
27-
28-
// install build meta deps, this is a necessary evil to keep the setup.py clean
29-
sh`${PYTHON} -m pip install jupyter_packaging==0.12.3`.runSync();
30-
const requirements = await sh`${PYTHON} -c ${requires_script}`.execSync();
31-
if (requirements.trim().length > 0) {
32-
console.log(`Installing: ${requirements}`);
33-
sh`${PYTHON} -m pip install -U ${sh(requirements)}`.log().runSync();
34-
} else {
35-
console.log("Nothing to install");
36-
}
23+
if (process.env.PSP_GENERATE_FROZEN_REQUIREMENTS) {
24+
generate_py_requirements(PYTHON);
25+
} else if (process.env.PSP_FROZEN_REQUIREMENTS) {
26+
install_py_requirements_frozen(PYTHON);
3727
} else {
38-
sh`${PYTHON} -m pip install -r ${py_requirements()}`.runSync();
39-
sh`${PYTHON} -m pip install -U jupyter_packaging==0.12.3`.runSync();
28+
install_py_requirements_dynamic(PYTHON);
4029
}

0 commit comments

Comments
 (0)