Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#!/usr/bin/env bash

echo "Install Poetry and Python dependencies"
curl -sSL https://install.python-poetry.org | python -
echo "Install uv and Python dependencies"
curl -LsSf https://astral.sh/uv/install.sh | sh
echo 'export PATH="/root/.local/bin:$PATH"' > ~/.bashrc
. ~/.bashrc
# This invocation requires root access, but Poetry isn't in the path.
sudo `which poetry` config virtualenvs.create false
sudo `which poetry` install --with dev
python scripts/fetch_core.py
playwright install-deps
playwright install
uv sync --all-extras
uv run python scripts/fetch_core.py
uv run playwright install-deps
uv run playwright install
# Run mypy once so that it will install any needed type stubs. After this, the VSCode extension will run it automatically.
mypy --install-types --non-interactive
uv run mypy --install-types --non-interactive
6 changes: 3 additions & 3 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copilot Instructions for pretext-cli

Prefer running project commands with `poetry run` so they use the repository's
Prefer running project commands with `uv run` so they use the repository's
configured Python environment and tool versions.

When working on an assigned GitHub issue and preparing to open a pull request,
run code formatting before creating the PR:

```bash
poetry run black .
uv run black .
```

Only open the PR after formatting has been run successfully.
Expand All @@ -21,7 +21,7 @@ then implement the code change to satisfy them.
Before opening the PR, run relevant tests (or the full suite when needed):

```bash
poetry run pytest
uv run pytest
```

For user-visible changes, add an entry under `[Unreleased]` in `CHANGELOG.md`
Expand Down
35 changes: 13 additions & 22 deletions .github/workflows/deploy-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ jobs:
steps:
- uses: actions/checkout@v6

- uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: 3.12

- name: Install poetry 1.8.4
run: |
python -m pip install --upgrade pip
python -m pip install poetry==1.8.4
python-version: "3.12"

- name: Install build dependencies
run: |
Expand All @@ -41,14 +37,14 @@ jobs:

- name: Install dependencies
shell: bash
run: python -m poetry install --all-extras
run: uv sync --all-extras

- name: Run prep-nightly script
id: prep
shell: bash
run: |
echo "Updating core commit and version; building"
output=$(poetry run python scripts/prep_nightly.py ${{ inputs.core-repo }})
output=$(uv run python scripts/prep_nightly.py ${{ inputs.core-repo }})
echo "$output"
echo "Finished steps to prep nightly deployment"
if [[ $output == *"Ready to deploy"* ]]; then
Expand Down Expand Up @@ -85,16 +81,11 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
- uses: actions/checkout@v6

# Sets up python3
- uses: actions/setup-python@v6
# Setup uv
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: 3.12

# Setup poetry
- name: Install poetry 1.8.4
run: |
python -m pip install --upgrade pip
python -m pip install poetry==1.8.4
python-version: "3.12"

- name: Install build dependencies
run: |
Expand All @@ -109,12 +100,12 @@ jobs:

- name: Install dependencies
shell: bash
run: python -m poetry install --all-extras
run: uv sync --all-extras

- name: Publish nightly build
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
uv build
uv publish
echo "Published to pypi"
36 changes: 15 additions & 21 deletions .github/workflows/deploy-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,11 @@ jobs:
with:
ref: ${{ inputs.branch }}

# Sets up python3
- uses: actions/setup-python@v6
# Setup uv
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: 3.12

# Setup poetry
- name: Install poetry 1.8.4
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install poetry==1.8.4
python-version: "3.12"

- name: Install build dependencies
run: |
Expand All @@ -66,33 +60,33 @@ jobs:

- name: Install dependencies
shell: bash
run: poetry install --all-extras
run: uv sync --all-extras

- name: Update version if needed
if: ${{ inputs.level != 'patch' }}
run: poetry version ${{ inputs.level }}
run: uv version --bump ${{ inputs.level }}

- name: Build package
run: poetry run python scripts/build_package.py ${{ inputs.core-repo }}
run: uv run python scripts/build_package.py ${{ inputs.core-repo }}

- name: Discover current version
run: |
poetry run pretext --version
echo "VERSION=$(poetry run pretext --version)" >> $GITHUB_ENV
uv run pretext --version
echo "VERSION=$(uv run pretext --version)" >> $GITHUB_ENV

- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
uv build
uv publish

- name: update changelog
run: |
poetry run python scripts/update_changelog.py
uv run python scripts/update_changelog.py

- name: Update version for next dev release
run: poetry version patch
run: uv version --bump patch

- name: setup git config
run: |
Expand All @@ -105,7 +99,7 @@ jobs:
git checkout -b ${{ env.VERSION }}-deploy
git add CHANGELOG.md
git commit -m "update changelog for release"
git add pyproject.toml
git add pyproject.toml uv.lock
git commit -m "bump version to next patch level for nightly releases"
git add pretext/resources/resource_hash_table.json
git commit --allow-empty -m "commit changes to resource_hash_table.json"
Expand Down
70 changes: 25 additions & 45 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,21 @@ jobs:

- name: Report node version
run: node --version
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: report python version
run: python --version
- name: Install linters and formatters
run: python -m pip install flake8 black mypy
- name: Install poetry
run: python -m pip install poetry
run: uv run python --version
- name: Install dependencies
run: python -m poetry install
run: uv sync
- name: Initialize project
if: ${{ inputs.source-artifact == '' }}
run: python -m poetry run python scripts/fetch_core.py
run: uv run python scripts/fetch_core.py
- name: Check formatting with black
run: python -m poetry run black --check --diff $(git ls-files "*.py")
run: uv run black --check --diff $(git ls-files "*.py")
- name: Check for lint
run: python -m poetry run flake8
run: uv run flake8
- name: Check types
run: python -m poetry run mypy --install-types --non-interactive
run: uv run mypy --install-types --non-interactive

deep-test:
needs: format-and-types
Expand All @@ -63,44 +61,37 @@ jobs:
name: ${{ inputs.source-artifact }}
path: .

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Report Python version
run: python --version
run: uv run python --version

- name: set up node
uses: actions/setup-node@v6
with:
node-version: '24'

- name: Install poetry
run: |
pip install --upgrade pip
pip install poetry

- name: View poetry --help
run: poetry --help

- name: Install build dependencies if on Linux
run: |
apt-get update
apt-get -y install gcc pkg-config python3-dev build-essential python3-louis librsvg2-bin libcairo2-dev

- name: Install dependencies
shell: bash
run: poetry install --all-extras
run: uv sync --all-extras
- name: Initialize project
if: ${{ inputs.source-artifact == '' }}
run: poetry run python scripts/fetch_core.py
run: uv run python scripts/fetch_core.py

- name: Ensure dependencies are present
run: |
echo "manually installing pelican; poetry does not seem to do this correctly."
poetry run pip install pelican
poetry run pelican --version
poetry run playwright install chromium
uv run pelican --version
uv run playwright install chromium

- name: Test with pytest
run: |
poetry run pytest -v --cov
uv run pytest -v --cov


broad-tests:
Expand Down Expand Up @@ -129,8 +120,8 @@ jobs:
name: ${{ inputs.source-artifact }}
path: .

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -139,15 +130,6 @@ jobs:
with:
node-version: '24'

- name: Install poetry
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install poetry

- name: View poetry --help
run: poetry --help

- name: Install build dependencies if on Linux
if: runner.os == 'Linux'
run: |
Expand All @@ -157,27 +139,25 @@ jobs:

- name: Install dependencies
shell: bash
run: python -m poetry install --all-extras
run: uv sync --all-extras
- name: Initialize project
if: ${{ inputs.source-artifact == '' }}
run: python -m poetry run python scripts/fetch_core.py
run: uv run python scripts/fetch_core.py

- name: Initialize playwright
run: |
echo "Installing playwright dependencies"
python -m poetry run playwright install-deps
uv run playwright install-deps
echo "Installing playwright browsers"
python -m poetry run playwright install
uv run playwright install

- name: Ensure dependencies are present
run: |
echo "manually installing pelican; poetry does not seem to do this correctly."
python -m poetry run pip install pelican
python -m poetry run pelican --version
uv run pelican --version

- name: Test with pytest
run: |
python -m poetry run pytest -v --cov
uv run pytest -v --cov


schema:
Expand Down
Loading