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 Sep 7, 2024
1 parent 3819d44 commit 4229223
Show file tree
Hide file tree
Showing 37 changed files with 706 additions and 499 deletions.
10 changes: 5 additions & 5 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Changes here will be overwritten by Copier
_commit: 1.2.6
_src_path: gh:pawamoy/copier-pdm
author_email: [email protected]
_commit: 1.4.1
_src_path: gh:pawamoy/copier-uv
author_email: [email protected]
author_fullname: Timothée Mazzucotelli
author_username: pawamoy
copyright_date: '2020'
copyright_holder: Timothée Mazzucotelli
copyright_holder_email: [email protected]
copyright_holder_email: [email protected]
copyright_license: ISC License
insiders: false
project_description: Load Python objects documentation.
Expand All @@ -15,6 +15,6 @@ python_package_command_line_name: pytkdocs
python_package_distribution_name: pytkdocs
python_package_import_name: pytkdocs
repository_name: pytkdocs
repository_namespace: pawamoy
repository_namespace: mkdocstrings
repository_provider: github.com

1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PATH_add scripts
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
github: pawamoy
ko_fi: pawamoy
polar: pawamoy
custom:
- https://www.paypal.me/pawamoy
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ PASTE TRACEBACK HERE
pytkdocs --debug-info # | xclip -selection clipboard
```

PASTE OUTPUT HERE
PASTE MARKDOWN OUTPUT HERE

### Additional context
<!-- Add any other relevant context about the problem here,
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/3-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Documentation update
about: Point at unclear, missing or outdated documentation.
title: "docs: "
labels: docs
assignees: pawamoy
---

### Is something unclear, missing or outdated in our documentation?
<!-- A clear and concise description of what the documentation issue is. Ex. I can't find an explanation on feature [...]. -->

### Relevant code snippets
<!-- If the documentation issue is related to code, please provide relevant code snippets. -->

### Link to the relevant documentation section
<!-- Add a link to the relevant section of our documentation, or any addition context. -->
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/4-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Change request
about: Suggest any other kind of change for this project.
title: "change: "
assignees: pawamoy
---

### Is your change request related to a problem? Please describe.
<!-- A clear and concise description of what the problem is. -->

### Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->

### Describe alternatives you've considered
<!-- A clear and concise description of any alternative solutions you've considered. -->

### Additional context
<!-- Add any other context or screenshots about the change request here. -->
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: I have a question / I need help
url: https://github.com/pawamoy/pytkdocs/discussions/new?category=q-a
url: https://github.com/mkdocstrings/pytkdocs/discussions/new?category=q-a
about: Ask and answer questions in the Discussions tab.
54 changes: 32 additions & 22 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,32 @@ 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

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

- 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 +66,37 @@ 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: Setup uv
uses: astral-sh/setup-uv@v1
with:
enable-cache: true

- 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
33 changes: 19 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# editors
.idea/
.vscode/
__pycache__/
*.py[cod]
dist/

# python
*.egg-info/
build/
htmlcov/
*.py[cod]
.venv/
.venvs/
/build/
/dist/

# tools
.coverage*
pip-wheel-metadata/
/.pdm-build/
/htmlcov/
/site/
uv.lock

# cache
.cache/
.pytest_cache/
.mypy_cache/
site/
pdm.lock
pdm.toml
.pdm-plugins/
.pdm-python
__pypackages__/
.venv/
.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
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
[email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
22 changes: 10 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,35 @@ 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.
You can run the application with `pdm run pytkdocs [ARGS...]`.
You can run the application with `make run pytkdocs [ARGS...]`.
Run `make help` to see all the available actions!
## Tasks
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`.
The Makefile detects if a virtual environment is activated,
so `make` will work the same with the virtualenv activated or not.
The entry-point to run commands and tasks is the `make` Python script,
located in the `scripts` directory. Try running `make` to show the available commands and tasks.
The *commands* do not need the Python dependencies to be installed,
while the *tasks* do.
The cross-platform tasks are written in Python, thanks to [duty](https://github.com/pawamoy/duty).
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
60 changes: 17 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,54 +1,28 @@
.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 = 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):
@python scripts/make "$@"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# pytkdocs

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

Load Python objects documentation.
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]
precision = 2
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"
Loading

0 comments on commit 4229223

Please sign in to comment.