Commit 1d12cefd authored by Zebedee Nicholls's avatar Zebedee Nicholls
Browse files

Merge branch 'upgrades' into 'main'

Upgrades

See merge request !55
parents fd3adb92 b58e2f44
Loading
Loading
Loading
Loading
Loading
+2 −1
Changes for .gitignore: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2,8 +2,9 @@
tests/regression/ctt/**/pdm.lock
tests/regression/ctt/**/uv.lock

# pdm stuff
# legacy pdm stuff
.pdm-python
pdm.lock

# Databases
*.db
+35 −33
Changes for .gitlab-ci.yml: 35 added lines, 33 removed lines.
Original line number Diff line number Diff line
@@ -10,18 +10,22 @@ image: python:3.10
# only cache local items.
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv"

cache:
  key:
    files:
      - pdm.lock
      - uv.lock
      - pyproject.toml
    prefix: python-3.10-
  paths:
    - .cache/pip
    - .cache/uv

before_script:
  - python -V
  - pip install pdm uv
  - pip install 'uv==0.11.16'
  - uv --version

test:linting:
  stage: test
@@ -29,16 +33,18 @@ test:linting:
    PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
  cache:
    paths:
      - .cache/pip
      - .cache/uv
      - ${PRE_COMMIT_HOME}
  script:
    - pdm install --dev
    - pdm run pre-commit run --all-files
    - uv sync --group dev
    - uv run --group dev pre-commit run --all-files

test:ctt:
  stage: test
  script:
    - pdm install --dev
    - pdm run ctt
    - uv sync --group dev
    - uv run --group dev ctt
    - git add .
    - git diff --exit-code --staged
    # Just in case, undo the staged changes
@@ -47,12 +53,12 @@ test:ctt:
test:docs:
  stage: test
  script:
    - pdm install --group docs --dev
    - pdm run mkdocs build --strict
    - uv sync --group docs --all-extras
    - uv run --group docs properdocs build --strict
    # Check CHANGELOG will build too
    - pdm install --group dev --dev
    - pdm run towncrier build --yes --version CI
    - pdm run mkdocs build --strict
    - uv sync --group dev --all-extras
    - uv run --group dev towncrier build --yes --version CI
    - uv run --group docs properdocs build --strict
    # Just in case, undo the staged changes
    - git restore --staged . && git restore .

@@ -83,12 +89,13 @@ test:windows-clone:
test:tests:
  stage: test
  script:
    - pdm install --group tests --dev
    - pdm run pytest tests --ignore=tests/regression/ctt -r a -v -n auto
    - uv sync --group tests --all-extras
    - uv run --group tests pytest tests --ignore=tests/regression/ctt -r a -v -n auto

# This job must be run manually
# Defaults to performing a "no-pre-release" release (determined using "BUMP_RULE" CI variable)
# Other bump rules can be found at https://github.com/carstencodes/pdm-bump#usage
# Defaults to a patch release,
# but this can be overridden using "BUMP_RULE" CI variable.
# Other bump rules can be found by running `uv version --help`.
bump:version:
  stage: bump
  only:
@@ -97,7 +104,7 @@ bump:version:
    refs:
      - main
  variables:
    BUMP_RULE: no-pre-release
    BUMP_RULE: patch
    CI_EMAIL: ci-runner@copier-core-python-repository.invalid
    CI_USERNAME: gitlab-ci
  when: manual
@@ -117,28 +124,23 @@ bump:version:
    # For some reason you need to basically re-initialise the branch
    - 'exists=`git show-ref refs/heads/$CI_COMMIT_REF_NAME` && if [ -n "$exists" ]; then git branch -D $CI_COMMIT_REF_NAME; fi'
    - git checkout -b $CI_COMMIT_REF_NAME
    # Install dependencies
    - pdm install --dev
    - pdm self add pdm-bump
    # Bump
    - BASE_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
    - echo "Bumping from version $BASE_VERSION"
    - pdm bump $BUMP_RULE
    - NEW_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
    - echo "Bumping to version $NEW_VERSION"
    - BASE_VERSION=`uv version --short`
    - NEW_VERSION=`uv version --bump $BUMP_RULE --short --no-sync`
    - echo "Bumping version $BASE_VERSION > $NEW_VERSION"
    # Build CHANGELOG
    - pdm run towncrier build --yes --version v$NEW_VERSION
    # Commit and tag
    - 'git commit -a -m "bump: version $BASE_VERSION > $NEW_VERSION"'
    - uv sync --group dev
    - uv run --group dev towncrier build --yes --version v$NEW_VERSION
    # Commit and tag (no verify to avoid pre-commit)
    - 'git commit --no-verify -a -m "bump: version $BASE_VERSION > $NEW_VERSION"'
    - git tag v$NEW_VERSION
    # Bump to alpha
    # Bump to post
    # (so that future commits do not have the same version as the tagged commit)
    - BASE_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
    - pdm bump pre-release --pre alpha
    - NEW_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
    - BASE_VERSION=`uv version --short`
    - NEW_VERSION=`uv version --bump post --short --no-sync`
    - echo "Bumping version $BASE_VERSION > $NEW_VERSION"
    # Commit
    - 'git commit -a -m "bump(pre-release): version $BASE_VERSION > $NEW_VERSION"'
    # Commit (no verify to avoid pre-commit)
    - 'git commit --no-verify -a -m "bump(pre-release): version $BASE_VERSION > $NEW_VERSION"'
    # Push commits and tags
    - git fetch origin
    - git push origin $CI_COMMIT_REF_NAME
