Skip to content

Commit b7f9287

Browse files
v1.0.7 🧰
* Fix #27, #28, improve tests * Replace setup.py with pyproject.toml * make flake8 happy * Update requirements.txt * Fix pipeline
1 parent c70519b commit b7f9287

File tree

18 files changed

+219
-101
lines changed

18 files changed

+219
-101
lines changed

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
[flake8]
2+
exclude = __pycache__,built,build,venv
23
ignore = E203, E266, W503
34
max-line-length = 88
45
max-complexity = 18
56
per-file-ignores =
67
tests/test_v2.py: E501
78
tests/test_v3.py: E501
9+
select = B,C,E,F,W,T4,B9

.github/workflows/build.yml

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,19 @@ jobs:
8383
bash <(curl -s https://codecov.io/bash)
8484
8585
- name: Install distribution dependencies
86-
run: pip install --upgrade twine setuptools wheel
87-
if: matrix.python-version == 3.10
86+
run: pip install build
87+
if: matrix.python-version == 3.11
8888

8989
- name: Create distribution package
90-
run: python setup.py sdist bdist_wheel
91-
if: matrix.python-version == 3.10
90+
run: python -m build
91+
if: matrix.python-version == 3.11
9292

9393
- name: Upload distribution package
9494
uses: actions/upload-artifact@master
9595
with:
96-
name: dist-package-${{ matrix.python-version }}
96+
name: dist
9797
path: dist
98-
if: matrix.python-version == 3.10
98+
if: matrix.python-version == 3.11
9999

100100
publish:
101101
runs-on: ubuntu-latest
@@ -105,17 +105,28 @@ jobs:
105105
- name: Download a distribution artifact
106106
uses: actions/download-artifact@v2
107107
with:
108-
name: dist-package-3.10
108+
name: dist
109109
path: dist
110-
- name: Publish distribution 📦 to Test PyPI
111-
uses: pypa/gh-action-pypi-publish@master
110+
111+
- name: Use Python 3.11
112+
uses: actions/setup-python@v1
112113
with:
113-
skip_existing: true
114-
user: __token__
115-
password: ${{ secrets.test_pypi_password }}
116-
repository_url: https://test.pypi.org/legacy/
114+
python-version: '3.11'
115+
116+
- name: Install dependencies
117+
run: |
118+
pip install twine
119+
120+
- name: Publish distribution 📦 to Test PyPI
121+
run: |
122+
twine upload -r testpypi dist/*
123+
env:
124+
TWINE_USERNAME: __token__
125+
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
126+
117127
- name: Publish distribution 📦 to PyPI
118-
uses: pypa/gh-action-pypi-publish@master
119-
with:
120-
user: __token__
121-
password: ${{ secrets.pypi_password }}
128+
run: |
129+
twine upload -r pypi dist/*
130+
env:
131+
TWINE_USERNAME: __token__
132+
TWINE_PASSWORD: ${{ secrets.pypi_password }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ htmlcov
55
__pycache__
66
*.egg-info
77
*.tar.gz
8+
_test_files/
9+
dist/

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.0.7] - 2023-05-01 :toolbox:
9+
- Fixes [Markdown missing a newline after simple response types](https://github.com/Neoteroi/essentials-openapi/issues/27).
10+
- Fixes [Empty header when operations don't have any tag.](https://github.com/Neoteroi/essentials-openapi/issues/28).
11+
- When operations don't have any tag, the `h2` element
12+
- Improves tests.
13+
- Adopts `pyproject.toml`.
14+
- Workflow maintenance.
15+
816
## [1.0.6] - 2023-03-19 :snail:
917
- Fixes a bug happening when trying to serialize examples in JSON, when they
1018
contain datetimes and are provided in YAML;

Makefile

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,23 @@ test-debug:
66

77

88
artifacts: test
9-
python setup.py sdist
9+
python -m build
1010

1111

1212
prepforbuild:
13-
pip install --upgrade twine setuptools wheel
13+
pip install build
1414

1515

16-
testrelease:
17-
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
16+
build:
17+
python -m build
1818

1919

20-
release: artifacts
21-
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
20+
test-release:
21+
twine upload --repository testpypi dist/*
22+
23+
24+
release:
25+
twine upload --repository pypi dist/*
2226

2327

2428
test:
@@ -41,8 +45,25 @@ test-cov:
4145
pytest --cov-report html --cov=openapidocs
4246

4347

48+
lint: check-flake8 check-isort check-black
49+
50+
51+
check-flake8:
52+
@echo "$(BOLD)Checking flake8$(RESET)"
53+
@flake8 . 2>&1
54+
55+
56+
check-isort:
57+
@echo "$(BOLD)Checking isort$(RESET)"
58+
@isort --check-only . 2>&1
59+
60+
61+
check-black:
62+
@echo "$(BOLD)Checking black$(RESET)"
63+
@black --check . 2>&1
64+
65+
4466
format:
45-
isort openapidocs
46-
isort tests
47-
black openapidocs
48-
black tests
67+
@echo "$(BOLD)Formatting code 🧹 🧼$(RESET)"
68+
@black . 2>&1
69+
@isort . 2>&1

openapidocs/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
VERSION = "1.0.6"
1+
__version__ = "1.0.7"
2+
VERSION = __version__

openapidocs/mk/v3/views_markdown/partial/path-items.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{% for tag, operations in handler.get_operations().items() %}
22

3-
## {{tag}}
3+
## {{tag or "Endpoints"}}
44

55
{% for path, definition in operations %}
6-
{%- for http_method, operation in definition.items() -%}
6+
{%- for http_method, operation in definition.items() %}
77

88
### {{http_method.upper()}} {{path | safe}}
99
{% if "summary" in operation -%}

openapidocs/mk/v3/views_mkdocs/partial/path-items.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{% for tag, operations in handler.get_operations().items() %}
2-
## <span class="api-tag">{{tag}}</span>
2+
## <span class="api-tag">{{tag or "Endpoints"}}</span>
33

44
{% for path, definition in operations %}
5-
{%- for http_method, operation in definition.items() -%}
5+
{%- for http_method, operation in definition.items() %}
66
<hr class="operation-separator" />
77

88
### <span class="http-{{http_method.lower()}}">{{http_method.upper()}}</span> {{path | route | safe}}

pyproject.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "essentials-openapi"
7+
dynamic = ["version"]
8+
authors = [{ name = "Roberto Prevato", email = "[email protected]" }]
9+
description = "Classes to generate OpenAPI Documentation v3 and v2, in JSON and YAML."
10+
readme = "README.md"
11+
requires-python = ">=3.7"
12+
classifiers = [
13+
"Development Status :: 5 - Production/Stable",
14+
"License :: OSI Approved :: MIT License",
15+
"Programming Language :: Python :: 3",
16+
"Programming Language :: Python :: 3.8",
17+
"Programming Language :: Python :: 3.9",
18+
"Programming Language :: Python :: 3.10",
19+
"Programming Language :: Python :: 3.11",
20+
"Operating System :: OS Independent",
21+
]
22+
keywords = ["openapi", "docs", "swagger", "api", "documentation", "v3", "v2", "json", "yaml", "Markdown"]
23+
24+
dependencies = ["PyYAML>=6", "essentials>=1.1.5"]
25+
26+
[tool.hatch.version]
27+
path = "openapidocs/__init__.py"
28+
29+
[project.optional-dependencies]
30+
full = ["click~=8.1.3", "Jinja2~=3.1.2", "MarkupSafe==2.1.2", "rich~=12.6.0", "httpx<1"]
31+
32+
[project.scripts]
33+
openapidocs = "openapidocs.main:main"
34+
oad = "openapidocs.main:main"
35+
36+
[tool.hatch.build.targets.wheel]
37+
packages = ["openapidocs"]
38+
39+
[tool.hatch.build.targets.sdist]
40+
exclude = ["tests"]
41+
42+
[tool.hatch.build]
43+
only-packages = true
44+
45+
[project.urls]
46+
"Homepage" = "https://github.com/Neoteroi/essentials-openapi"
47+
"Bug Tracker" = "https://github.com/Neoteroi/essentials-openapi/issues"

requirements.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
anyio==3.6.2
22
attrs==22.1.0
33
black==22.10.0
4+
build==0.10.0
45
certifi==2022.9.24
56
charset-normalizer==3.0.0
67
click==8.1.3
@@ -11,14 +12,16 @@ flake8==5.0.4
1112
Flask==2.2.2
1213
h11==0.12.0
1314
httpcore==0.15.0
14-
httpx==0.23.0
15+
httpx==0.24.0
1516
idna==3.4
1617
iniconfig==1.1.1
1718
isort==5.10.1
1819
itsdangerous==2.1.2
1920
Jinja2==3.1.2
20-
MarkupSafe==2.1.1
21+
markdown-it-py==2.2.0
22+
MarkupSafe==2.1.2
2123
mccabe==0.7.0
24+
mdurl==0.1.2
2225
mypy-extensions==0.4.3
2326
packaging==21.3
2427
pathspec==0.10.1
@@ -30,12 +33,13 @@ pydantic==1.10.2
3033
pyflakes==2.5.0
3134
Pygments==2.13.0
3235
pyparsing==3.0.9
36+
pyproject_hooks==1.0.0
3337
pytest==7.2.0
3438
pytest-cov==4.0.0
3539
PyYAML==6.0
3640
regex==2022.10.31
3741
rfc3986==1.5.0
38-
rich==12.6.0
42+
rich==13.3.5
3943
sniffio==1.3.0
4044
toml==0.10.2
4145
tomli==2.0.1

0 commit comments

Comments
 (0)