Skip to content

Commit

Permalink
chore: Switch to Copier UV template
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed May 16, 2024
1 parent f5a7b70 commit d687a80
Show file tree
Hide file tree
Showing 26 changed files with 603 additions and 424 deletions.
4 changes: 2 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changes here will be overwritten by Copier
_commit: 1.2.6
_src_path: gh:pawamoy/copier-pdm
_commit: 1.2.4
_src_path: gh:pawamoy/copier-uv
author_email: [email protected]
author_fullname: Timothée Mazzucotelli
author_username: pawamoy
Expand Down
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PATH_add scripts
5 changes: 5 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
github: pawamoy
ko_fi: pawamoy
polar: pawamoy
custom:
- https://www.paypal.me/pawamoy
51 changes: 31 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
LANG: en_US.utf-8
LC_ALL: en_US.utf-8
PYTHONIOENCODING: UTF-8
PYTHON_VERSIONS: ""

jobs:

Expand All @@ -28,36 +29,35 @@ jobs:
- name: Fetch all tags
run: git fetch --depth=1 --tags

- name: Set up PDM
uses: pdm-project/setup-pdm@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.11"

- name: Resolving dependencies
run: pdm lock -v --no-cross-platform -G ci-quality
- name: Install uv
run: pip install uv

- name: Install dependencies
run: pdm install -G ci-quality
run: make setup

- name: Check if the documentation builds correctly
run: pdm run duty check-docs
run: make check-docs

- name: Check the code quality
run: pdm run duty check-quality
run: make check-quality

- name: Check if the code is correctly typed
run: pdm run duty check-types
run: make check-types

- name: Check for vulnerabilities in dependencies
run: pdm run duty check-dependencies
run: make check-dependencies

- name: Check for breaking changes in the API
run: pdm run duty check-api
run: make check-api

tests:

