Skip to content

Commit

Permalink
chore: Template upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Mar 13, 2024
1 parent 548bdad commit 6364fbc
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 51 deletions.
7 changes: 4 additions & 3 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Changes here will be overwritten by Copier
_commit: 1.2.0
_commit: 1.2.6
_src_path: gh:pawamoy/copier-pdm
author_email: [email protected]
author_email: [email protected]
author_fullname: Timothée Mazzucotelli
author_username: pawamoy
copyright_date: '2021'
copyright_holder: Timothée Mazzucotelli
copyright_holder_email: [email protected]
copyright_holder_email: [email protected]
copyright_license: ISC License
insiders: true
insiders_email: [email protected]
insiders_repository_name: mkdocstrings-python
project_description: A Python handler for mkdocstrings.
project_name: mkdocstrings-python
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ jobs:

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

- name: Fetch all tags
run: git fetch --depth=1 --tags

- name: Set up PDM
uses: pdm-project/setup-pdm@v3
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.8"

Expand Down Expand Up @@ -96,10 +96,10 @@ jobs:

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

- name: Set up PDM
uses: pdm-project/setup-pdm@v3
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
allow-python-prereleases: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Fetch all tags
run: git fetch --depth=1 --tags
- name: Setup Python
Expand All @@ -22,7 +22,7 @@ jobs:
if: github.repository_owner == 'pawamoy-insiders'
run: python -m build
- name: Upload dists artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: github.repository_owner == 'pawamoy-insiders'
with:
name: python-insiders
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
.vscode/
__pycache__/
*.py[cod]
dist/
Expand Down
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
6 changes: 5 additions & 1 deletion config/ruff.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
target-version = "py38"
line-length = 132
line-length = 120
exclude = [
"fixtures",
"site",
Expand Down Expand Up @@ -102,3 +102,7 @@ known-first-party = ["mkdocstrings_handlers"]

[pydocstyle]
convention = "google"

[format]
docstring-code-format = true
docstring-code-line-length = 80
4 changes: 2 additions & 2 deletions config/vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"configurations": [
{
"name": "python (current file)",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
},
{
"name": "test",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"justMyCode": false,
Expand Down
44 changes: 29 additions & 15 deletions docs/insiders/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,31 @@ data_source = [
```

<!-- blacken-docs:off -->
```python exec="1" session="insiders"
```python exec="1" session="insiders" idprefix=""
--8<-- "scripts/insiders.py"

print(
f"""The moment you <a href="#how-to-become-a-sponsor">become a sponsor</a>, you'll get **immediate
access to {len(unreleased_features)} additional features** that you can start using right away, and
which are currently exclusively available to sponsors:\n"""
)

for feature in unreleased_features:
feature.render(badge=True)
if unreleased_features:
print(
"The moment you [become a sponsor](#how-to-become-a-sponsor), you'll get **immediate "
f"access to {len(unreleased_features)} additional features** that you can start using right away, and "
"which are currently exclusively available to sponsors:\n"
)

for feature in unreleased_features:
feature.render(badge=True)

print(
"\n\nThese are just the features related to this project. "
"[See the complete feature list on the author's main Insiders page](https://pawamoy.github.io/insiders/#whats-in-it-for-me)."
)
else:
print(
"The moment you [become a sponsor](#how-to-become-a-sponsor), you'll get immediate "
"access to all released features that you can start using right away, and "
"which are exclusively available to sponsors. At this moment, there are no "
"Insiders features for this project, but checkout the [next funding goals](#goals) "
"to see what's coming, as well as **[the feature list for all Insiders projects](https://pawamoy.github.io/insiders/#whats-in-it-for-me).**"
)
```
<!-- blacken-docs:on -->

Expand All @@ -88,7 +102,7 @@ You can use your individual or organization GitHub account for sponsoring.

**Important**: If you're sponsoring **[@pawamoy][github sponsor profile]**
through a GitHub organization, please send a short email
to [email protected] with the name of your
to [email protected] with the name of your
organization and the GitHub account of the individual
that should be added as a collaborator.[^4]

Expand All @@ -97,7 +111,7 @@ You can cancel your sponsorship anytime.[^5]
[^4]:
It's currently not possible to grant access to each member of an
organization, as GitHub only allows for adding users. Thus, after
sponsoring, please send an email to [email protected], stating which
sponsoring, please send an email to [email protected], stating which
account should become a collaborator of the Insiders repository. We're
working on a solution which will make access to organizations much simpler.
To ensure that access is not tied to a particular individual GitHub account,
Expand All @@ -120,10 +134,10 @@ You can cancel your sponsorship anytime.[^5]

<hr>
<div class="premium-sponsors">

<div id="bronze-sponsors"></div>
<div id="gold-sponsors"></div>
<div id="silver-sponsors"></div>
<div id="bronze-sponsors"></div>
</div>

<hr>

<div id="sponsors"></div>
Expand Down Expand Up @@ -188,7 +202,7 @@ yearly billing cycle][billing cycle]. If for some reason you cannot do that, you
could also create a dedicated GitHub account with a yearly billing cycle, which
you only use for sponsoring (some sponsors already do that).

If you have any problems or further questions, please reach out to [email protected].
If you have any problems or further questions, please reach out to [email protected].

### Terms

Expand Down
4 changes: 2 additions & 2 deletions docs/insiders/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ as it is against our [Terms of use](index.md#terms).**
> ```bash
> # clone the repository
> git clone [email protected]:pawamoy-insiders/mkdocstrings-python
> cd python
> cd mkdocstrings-python
>
> # install build
> pip install --user build
Expand Down Expand Up @@ -184,7 +184,7 @@ git clone [email protected]:pawamoy-insiders/mkdocstrings-python
When cloning from `git`, the package must be installed:

```
pip install -e python
pip install -e mkdocstrings-python
```

## Upgrading
Expand Down
39 changes: 23 additions & 16 deletions docs/js/insiders.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ function getJSON(url, callback) {
xhr.send();
}

function updatePremiumSponsors(dataURL, rank) {
let capRank = rank.charAt(0).toUpperCase() + rank.slice(1);
getJSON(dataURL + `/sponsors${capRank}.json`, function (err, sponsors) {
const sponsorsDiv = document.getElementById(`${rank}-sponsors`);
if (sponsors.length > 0) {
let html = '';
html += `<b>${capRank} sponsors</b><p>`
sponsors.forEach(function (sponsor) {
html += `
<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">
<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">
</a>
`
});
html += '</p>'
sponsorsDiv.innerHTML = html;
}
});
}

function updateInsidersPage(author_username) {
const sponsorURL = `https://github.com/sponsors/${author_username}`
const dataURL = `https://raw.githubusercontent.com/${author_username}/sponsors/main`;
Expand Down Expand Up @@ -48,20 +68,7 @@ function updateInsidersPage(author_username) {
}
});
});
getJSON(dataURL + '/sponsorsBronze.json', function (err, sponsors) {
const bronzeSponsors = document.getElementById("bronze-sponsors");
if (sponsors) {
let html = '';
html += '<b>Bronze sponsors</b><p>'
sponsors.forEach(function (sponsor) {
html += `
<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">
<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">
</a>
`
});
html += '</p>'
bronzeSponsors.innerHTML = html;
}
});
updatePremiumSponsors(dataURL, "gold");
updatePremiumSponsors(dataURL, "silver");
updatePremiumSponsors(dataURL, "bronze");
}
4 changes: 2 additions & 2 deletions duties.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from typing import TYPE_CHECKING, Iterator

