Skip to content

Commit 95a9c97

Browse files
committed
The usual scaffolding...
1 parent 6fcee99 commit 95a9c97

18 files changed

+751
-0
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: "Julian"

.github/SECURITY.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
In general, only the latest released `referencing-loaders` version is supported and will receive updates.
6+
7+
## Reporting a Vulnerability
8+
9+
To report a security vulnerability, please send an email to `Julian+Security` at `GrayVines.com` with subject line `SECURITY (referencing-loaders)`.
10+
11+
I will do my best to respond within 48 hours to acknowledge the message and discuss further steps.
12+
13+
If the vulnerability is accepted, an advisory will be sent out via GitHub's security advisory functionality.
14+
15+
For non-sensitive discussion related to this policy itself, feel free to open an issue on the issue tracker.

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types: [published]
8+
schedule:
9+
# Daily at 7:4
10+
- cron: "4 7 * * *"
11+
12+
env:
13+
PIP_DISABLE_PIP_VERSION_CHECK: "1"
14+
PIP_NO_PYTHON_VERSION_WARNING: "1"
15+
16+
jobs:
17+
pre-commit:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: actions/setup-python@v4
22+
with:
23+
python-version: "3.x"
24+
- uses: pre-commit/action@v3.0.0
25+
26+
list:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }}
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Set up nox
33+
uses: wntrblm/nox@2023.04.22
34+
- id: noxenvs-matrix
35+
run: |
36+
echo >>$GITHUB_OUTPUT noxenvs=$(
37+
nox --list-sessions --json | jq '[.[].session]'
38+
)
39+
40+
ci:
41+
needs: list
42+
runs-on: ${{ matrix.os }}
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
os: [macos-latest, ubuntu-latest]
47+
noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }}
48+
posargs: [""]
49+
include:
50+
- os: ubuntu-latest
51+
noxenv: "tests-3.11"
52+
posargs: coverage github
53+
54+
steps:
55+
- uses: actions/checkout@v3
56+
- name: Install dependencies
57+
run: sudo apt-get update && sudo apt-get install -y libenchant-2-dev
58+
if: runner.os == 'Linux' && startsWith(matrix.noxenv, 'docs')
59+
- name: Install dependencies
60+
run: brew install enchant
61+
if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs')
62+
- name: Set up nox
63+
uses: wntrblm/nox@2023.04.22
64+
- name: Run nox
65+
run: nox -s "${{ matrix.noxenv }}" -- ${{ matrix.posargs }}
66+
67+
packaging:
68+
needs: ci
69+
runs-on: ubuntu-latest
70+
environment:
71+
name: PyPI
72+
url: https://pypi.org/p/referencing-loaders
73+
permissions:
74+
contents: write
75+
id-token: write
76+
77+
steps:
78+
- uses: actions/checkout@v3
79+
- name: Set up Python
80+
uses: actions/setup-python@v4
81+
with:
82+
python-version: "3.x"
83+
- name: Install dependencies
84+
run: python -m pip install build
85+
- name: Create packages
86+
run: python -m build .
87+
- name: Publish to PyPI
88+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
89+
uses: pypa/gh-action-pypi-publish@release/v1
90+
- name: Create a Release
91+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
92+
uses: softprops/action-gh-release@v1
93+
with:
94+
files: |
95+
dist/*
96+
generate_release_notes: true

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-ast
7+
- id: check-toml
8+
- id: check-vcs-permalinks
9+
- id: check-yaml
10+
- id: debug-statements
11+
- id: end-of-file-fixer
12+
- id: mixed-line-ending
13+
args: [--fix, lf]
14+
- id: trailing-whitespace
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: "v0.1.6"
17+
hooks:
18+
- id: ruff
19+
args: [--fix, --exit-non-zero-on-fix]
20+
- repo: https://github.com/PyCQA/isort
21+
rev: 5.12.0
22+
hooks:
23+
- id: isort
24+
- repo: https://github.com/psf/black
25+
rev: 23.11.0
26+
hooks:
27+
- name: black
28+
id: black
29+
args: ["--line-length", "79"]
30+
- repo: https://github.com/pre-commit/mirrors-prettier
31+
rev: "v3.1.0"
32+
hooks:
33+
- id: prettier

README.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
=======================
2+
``referencing-loaders``
3+
=======================
4+
5+
|PyPI| |Pythons| |CI|
6+
7+
.. |PyPI| image:: https://img.shields.io/pypi/v/referencing-loaders.svg
8+
:alt: PyPI version
9+
:target: https://pypi.org/project/referencing-loaders/
10+
11+
.. |Pythons| image:: https://img.shields.io/pypi/pyversions/referencing-loaders.svg
12+
:alt: Supported Python versions
13+
:target: https://pypi.org/project/referencing-loaders/
14+
15+
.. |CI| image:: https://github.com/python-jsonschema/referencing-loaders/workflows/CI/badge.svg
16+
:alt: Build status
17+
:target: https://github.com/python-jsonschema/referencing-loaders/actions?query=workflow%3ACI
18+
19+
Experimental additional loaders for helping to build ``referencing.Registry`` objects out of various places.
20+
21+
Will likely merge into the ``referencing`` package when it's clear that what's here is "right".

docs/conf.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import importlib.metadata
2+
import re
3+
4+
from url import URL
5+
6+
GITHUB = URL.parse("https://github.com/")
7+
HOMEPAGE = GITHUB / "python-jsonschema/referencing-loaders"
8+
9+
project = "referencing-loaders"
10+
author = "Julian Berman"
11+
copyright = f"2023, {author}"
12+
13+
release = importlib.metadata.version("referencing-loaders")
14+
version = release.partition("-")[0]
15+
16+
language = "en"
17+
default_role = "any"
18+
19+
extensions = [
20+
"sphinx.ext.autodoc",
21+
"sphinx.ext.autosectionlabel",
22+
"sphinx.ext.coverage",
23+
"sphinx.ext.doctest",
24+
"sphinx.ext.extlinks",
25+
"sphinx.ext.intersphinx",
26+
"sphinx.ext.napoleon",
27+
"sphinx.ext.todo",
28+
"sphinx.ext.viewcode",
29+
"sphinx_copybutton",
30+
"sphinxcontrib.spelling",
31+
"sphinxext.opengraph",
32+
]
33+
34+
pygments_style = "lovelace"
35+
pygments_dark_style = "one-dark"
36+
37+
html_theme = "furo"
38+
39+
# See sphinx-doc/sphinx#10785
40+
_TYPE_ALIASES = dict(
41+
AnchorType=("class", "Anchor"),
42+
D=("data", "D"),
43+
ObjectSchema=("data", "ObjectSchema"),
44+
Schema=("data", "Schema"),
45+
URI=("attr", "URI"), # ?!?!?! Sphinx...
46+
)
47+
48+
49+
def _resolve_broken_refs(app, env, node, contnode):
50+
if node["refdomain"] != "py":
51+
return
52+
53+
if node["reftarget"].startswith("referencing.typing."):
54+
kind, target = "data", node["reftarget"]
55+
else:
56+
kind, target = _TYPE_ALIASES.get(node["reftarget"], (None, None))
57+
if kind is not None:
58+
return app.env.get_domain("py").resolve_xref(
59+
env,
60+
node["refdoc"],
61+
app.builder,
62+
kind,
63+
target,
64+
node,
65+
contnode,
66+
)
67+
68+
69+
def setup(app):
70+
app.connect("missing-reference", _resolve_broken_refs)
71+
72+
73+
def entire_domain(host):
74+
return r"http.?://" + re.escape(host) + r"($|/.*)"
75+
76+
77+
linkcheck_ignore = [
78+
entire_domain("img.shields.io"),
79+
f"{GITHUB}.*#.*",
80+
str(HOMEPAGE / "actions"),
81+
str(HOMEPAGE / "workflows/CI/badge.svg"),
82+
]
83+
84+
# = Extensions =
85+
86+
# -- autodoc --
87+
88+
autodoc_default_options = {
89+
"members": True,
90+
"member-order": "bysource",
91+
}
92+
93+
# -- autosectionlabel --
94+
95+
autosectionlabel_prefix_document = True
96+
97+
# -- intersphinx --
98+
99+
intersphinx_mapping = {
100+
"python": ("https://docs.python.org/", None),
101+
"referencing": ("https://referencing.readthedocs.io/en/stable/", None),
102+
}
103+
104+
# -- extlinks --
105+
106+
extlinks = {
107+
"gh": (str(HOMEPAGE) + "/%s", None),
108+
"github": (str(GITHUB) + "/%s", None),
109+
}
110+
extlinks_detect_hardcoded_links = True
111+
112+
# -- sphinxcontrib-spelling --
113+
114+
spelling_word_list_filename = "spelling-wordlist.txt"
115+
spelling_show_suggestions = True

docs/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.. toctree::
2+
:glob:
3+
:hidden:

docs/requirements.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
file:.#egg=referencing-loaders
2+
furo
3+
pygments-github-lexers
4+
sphinx-copybutton
5+
sphinx>5
6+
sphinxcontrib-spelling>5
7+
sphinxext-opengraph
8+
url.py

0 commit comments

Comments
 (0)