strategy:
max-parallel: 4
matrix:
os:
- ubuntu-latest
Expand All @@ -69,24 +69,35 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
resolution:
- highest
- lowest-direct
exclude:
- os: macos-latest
resolution: lowest-direct
- os: windows-latest
resolution: lowest-direct
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.python-version == '3.12' }}
continue-on-error: ${{ matrix.python-version == '3.13' }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up PDM
uses: pdm-project/setup-pdm@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-python-prereleases: true
allow-prereleases: true

- name: Resolving dependencies
run: pdm lock -v --no-cross-platform -G ci-tests
- name: Install uv
run: pip install uv

- name: Install dependencies
run: pdm install --no-editable -G ci-tests
env:
UV_RESOLUTION: ${{ matrix.resolution }}
run: make setup

- name: Run the test suite
run: pdm run duty test
run: make test
34 changes: 19 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# editors
.idea/
.vscode/
__pycache__/
*.py[cod]
dist/

# python
*.egg-info/
build/
htmlcov/
.coverage*
pip-wheel-metadata/
.pytest_cache/
.python-version
site/
pdm.lock
pdm.toml
.pdm-plugins/
.pdm-python
__pypackages__/
*.py[cod]
.venv/
.venvs/
/build/
/dist/

# tools
.coverage*
/.pdm-build/
/htmlcov/
/site/

# cache
.cache/
.pytest_cache/
.mypy_cache/
.ruff_cache/
__pycache__/
2 changes: 1 addition & 1 deletion .gitpod.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ FROM gitpod/workspace-full
USER gitpod
ENV PIP_USER=no
RUN pip3 install pipx; \
pipx install pdm; \
pipx install uv; \
pipx ensurepath
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ make setup
> NOTE:
> If it fails for some reason,
> you'll need to install
> [PDM](https://github.com/pdm-project/pdm)
> [uv](https://github.com/astral-sh/uv)
> manually.
>
> You can install it with:
>
> ```bash
> python3 -m pip install --user pipx
> pipx install pdm
> pipx install uv
> ```
>
> Now you can try running `make setup` again,
> or simply `pdm install`.
> or simply `uv install`.
You now have the dependencies installed.
Expand All @@ -39,13 +39,13 @@ Run `make help` to see all the available actions!
This project uses [duty](https://github.com/pawamoy/duty) to run tasks.
A Makefile is also provided. The Makefile will try to run certain tasks
on multiple Python versions. If for some reason you don't want to run the task
on multiple Python versions, you run the task directly with `pdm run duty TASK`.
on multiple Python versions, you run the task directly with `make run duty TASK`.
The Makefile detects if a virtual environment is activated,
so `make` will work the same with the virtualenv activated or not.
If you work in VSCode, we provide
[an action to configure VSCode](https://pawamoy.github.io/copier-pdm/work/#vscode-setup)
[an action to configure VSCode](https://pawamoy.github.io/copier-uv/work/#vscode-setup)
for the project.
## Development
Expand Down
59 changes: 17 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,54 +1,29 @@
.DEFAULT_GOAL := help
SHELL := bash
DUTY := $(if $(VIRTUAL_ENV),,pdm run) duty
export PDM_MULTIRUN_VERSIONS ?= 3.8 3.9 3.10 3.11 3.12
export PDM_MULTIRUN_USE_VENVS ?= $(if $(shell pdm config python.use_venv | grep True),1,0)
# If you have `direnv` loaded in your shell, and allow it in the repository,
# the `make` command will point at the `scripts/make` shell script.
# This Makefile is just here to allow auto-completion in the terminal.

args = $(foreach a,$($(subst -,_,$1)_args),$(if $(value $a),$a="$($a)"))
check_quality_args = files
docs_args = host port
release_args = version
test_args = cleancov match

BASIC_DUTIES = \
actions = \
allrun \
changelog \
check \
check-api \
check-dependencies \
check-docs \
check-quality \
check-types \
clean \
coverage \
docs \
docs-deploy \
format \
help \
multirun \
release \
run \
setup \
test \
vscode

QUALITY_DUTIES = \
check-quality \
check-docs \
check-types \
test

.PHONY: help
help:
@$(DUTY) --list

.PHONY: lock
lock:
@pdm lock -G:all

.PHONY: setup
setup:
@bash scripts/setup.sh

.PHONY: check
check:
@pdm multirun duty check-quality check-types check-docs
@$(DUTY) check-dependencies check-api

.PHONY: $(BASIC_DUTIES)
$(BASIC_DUTIES):
@$(DUTY) $@ $(call args,$@)

.PHONY: $(QUALITY_DUTIES)
$(QUALITY_DUTIES):
@pdm multirun duty $@ $(call args,$@)
.PHONY: $(actions)
$(actions):
@bash scripts/make "$@"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# mkdocs-autorefs

[![ci](https://github.com/mkdocstrings/autorefs/workflows/ci/badge.svg)](https://github.com/mkdocstrings/autorefs/actions?query=workflow%3Aci)
[![documentation](https://img.shields.io/badge/docs-mkdocs%20material-blue.svg?style=flat)](https://mkdocstrings.github.io/autorefs/)
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://mkdocstrings.github.io/autorefs/)
[![pypi version](https://img.shields.io/pypi/v/mkdocs-autorefs.svg)](https://pypi.org/project/mkdocs-autorefs/)
[![conda version](https://img.shields.io/conda/vn/conda-forge/mkdocs-autorefs.svg)](https://anaconda.org/conda-forge/mkdocs-autorefs)
[![gitpod](https://img.shields.io/badge/gitpod-workspace-blue.svg?style=flat)](https://gitpod.io/#https://github.com/mkdocstrings/autorefs)
[![gitpod](https://img.shields.io/badge/gitpod-workspace-708FCC.svg?style=flat)](https://gitpod.io/#https://github.com/mkdocstrings/autorefs)
[![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#autorefs:gitter.im)

Automatically link across pages in MkDocs.
Expand Down
3 changes: 0 additions & 3 deletions config/black.toml

This file was deleted.

3 changes: 2 additions & 1 deletion config/coverage.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ source =
[coverage:paths]
equivalent =
src/
__pypackages__/
.venv/lib/*/site-packages/
.venvs/*/lib/*/site-packages/

[coverage:report]
ignore_errors = True
Expand Down
1 change: 1 addition & 0 deletions config/git-changelog.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ parse-refs = false
parse-trailers = true
sections = ["build", "deps", "feat", "fix", "refactor"]
template = "keepachangelog"
versioning = "pep440"
6 changes: 0 additions & 6 deletions config/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
[pytest]
norecursedirs =
.git
.tox
.env
dist
build
python_files =
test_*.py
*_test.py
Expand Down
Loading

0 comments on commit d687a80

Please sign in to comment.