Skip to content

Commit

Permalink
switch to uplot, py310 (#362)
Browse files Browse the repository at this point in the history
* switch to uplot, py310

* who uses mac anyway

* update distribute and test workflows

* add newer py versions requirements

* uv pytest

* install

* no use binary

* uv v5

* use venvs

* dont need the uv install

* dont failf ast

* set python version

* try mac with different python version

* no py3.13

* add macos

* fix tests

* activate windows

* drop py3.12

* fetch tags

* editable install

* _

* linting

* update linting workflow

* use astral action

* update ruff config

* update examples to uplot / lint
  • Loading branch information
Jhsmit authored Jan 13, 2025
1 parent b974037 commit eae96b3
Show file tree
Hide file tree
Showing 36 changed files with 6,459 additions and 1,078 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- run: python -m pip install ruff
- run: ruff check .
python-version: "3.10"
- uses: astral-sh/ruff-action@v3
30 changes: 18 additions & 12 deletions .github/workflows/pin_requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,32 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ["3.9"]
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Install pip-tools
run: pip install pip-tools
# Install a specific version of uv.
version: "0.5.4"

- name: Generate requirements file
run: pip-compile --extra web --output-file requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt pyproject.toml
run: uv pip compile --all-extras --python-version ${{ matrix.python-version }} pyproject.toml -o requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt

- name: Upload requirements file
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: requirements
name: req-artifact-${{ matrix.os }}-${{ matrix.python-version }}
path: requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt

merge:
runs-on: ubuntu-latest
needs: generate-requirements
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: all-requirements
pattern: req-artifact-*
4 changes: 2 additions & 2 deletions .github/workflows/pypi_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"
- name: Install Hatch
run: pip install hatch
- name: Build
Expand Down
27 changes: 24 additions & 3 deletions .github/workflows/pypi_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,37 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.9

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"

- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Create test version tag
run: |
# Get number of commits in current branch
COMMIT_COUNT=$(git rev-list --count HEAD)
# Get short SHA
SHA=$(git rev-parse --short HEAD)
# Create a PEP 440 compliant version number
VERSION="0.2.1.dev${COMMIT_COUNT}"
# Create and push tag
git tag -a "v${VERSION}" -m "Test release ${VERSION}"
echo "Created tag v${VERSION}"
- name: Install Hatch
run: pip install hatch

- name: Build
run: hatch build

- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/
50 changes: 28 additions & 22 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,44 @@ on:
push:
pull_request:

# adapted from: https://github.com/tiangolo/poetry-version-plugin
jobs:
test:
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest" , "windows-latest"]
python-version: [ "3.9" ]
defaults:
run:
shell: bash
os: [ "ubuntu-latest", "macos-latest", "windows-latest"]
python-version: [ "3.10", "3.11" ]

runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3

uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements/requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt

- name: Install pinned requirements
# Install a specific version of uv.
version: "0.5.4"
enable-cache: true
cache-dependency-glob: requirements/requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements/requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt --prefer-binary
- name: Install test requirements
run: pip install .[test]

uv venv -p ${{ matrix.python-version }}
if [ "${{ matrix.os }}" == "windows-latest" ]; then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
echo PATH=$PATH >> $GITHUB_ENV
uv pip install -r requirements/requirements-${{ matrix.os }}-${{ matrix.python-version }}.txt
uv pip install -e .[test]
# - name: Install test requirements
# run:
- name: Run tests
run: |
pytest tests/
uv run pytest tests/
Loading

0 comments on commit eae96b3

Please sign in to comment.