+23 −20
Changes for .pre-commit-config.yaml: 23 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: "v5.0.0"
    rev: "v6.0.0"
    hooks:
      - id: check-added-large-files
      - id: check-ast
@@ -26,34 +26,37 @@ repos:
        entry: found Copier update rejection files; review them and remove them
        language: fail
        files: "\\.rej$"
  - repo: https://github.com/charliermarsh/ruff-pre-commit
    rev: "v0.8.4"
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: "v0.15.12"
    hooks:
      - id: ruff
      - id: ruff-check
        args: [ --fix, --exit-non-zero-on-fix ]
      - id: ruff-format
  - repo: https://github.com/pdm-project/pdm
    rev: 2.22.1
  - repo: https://github.com/astral-sh/uv-pre-commit
    rev: 0.11.8
    hooks:
      # Check that the lock file is up to date.
      # We need the pdm lock file too
      # so that we can build the locked version of the package.
      - id: pdm-lock-check
        args: ["--group", ":all", "--group", "all-dev", "--dev", "--strategy", "inherit_metadata"]
      # # Disable while we have no dependencies
      # # Put requirements.txt files in the repo too
      # - id: pdm-export
      #   name: export-requirements
      #   args: ["-o", "requirements-locked.txt", "--without-hashes", "--prod"]
      - id: pdm-export
      - id: uv-sync
      - id: uv-lock
        name: uv-lock-check
        args: ["--check"]
      # Put requirements.txt files in the repo too
      - id: uv-export
        name: export-requirements
        args: ["-o", "requirements-locked.txt", "--no-hashes", "--no-dev", "--no-emit-project"]
      - id: uv-export
        name: export-requirements-optional
        args: ["-o", "requirements-incl-optional-locked.txt", "--no-hashes", "--no-dev", "--no-emit-project", "--all-extras"]
      - id: uv-export
        name: export-requirements-docs
        args: ["-o", "requirements-docs-locked.txt", "--without-hashes", "--group", ":all", "--group", "docs", "--dev"]
      - id: pdm-sync
        args: ["-o", "requirements-docs-locked.txt", "--no-hashes", "--no-dev", "--no-emit-project", "--all-extras", "--group", "docs"]
      - id: uv-export
        name: export-requirements-only-tests
        args: ["-o", "requirements-only-tests-locked.txt", "--no-hashes", "--no-dev", "--no-emit-project", "--only-group", "tests"]
  - repo: local
    hooks:
      - id: ctt-toml
        name: ctt-toml
        entry: pdm run python scripts/write-ctt-toml.py
        entry: uv run python scripts/write-ctt-toml.py
        files: "scripts/write-ctt-toml.py"
        language: system
        require_serial: true
+6 −10
Changes for .readthedocs.yaml: 6 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -2,8 +2,6 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Thank you also https://browniebroke.com/blog/specify-docs-dependency-groups-with-poetry-and-read-the-docs/

# Required
version: 2

@@ -11,14 +9,12 @@ version: 2
build:
  os: ubuntu-22.04
  tools:
    python: "3.10"
    python: "3.11"
  jobs:
    post_install:
      # RtD seems to be not happy with pdm installs,
      # hence use pip directly instead.
    install:
      # For simplicity, use requirements files and pip directly.
      - python -m pip install -r requirements-docs-locked.txt
      - python -m pip list

mkdocs:
  configuration: mkdocs.yml
  fail_on_warning: true
    build:
      html:
        - python -m properdocs build --strict --site-dir "$READTHEDOCS_OUTPUT/html"
+1 −1
Changes for LICENCE: 1 added line, 1 removed line.
Original line number Diff line number Diff line
BSD 3-Clause License

Copyright (c) 2024, contributors to https://gitlab.com/openscm/copier-core-python-repository
Copyright (c) 2024-2026, contributors to https://gitlab.com/openscm/copier-core-python-repository

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Loading