Skip to content

Commit a1a72eb

Browse files
authored
⬆️ Update sphinx version to 5,6,7 (#6)
1 parent 5d0fb46 commit a1a72eb

File tree

10 files changed

+185
-16
lines changed

10 files changed

+185
-16
lines changed

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: github-actions
9+
directory: /
10+
commit-message:
11+
prefix: ⬆️
12+
schedule:
13+
interval: monthly
14+
- package-ecosystem: pip
15+
directory: /
16+
commit-message:
17+
prefix: ⬆️
18+
schedule:
19+
interval: monthly

.github/workflows/tests.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,21 @@ jobs:
2121
- uses: pre-commit/action@v2.0.0
2222

2323
tests:
24+
name: tests on py${{ matrix.python-version }} with sphinx~=${{ matrix.sphinx-version }}
2425
runs-on: ${{ matrix.os }}
2526
strategy:
2627
fail-fast: false
2728
matrix:
28-
python-version: ["3.7", "3.8", "3.9", "3.10"]
29+
python-version: ["3.8", "3.9", "3.10", "3.11"]
30+
sphinx-version: ["7.0"]
2931
os: ['ubuntu-latest']
32+
include:
33+
- python-version: "3.8"
34+
sphinx-version: "5.0"
35+
os: 'ubuntu-latest'
36+
- python-version: "3.8"
37+
sphinx-version: "6.0"
38+
os: 'ubuntu-latest'
3039

3140
steps:
3241
- uses: actions/checkout@v2
@@ -38,12 +47,31 @@ jobs:
3847
- name: Install dependencies
3948
run: |
4049
python -m pip install --upgrade pip
41-
pip install -e .[dev]
50+
pip install sphinx~=${{ matrix.sphinx-version }} -e .[dev]
4251
- name: Test with pytest
4352
run: pytest -vv --cov=sphinx_sqlalchemy
4453
env:
4554
SQLALCHEMY_WARN_20: 1
4655

56+
all-good:
57+
58+
# This job does nothing and is only used for the branch protection
59+
# see https://github.com/marketplace/actions/alls-green#why
60+
61+
if: always()
62+
63+
needs:
64+
- pre-commit
65+
- tests
66+
67+
runs-on: ubuntu-latest
68+
69+
steps:
70+
- name: Decide whether the needed jobs succeeded or failed
71+
uses: re-actors/alls-green@release/v1
72+
with:
73+
jobs: ${{ toJSON(needs) }}
74+
4775
publish:
4876

4977
name: Publish to PyPi

.readthedocs.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
version: 2
22

3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.8"
7+
38
python:
4-
version: "3.8"
59
install:
6-
- method: pip
7-
path: .
8-
extra_requirements:
9-
- docs
10+
- method: pip
11+
path: .
12+
extra_requirements:
13+
- docs
1014

1115
sphinx:
1216
builder: html

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77

88
extensions = ["sphinx_sqlalchemy"]
99

10+
html_title = "sphinx-sqlalchemy documentation"
1011
html_theme = "furo"

docs/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@ sphinx-sqlalchemy
33

44
Sphinx extension for documenting SQLAlchemy ORMs.
55

6+
Usage
7+
-----
8+
9+
Install ``sphinx_sqlalchemy``:
10+
11+
.. code-block:: bash
12+
13+
pip install sphinx_sqlalchemy
14+
15+
Add ``sphinx_sqlalchemy`` to your ``conf.py``:
16+
17+
.. code-block:: python
18+
19+
extensions = [
20+
'sphinx_sqlalchemy',
21+
]
22+
623
Example
724
-------
825

pyproject.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ classifiers = [
1717
"Operating System :: Microsoft :: Windows",
1818
"Operating System :: POSIX :: Linux",
1919
"Programming Language :: Python :: 3",
20-
"Programming Language :: Python :: 3.7",
2120
"Programming Language :: Python :: 3.8",
2221
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
2324
"Programming Language :: Python :: Implementation :: CPython",
2425
"Topic :: Software Development :: Libraries :: Python Modules",
2526
]
2627
keywords = ["sphinx", "extension"]
27-
requires-python = "~=3.7"
28+
requires-python = "~=3.8"
2829
dependencies = [
29-
"sphinx>=3,<5",
30+
"sphinx>=5,<8",
3031
"sqlalchemy~=1.4.22",
3132
]
3233

@@ -38,8 +39,10 @@ Documentation = "https://sphinx-sqlalchemy.readthedocs.io"
3839
dev = [
3940
"pytest",
4041
"pytest-cov",
42+
"sphinx-pytest",
43+
"syrupy~=4.0",
4144
]
42-
docs = ["furo==2021.11.23"]
45+
docs = ["furo"]
4346

4447
[tool.ruff]
4548
line-length = 100
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# serializer version: 1
2+
# name: test_basic
3+
'''
4+
<document source="<src>/index.rst">
5+
<definition_list classes="simple sqla">
6+
<definition_list_item>
7+
<term>
8+
module1.TestUser
9+
(
10+
<emphasis>
11+
dbusers
12+
)
13+
<definition>
14+
<paragraph>
15+
A
16+
<literal>
17+
user
18+
.
19+
<rubric>
20+
Columns:
21+
<table align="left" classes="colwidths-auto">
22+
<tgroup cols="3">
23+
<colspec>
24+
<colspec>
25+
<colspec>
26+
<tbody>
27+
<row>
28+
<entry>
29+
<paragraph>
30+
<emphasis>
31+
pk*
32+
<entry>
33+
<paragraph>
34+
INTEGER
35+
<entry>
36+
<paragraph>
37+
<row>
38+
<entry>
39+
<paragraph>
40+
first_name
41+
<entry>
42+
<paragraph>
43+
VARCHAR?
44+
<entry>
45+
<paragraph>
46+
The name of the user.
47+
<row>
48+
<entry>
49+
<paragraph>
50+
last_name
51+
<entry>
52+
<paragraph>
53+
VARCHAR(255)?
54+
<entry>
55+
<paragraph>
56+
The surname of the user.
57+
<row>
58+
<entry>
59+
<paragraph>
60+
dob
61+
<entry>
62+
<paragraph>
63+
DATE
64+
<entry>
65+
<paragraph>
66+
The date of birth.
67+
<rubric>
68+
Constraints:
69+
<bullet_list>
70+
<list_item>
71+
<paragraph>
72+
PRIMARY KEY (pk)
73+
<list_item>
74+
<paragraph>
75+
UNIQUE (first_name, last_name)
76+
'''
77+
# ---

tests/modules/module1.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from sqlalchemy import Column, UniqueConstraint, orm, types
2+
3+
Base = orm.declarative_base()
4+
5+
6+
class TestUser(Base):
7+
"""A ``user``."""
8+
9+
__tablename__ = "dbusers"
10+
__table_args__ = (UniqueConstraint("first_name", "last_name"),)
11+
pk = Column(types.Integer, primary_key=True)
12+
first_name = Column(types.String, doc="The name of the user.")
13+
last_name = Column(types.String(255), doc="The surname of the user.")
14+
dob = Column(types.Date, nullable=False, doc="The date of birth.")

tests/test_basic.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
"""Basic tests"""
2+
import os.path
3+
import sys
24

5+
from sphinx_pytest.plugin import CreateDoctree
36

4-
def test_basic():
7+
8+
def test_basic(sphinx_doctree_no_tr: CreateDoctree, snapshot):
59
"""Basic test"""
6-
assert True
10+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "modules"))
11+
sphinx_doctree_no_tr.set_conf({"extensions": ["sphinx_sqlalchemy"]})
12+
result = sphinx_doctree_no_tr(".. sqla-model:: module1.TestUser")
13+
assert not result.warnings
14+
assert "\n".join([li.rstrip() for li in result.pformat().splitlines()]) == snapshot

tox.ini

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ envlist = py38
99
[testenv]
1010
usedevelop = true
1111

12-
[testenv:py{37,38,39,310}]
12+
[testenv:py{38,39,310,311}]
1313
description = Run unit tests with this Python version
1414
extras =
1515
dev
16-
deps =
17-
black
1816
setenv =
1917
SQLALCHEMY_WARN_20 = 1
2018
commands = pytest {posargs}

0 commit comments

Comments
 (0)