Skip to content

Commit

Permalink
chore: Template upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed May 25, 2024
1 parent 9c7e304 commit ae9a5c2
Show file tree
Hide file tree
Showing 19 changed files with 362 additions and 493 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: 0.3.1
_commit: 1.1.1
_src_path: gh:mkdocstrings/handler-template
author_email: dev@pawamoy.fr
author_fullname: Timothée Mazzucotelli
Expand Down
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
24 changes: 14 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ jobs:
- name: Check if the code is correctly typed
run: make check-types

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

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

Expand All @@ -69,10 +66,14 @@ jobs:
{"python-version": "3.9"},
{"python-version": "3.10"},
{"python-version": "3.11"},
{"python-version": "3.12"}
{"python-version": "3.12"},
{"python-version": "3.13"}
]' | tr -d '[:space:]' >> $GITHUB_OUTPUT
else
echo 'jobs=[]' >> $GITHUB_OUTPUT
echo 'jobs=[
{"os": "macos-latest", "resolution": "lowest-direct"},
{"os": "windows-latest", "resolution": "lowest-direct"}
]' | tr -d '[:space:]' >> $GITHUB_OUTPUT
fi
tests:
Expand All @@ -91,9 +92,13 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
resolution:
- highest
- lowest-direct
exclude: ${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.python-version == '3.12' }}
continue-on-error: ${{ matrix.python-version == '3.13' }}

steps:
- name: Checkout
Expand All @@ -109,10 +114,9 @@ jobs:
run: pip install uv

- name: Install dependencies
run: |
uv venv
uv pip install -r devdeps.txt
uv pip install "mkdocstrings-python @ ."
env:
UV_RESOLUTION: ${{ matrix.resolution }}
run: make setup

- name: Run the test suite
run: make test
27 changes: 17 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# 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/

# cache
.cache/
.pytest_cache/
.mypy_cache/
.ruff_cache/
site/
.venv/
.venvs/
.cache/
__pycache__/
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# This Makefile is just here to allow auto-completion in the terminal.

actions = \
allrun \
changelog \
check \
check-api \
check-dependencies \
check-docs \
check-quality \
check-types \
Expand All @@ -16,6 +16,7 @@ actions = \
docs-deploy \
format \
help \
multirun \
release \
run \
setup \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<p align="center">A Python handler for <a href="https://github.com/mkdocstrings/mkdocstrings"><i>mkdocstrings</i></a>.</p>

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

---
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"
2 changes: 0 additions & 2 deletions config/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[pytest]
python_files =
test_*.py
*_test.py
tests.py
addopts =
--cov
--cov-config config/coverage.ini
Expand Down
6 changes: 4 additions & 2 deletions config/ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ line-length = 120

