Skip to content

Commit 2756bce

Browse files
committed
first commit
0 parents  commit 2756bce

26 files changed

+1078
-0
lines changed

.github/workflows/publish.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Publish 📡 Python 🐍 distributions 📦
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
lint:
10+
name: Lint 🧹 and Check 🧐 Python 🐍 package 🗂️
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup 🛠️ Python 🐍
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.x"
20+
21+
- name: Install 🛠️ dependencies 📚
22+
run: |
23+
pip install --upgrade pip
24+
pip install --requirement=requirements-dev.txt
25+
26+
- name: Lint 🧹 with Ruff ⚡️
27+
run: ruff check --output-format=github .
28+
29+
- name: Check 🧐 with mypy 👐🐍
30+
run: mypy --package="griffe_generics"
31+
32+
test:
33+
name: Test 🔍 package 🗂️
34+
needs: [lint]
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Setup 🛠️ Python 🐍
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
48+
- name: Install 🛠️ dependencies 📚
49+
run: |
50+
pip install --upgrade pip
51+
pip install --requirement=requirements.txt --requirement=tests/requirements.txt
52+
53+
- name: Run ⏱️ tests 📊
54+
run: pytest
55+
56+
build:
57+
name: Build 🏗️ distributions 📦
58+
needs: [test]
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- name: Setup 🛠️ Python 🐍
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: "3.x"
68+
69+
- name: Build 🏗️ a source distribution 🗃️ and a binary wheel 🛞
70+
run: pipx run build --outdir=distributions
71+
72+
- name: Upload 📤 the built distributions 📦
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: distributions
76+
path: distributions/
77+
78+
publish-to-pypi:
79+
name: Publish 📡 Python 🐍 distributions 📦 to PyPI 🌐
80+
needs: [build]
81+
runs-on: ubuntu-latest
82+
environment:
83+
name: release
84+
url: https://pypi.org/p/griffe-generics
85+
permissions:
86+
id-token: write
87+
88+
steps:
89+
- name: Download 📥 all the distributions 📦
90+
uses: actions/download-artifact@v4
91+
with:
92+
pattern: distributions
93+
path: distributions/
94+
merge-multiple: true
95+
96+
- name: Publish 📡 distributions 📦 to PyPI 🌐
97+
uses: pypa/gh-action-pypi-publish@release/v1
98+
with:
99+
packages-dir: distributions/
100+
101+
upload-to-github-release:
102+
name: Upload 📤 Python 🐍 distributions 📦 to GitHub Release 🚀
103+
needs: [publish-to-pypi]
104+
runs-on: ubuntu-latest
105+
permissions:
106+
id-token: write
107+
contents: write
108+
109+
steps:
110+
- name: Download 📥 all the distributions 📦
111+
uses: actions/download-artifact@v4
112+
with:
113+
pattern: distributions
114+
path: distributions/
115+
merge-multiple: true
116+
117+
- name: Sign 🔑 the distributions 📦 with Sigstore
118+
uses: sigstore/gh-action-sigstore-python@v3.0.0
119+
with:
120+
inputs: |
121+
distributions/*.tar.gz
122+
distributions/*.whl
123+
124+
- name: Create 📂 GitHub Release 🚀
125+
env:
126+
GITHUB_TOKEN: ${{ github.token }}
127+
run: gh release --repo="${{ github.repository }}" create "${{ github.ref_name }}"
128+
129+
- name: Upload 📤 distributions 📦 and signatures 🔏 to GitHub Release 🚀
130+
env:
131+
GITHUB_TOKEN: ${{ github.token }}
132+
run: gh release --repo="${{ github.repository }}" upload "${{ github.ref_name }}" distributions/**

.gitignore

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/python,macos
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=python,macos
3+
4+
### macOS ###
5+
# General
6+
.DS_Store
7+
.AppleDouble
8+
.LSOverride
9+
10+
# Icon must end with two \r
11+
Icon
12+
13+
14+
# Thumbnails
15+
._*
16+
17+
# Files that might appear in the root of a volume
18+
.DocumentRevisions-V100
19+
.fseventsd
20+
.Spotlight-V100
21+
.TemporaryItems
22+
.Trashes
23+
.VolumeIcon.icns
24+
.com.apple.timemachine.donotpresent
25+
26+
# Directories potentially created on remote AFP share
27+
.AppleDB
28+
.AppleDesktop
29+
Network Trash Folder
30+
Temporary Items
31+
.apdisk
32+
33+
### macOS Patch ###
34+
# iCloud generated files
35+
*.icloud
36+
37+
### Python ###
38+
# Byte-compiled / optimized / DLL files
39+
__pycache__/
40+
*.py[cod]
41+
*$py.class
42+
43+
# C extensions
44+
*.so
45+
46+
# Distribution / packaging
47+
.Python
48+
build/
49+
develop-eggs/
50+
dist/
51+
downloads/
52+
eggs/
53+
.eggs/
54+
lib/
55+
lib64/
56+
parts/
57+
sdist/
58+
var/
59+
wheels/
60+
share/python-wheels/
61+
*.egg-info/
62+
.installed.cfg
63+
*.egg
64+
MANIFEST
65+
66+
# PyInstaller
67+
# Usually these files are written by a python script from a template
68+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
69+
*.manifest
70+
*.spec
71+
72+
# Installer logs
73+
pip-log.txt
74+
pip-delete-this-directory.txt
75+
76+
# Unit test / coverage reports
77+
htmlcov/
78+
.tox/
79+
.nox/
80+
.coverage
81+
.coverage.*
82+
.cache
83+
nosetests.xml
84+
coverage.xml
85+
*.cover
86+
*.py,cover
87+
.hypothesis/
88+
.pytest_cache/
89+
cover/
90+
91+
# Translations
92+
*.mo
93+
*.pot
94+
95+
# Django stuff:
96+
*.log
97+
local_settings.py
98+
db.sqlite3
99+
db.sqlite3-journal
100+
101+
# Flask stuff:
102+
instance/
103+
.webassets-cache
104+
105+
# Scrapy stuff:
106+
.scrapy
107+
108+
# Sphinx documentation
109+
docs/_build/
110+
111+
# PyBuilder
112+
.pybuilder/
113+
target/
114+
115+
# Jupyter Notebook
116+
.ipynb_checkpoints
117+
118+
# IPython
119+
profile_default/
120+
ipython_config.py
121+
122+
# pyenv
123+
# For a library or package, you might want to ignore these files since the code is
124+
# intended to run in multiple environments; otherwise, check them in:
125+
# .python-version
126+
127+
# pipenv
128+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
129+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
130+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
131+
# install all needed dependencies.
132+
#Pipfile.lock
133+
134+
# poetry
135+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
136+
# This is especially recommended for binary packages to ensure reproducibility, and is more
137+
# commonly ignored for libraries.
138+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
139+
#poetry.lock
140+
141+
# pdm
142+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
143+
#pdm.lock
144+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
145+
# in version control.
146+
# https://pdm.fming.dev/#use-with-ide
147+
.pdm.toml
148+
149+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
150+
__pypackages__/
151+
152+
# Celery stuff
153+
celerybeat-schedule
154+
celerybeat.pid
155+
156+
# SageMath parsed files
157+
*.sage.py
158+
159+
# Environments
160+
.env
161+
.venv
162+
env/
163+
venv/
164+
ENV/
165+
env.bak/
166+
venv.bak/
167+
168+
# Spyder project settings
169+
.spyderproject
170+
.spyproject
171+
172+
# Rope project settings
173+
.ropeproject
174+
175+
# mkdocs documentation
176+
/site
177+
178+
# mypy
179+
.mypy_cache/
180+
.dmypy.json
181+
dmypy.json
182+
183+
# Pyre type checker
184+
.pyre/
185+
186+
# pytype static type analyzer
187+
.pytype/
188+
189+
# Cython debug symbols
190+
cython_debug/
191+
192+
# PyCharm
193+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
194+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
195+
# and can be added to the global gitignore or merged into this file. For a more nuclear
196+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
197+
#.idea/
198+
199+
### Python Patch ###
200+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
201+
poetry.toml
202+
203+
# ruff
204+
.ruff_cache/
205+
206+
# LSP config files
207+
pyrightconfig.json
208+
209+
# End of https://www.toptal.com/developers/gitignore/api/python,macos

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2024 Jonghwan Hyeon
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# griffe-generics
2+
![Build status](https://github.com/jonghwanhyeon/griffe-generics/actions/workflows/publish.yml/badge.svg)
3+
4+
A Griffe extension that resolves generic type parameters as bound types in subclasses
5+
6+
## Example
7+
Without extension:
8+
![Without Extension](https://github.com/jonghwanhyeon/griffe-generics/raw/main/assets/without-extension.png)
9+
10+
With extension:
11+
![With Extension](https://github.com/jonghwanhyeon/griffe-generics/raw/main/assets/without-extension.png)
12+
13+
## Install
14+
To install **griffe-generics**, simply use pip:
15+
16+
```console
17+
$ pip install griffe-generics
18+
```
19+
20+
## Usage
21+
```yaml
22+
plugins:
23+
- mkdocstrings:
24+
handlers:
25+
python:
26+
options:
27+
extensions:
28+
- griffe_generics
29+
```

assets/with-extension.png

82.6 KB
Loading

assets/without-extension.png

71.1 KB
Loading

griffe_generics/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from griffe_generics.extension import GenericsExtension
2+
3+
__version__ = "1.0.12"
4+
5+
__all__ = ["GenericsExtension"]

0 commit comments

Comments
 (0)