Skip to content

Commit e1acc4a

Browse files
authored
Require python 3.10 (#1008)
* require python 3.10+ for the cli; add all optional dependency * tweak tests
1 parent 654ce85 commit e1acc4a

9 files changed

Lines changed: 210 additions & 454 deletions

File tree

.github/workflows/tests.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
jobs:
1111
format-and-types:
1212
runs-on: ubuntu-latest
13+
1314
steps:
1415
- uses: actions/checkout@v4
1516
- uses: actions/setup-node@v4
@@ -38,50 +39,43 @@ jobs:
3839
deep-test:
3940
needs: format-and-types
4041
runs-on: ubuntu-22.04
41-
#container: oscarlevin/pretext:full
42+
container: oscarlevin/pretext-full
4243

4344
steps:
4445
- uses: actions/checkout@v4
45-
- uses: actions/setup-python@v4
46-
with:
47-
python-version: '3.12'
48-
49-
- name: set up node
50-
uses: actions/setup-node@v4
51-
with:
52-
node-version: '22'
5346

5447
- name: Report Python version
5548
run: python --version
5649

57-
- name: Install apt packages (Linux with python 3.12 only)
58-
run: |
59-
sudo apt-get update
60-
sudo apt-get install -y --no-install-recommends texlive texlive-science texlive-xetex ghostscript pdf2svg texlive-fonts-extra sagemath python3-pip
61-
62-
- name: Install poetry 1.8.4
50+
- name: Install poetry
6351
run: |
64-
python -m pip install --upgrade pip
65-
python -m pip install poetry==1.8.4
52+
pip install --upgrade pip
53+
pip install poetry
6654
6755
- name: View poetry --help
6856
run: poetry --help
6957

58+
- name: Install build dependencies if on Linux
59+
run: |
60+
apt-get update
61+
apt-get -y install gcc pkg-config python3-dev build-essential python3-louis librsvg2-bin libcairo2-dev
62+
7063
- name: Install dependencies
7164
shell: bash
7265
run: |
73-
python -m poetry install --all-extras
74-
python -m poetry run python scripts/fetch_core.py
66+
poetry install --all-extras
67+
poetry run python scripts/fetch_core.py
7568
7669
- name: Ensure dependencies are present
7770
run: |
7871
echo "manually installing pelican; poetry does not seem to do this correctly."
79-
python -m poetry run pip install pelican
80-
python -m poetry run pelican --version
72+
poetry run pip install pelican
73+
poetry run pelican --version
74+
poetry run playwright install chromium
8175
8276
- name: Test with pytest
8377
run: |
84-
python -m poetry run pytest -v --cov
78+
poetry run pytest -v --cov
8579
8680
8781
broad-tests:
@@ -90,7 +84,6 @@ jobs:
9084
fail-fast: true
9185
matrix:
9286
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
93-
poetry-version: ["1.8.4"]
9487
os: [ubuntu-latest, windows-latest]
9588
exclude:
9689
- os: windows-latest
@@ -119,11 +112,11 @@ jobs:
119112
with:
120113
node-version: '22'
121114

122-
- name: Install poetry ${{ matrix.poetry-version }}
115+
- name: Install poetry
123116
run: |
124117
python -m ensurepip
125118
python -m pip install --upgrade pip
126-
python -m pip install poetry==${{ matrix.poetry-version }}
119+
python -m pip install poetry
127120
128121
- name: View poetry --help
129122
run: poetry --help
@@ -140,6 +133,13 @@ jobs:
140133
python -m poetry install --all-extras
141134
python -m poetry run python scripts/fetch_core.py
142135
136+
- name: Initialize playwright
137+
run: |
138+
echo "Installing playwright dependencies"
139+
python -m poetry run playwright install-deps
140+
echo "Installing playwright browsers"
141+
python -m poetry run playwright install
142+
143143
- name: Ensure dependencies are present
144144
run: |
145145
echo "manually installing pelican; poetry does not seem to do this correctly."

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change
99

1010
## [Unreleased]
1111

12+
### Changed
13+
14+
- Python version 3.10 or higher is now required (removed support for python 3.8 and 3.9).
15+
1216
### Fixed
1317

1418
- Bug which caused error in `pretext view` when the `running_servers` file contained a blank line.

poetry.lock

Lines changed: 165 additions & 414 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pretext/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ def playwright_install() -> None:
566566
try:
567567
log.info("Checking for update for required playwright chromium browser.")
568568
# subprocess.run("playwright install-deps", shell=True)
569-
subprocess.run("playwright install chromium", shell=True)
569+
subprocess.run(["playwright", "install", "chromium"])
570570
log.debug("Installed dependencies to capture interactive previews")
571571
except Exception as e:
572572
log.critical(

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ include = ["pretext/core/pretext.py", "pretext/resources/*.zip", "pretext/resour
2626
# Dependencies
2727
# ------------
2828
[tool.poetry.dependencies]
29-
python = "^3.8.5"
29+
python = "^3.10"
3030
lxml = "^5.3"
3131
requests = "^2"
3232
GitPython = "^3"
@@ -45,13 +45,13 @@ plastex = "^3"
4545
jinja2 = "^3"
4646
coloraide = "^4"
4747
pelican = { extras = ["markdown"], version = "^4.10", optional = true }
48-
prefig = { extras = ["pycairo"], version = "^0.2.10", optional = true }
48+
prefig = { extras = ["text"], version = "^0.3.2", optional = true }
4949

5050

5151
# Development dependencies
5252
# ------------------------
5353
[tool.poetry.group.dev.dependencies]
54-
black = [{version = "^23", python = "3.8"}, {version = "^24.10", python = ">=3.9"}]
54+
black = "^24.10"
5555
codechat-server = "^0"
5656
flake8 = "^6"
5757
lxml-stubs = "^0"
@@ -71,6 +71,7 @@ pep8-naming = "^0.14.1"
7171
[tool.poetry.extras]
7272
homepage = ["pelican"]
7373
prefigure = ["prefig"]
74+
all = ["pelican","prefig"]
7475

7576
[tool.poetry.scripts]
7677
pretext = 'pretext.cli:main'

scripts/bundle_resources.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ def resource_hashes() -> None:
3434
r"PreTeXt \d+\.\d+\.\d+", f"PreTeXt {VERSION}", line
3535
)
3636
f.write(new_line)
37-
elif '"image": "oscarlevin/pretext' in line:
38-
new_line = re.sub(
39-
r'("image": "oscarlevin/pretext(-full)?):latest"',
40-
rf'\1:{VERSION}"',
41-
line,
42-
)
43-
f.write(new_line)
37+
# elif '"image": "oscarlevin/pretext' in line:
38+
# new_line = re.sub(
39+
# r'("image": "oscarlevin/pretext(-full)?):latest"',
40+
# rf'\1:{VERSION}"',
41+
# line,
42+
# )
43+
# f.write(new_line)
4444
else:
4545
f.write(line)
4646
# Now hash the updated file to add to a hash-table for this version

templates/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
//
1414
///////////////////////////////////////////////////////////////
1515
{
16-
"image": "oscarlevin/pretext-full:latest",
16+
"image": "oscarlevin/pretext-full",
1717
// If you don't need sagemath, you can use a smaller base image. Comment out the line above and uncomment the line below to use a smaller image.
18-
// "image": "oscarlevin/pretext:latest",
18+
// "image": "oscarlevin/pretext",
1919
"features": {},
2020

2121
// The pretext-full image above includes pretext, prefigure, and enough parts of latex and sagemath for most cases. If there are errors with sage, you can install the full sagemath package through Conda by running ./.devcontainer/installSage.sh, or uncommenting that line and rebuilding the container.

templates/pretext-cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
jobs:
2222
build:
2323
runs-on: ubuntu-latest
24-
container: oscarlevin/pretext:full
24+
container: oscarlevin/pretext-full
2525

2626
steps:
2727
- name: Checkout source

templates/pretext-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ permissions:
2828
jobs:
2929
build-and-deploy:
3030
runs-on: ubuntu-latest
31-
container: oscarlevin/pretext:full
31+
container: oscarlevin/pretext-full
3232

3333
steps:
3434
- name: Checkout source

0 commit comments

Comments
 (0)