[lint]
exclude = [
"fixtures",
"site",
"tests/fixtures/*.py",
]
select = [
"A", "ANN", "ARG",
Expand Down Expand Up @@ -78,5 +77,8 @@ known-first-party = ["mkdocstrings_handlers.python"]
convention = "google"

[format]
exclude = [
"tests/fixtures/*.py",
]
docstring-code-format = true
docstring-code-line-length = 80
6 changes: 0 additions & 6 deletions config/vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
"command": "scripts/make",
"args": ["check-docs"]
},
{
"label": "check-dependencies",
"type": "process",
"command": "scripts/make",
"args": ["check-dependencies"]
},
{
"label": "check-api",
"type": "process",
Expand Down
51 changes: 28 additions & 23 deletions devdeps.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
build>=1.0
duty>=0.10
black>=23.9
markdown-callouts>=0.3
markdown-exec>=1.7
mkdocs>=1.5
# dev
editables>=0.5

# maintenance
build>=1.2
git-changelog>=2.5
twine>=5.1; python_version < '3.13'

# ci
duty>=1.4
ruff>=0.4
pytest>=8.2
pytest-cov>=5.0
pytest-randomly>=3.15
pytest-xdist>=3.6
mypy>=1.10
types-markdown>=3.6
types-pyyaml>=6.0

# docs
black>=24.4
markdown-callouts>=0.4
markdown-exec>=1.8
mkdocs>=1.6
mkdocs-coverage>=1.0
mkdocs-gen-files>=0.5
mkdocs-git-committers-plugin-2>=1.2
mkdocs-git-committers-plugin-2>=2.3
mkdocs-literate-nav>=0.6
mkdocs-material>=9.4
mkdocs-minify-plugin>=0.7
mkdocstrings[python]>=0.23
mkdocs-material>=9.5
mkdocs-minify-plugin>=0.8
mkdocstrings[python]>=0.25
tomli>=2.0; python_version < '3.11'
black>=23.9
blacken-docs>=1.16
git-changelog>=2.3
ruff>=0.0
pytest>=7.4
pytest-cov>=4.1
pytest-randomly>=3.15
pytest-xdist>=3.3
mypy>=1.5
types-markdown>=3.5
types-pyyaml>=6.0
safety>=2.3
twine>=5.0
124 changes: 6 additions & 118 deletions docs/insiders/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ of Insiders projects in the PyPI index of your choice
See [how to install it](https://pawamoy.github.io/pypi-insiders/#installation)
and [how to use it](https://pawamoy.github.io/pypi-insiders/#usage).

**We kindly ask that you do not upload the distributions to public registries,
as it is against our [Terms of use](index.md#terms).**

### with pip (ssh/https)

*mkdocstrings-python Insiders* can be installed with `pip` [using SSH][using ssh]:
Expand Down Expand Up @@ -58,130 +61,15 @@ pip install git+https://${GH_TOKEN}@github.com/pawamoy-insiders/mkdocstrings-pyt
> token must be kept secret at all times, as it allows the owner to access your
> private repositories.
### with pip (self-hosted)

Self-hosting the Insiders package makes it possible to depend on *mkdocstrings-python* normally,
while transparently downloading and installing the Insiders version locally.
It means that you can specify your dependencies normally, and your contributors without access
to Insiders will get the public version, while you get the Insiders version on your machine.

WARNING: **Limitation**
With this method, there is no way to force the installation of an Insiders version
rather than a public version. If there is a public version that is more recent
than your self-hosted Insiders version, the public version will take precedence.
Remember to regularly update your self-hosted versions by uploading latest distributions.

You can build the distributions for Insiders yourself, by cloning the repository
and using [build] to build the distributions,
or you can download them from our [GitHub Releases].
You can upload these distributions to a private PyPI-like registry
([Artifactory], [Google Cloud], [pypiserver], etc.)
with [Twine]:

[build]: https://pypi.org/project/build/
[Artifactory]: https://jfrog.com/help/r/jfrog-artifactory-documentation/pypi-repositories
[Google Cloud]: https://cloud.google.com/artifact-registry/docs/python
[pypiserver]: https://pypi.org/project/pypiserver/
[Github Releases]: https://github.com/pawamoy-insiders/mkdocstrings-python/releases
[Twine]: https://pypi.org/project/twine/

```bash
# download distributions in ~/dists, then upload with:
twine upload --repository-url https://your-private-index.com ~/dists/*
```

<small>You might also need to provide a username and password/token to authenticate against the registry.
Please check [Twine's documentation][twine docs].</small>

[twine docs]: https://twine.readthedocs.io/en/stable/

You can then configure pip (or other tools) to look for packages into your package index.
For example, with pip:

```bash
pip config set global.extra-index-url https://your-private-index.com/simple
```

Note that the URL might differ depending on whether your are uploading a package (with Twine)
or installing a package (with pip), and depending on the registry you are using (Artifactory, Google Cloud, etc.).
Please check the documentation of your registry to learn how to configure your environment.

**We kindly ask that you do not upload the distributions to public registries,
as it is against our [Terms of use](index.md#terms).**
### with Git

>? TIP: **Full example with `pypiserver`**
> In this example we use [pypiserver] to serve a local PyPI index.
>
> ```bash
> pip install --user pypiserver
> # or pipx install pypiserver
>
> # create a packages directory
> mkdir -p ~/.local/pypiserver/packages
>
> # run the pypi server without authentication
> pypi-server run -p 8080 -a . -P . ~/.local/pypiserver/packages &
> ```
>
> We can configure the credentials to access the server in [`~/.pypirc`][pypirc]:
>
> [pypirc]: https://packaging.python.org/en/latest/specifications/pypirc/
>
> ```ini title=".pypirc"
> [distutils]
> index-servers =
> local
>
> [local]
> repository: http://localhost:8080
> username:
> password:
> ```
>
> We then clone the Insiders repository, build distributions and upload them to our local server:
>
> ```bash
> # clone the repository
> git clone git@github.com:pawamoy-insiders/mkdocstrings-python
> cd mkdocstrings-python
>
> # install build
> pip install --user build
> # or pipx install build
>
> # checkout latest tag
> git checkout $(git describe --tags --abbrev=0)
>
> # build the distributions
> pyproject-build
>
> # upload them to our local server
> twine upload -r local dist/* --skip-existing
> ```
>
> Finally, we configure pip, and for example [PDM][pdm], to use our local index to find packages:
>
> ```bash
> pip config set global.extra-index-url http://localhost:8080/simple
> pdm config pypi.extra.url http://localhost:8080/simple
> ```
>
> [pdm]: https://pdm.fming.dev/latest/
>
> Now when running `pip install mkdocstrings-python`,
> or resolving dependencies with PDM,
> both tools will look into our local index and find the Insiders version.
> **Remember to update your local index regularly!**
### with git
Of course, you can use *mkdocstrings-python Insiders* directly from `git`:
Of course, you can use *mkdocstrings-python Insiders* directly using Git:

```
git clone git@github.com:pawamoy-insiders/mkdocstrings-python
```

When cloning from `git`, the package must be installed:
When cloning with Git, the package must be installed:

```
pip install -e mkdocstrings-python
Expand Down
Loading

0 comments on commit ae9a5c2

Please sign in to comment.