from duty import duty
from duty.callables import black, coverage, lazy, mkdocs, mypy, pytest, ruff, safety
from duty.callables import coverage, lazy, mkdocs, mypy, pytest, ruff, safety

if TYPE_CHECKING:
from duty.context import Context
Expand Down Expand Up @@ -225,7 +225,7 @@ def format(ctx: Context) -> None:
ruff.check(*PY_SRC_LIST, config="config/ruff.toml", fix_only=True, exit_zero=True),
title="Auto-fixing code",
)
ctx.run(black.run(*PY_SRC_LIST, config="config/black.toml"), title="Formatting code")
ctx.run(ruff.format(*PY_SRC_LIST, config="config/ruff.toml"), title="Formatting code")


@duty(post=["docs-deploy"])
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "pdm.backend"
[project]
name = "mkdocstrings-python"
description = "A Python handler for mkdocstrings."
authors = [{name = "Timothée Mazzucotelli", email = "[email protected]"}]
authors = [{name = "Timothée Mazzucotelli", email = "[email protected]"}]
license = {text = "ISC"}
readme = "README.md"
requires-python = ">=3.8"
Expand Down
5 changes: 3 additions & 2 deletions scripts/gen_ref_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
nav = mkdocs_gen_files.Nav()
mod_symbol = '<code class="doc-symbol doc-symbol-nav doc-symbol-module"></code>'

src = Path(__file__).parent.parent / "src"
root = Path(__file__).parent.parent
src = root / "src"

for path in sorted(src.rglob("*.py")):
module_path = path.relative_to(src).with_suffix("")
Expand All @@ -30,7 +31,7 @@
ident = ".".join(parts)
fd.write(f"::: {ident}")

mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path)
mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path.relative_to(root))

with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())

0 comments on commit 6364fbc

Please sign in to comment.