Skip to content

Commit

Permalink
chore: enable 3.13 test, deprecate 3.8 (#389)
Browse files Browse the repository at this point in the history
* chore: enable 3.13 test, deprecate 3.8

Signed-off-by: Keming <kemingy94@gmail.com>

* fix tests in py3.13

Signed-off-by: Keming <kemingy94@gmail.com>

* fix test

Signed-off-by: Keming <kemingy94@gmail.com>

---------

Signed-off-by: Keming <kemingy94@gmail.com>
  • Loading branch information
kemingy authored Nov 25, 2024
1 parent 493b560 commit 0cab826
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 68 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pythondoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ name: Python document

on:
push:
branches: [ master ]
paths:
branches:
- master
- main
paths:
- 'spectree/**'
- 'docs/**'
- '.github/workflows/pythondoc.yml'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
- master
- dev
- main
merge_group:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
strategy:
max-parallel: 7
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.9"]
os: [ubuntu-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ repository = "https://github.com/0b01001001/spectree"
changelog = "https://github.com/0b01001001/spectree/releases"

[tool.ruff]
target-version = "py38"
target-version = "py39"
line-length = 88
[tool.ruff.lint]
select = ["E", "F", "B", "G", "I", "SIM", "TID", "PL", "RUF"]
Expand Down
17 changes: 11 additions & 6 deletions spectree/response.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from http import HTTPStatus
from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, Union

Expand All @@ -11,12 +12,16 @@
DEFAULT_CODE_DESC: Dict[str, str] = dict(
(f"HTTP_{status.value}", f"{status.phrase}") for status in HTTPStatus
)
# additional status codes
for code, phrase in [
("HTTP_418", "I'm a teapot"),
("HTTP_425", "Too Early"),
]:
DEFAULT_CODE_DESC[code] = phrase
# additional status codes and fixes
if sys.version_info < (3, 13):
# https://docs.python.org/3/library/http.html
# https://datatracker.ietf.org/doc/html/rfc9110.html
for code, phrase in [
("HTTP_418", "I'm a teapot"),
("HTTP_425", "Too Early"),
]:
DEFAULT_CODE_DESC[code] = phrase
DEFAULT_CODE_DESC["HTTP_422"] = "Unprocessable Content"


class Response:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_get <GET>",
Expand Down Expand Up @@ -220,7 +220,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_post <POST>",
Expand Down Expand Up @@ -282,7 +282,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_get <GET>",
Expand Down Expand Up @@ -330,7 +330,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_get <GET>",
Expand Down Expand Up @@ -361,7 +361,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_get <GET>",
Expand Down Expand Up @@ -392,7 +392,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_get <GET>",
Expand Down Expand Up @@ -433,7 +433,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_get <GET>",
Expand Down Expand Up @@ -503,7 +503,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_post <POST>",
Expand Down Expand Up @@ -585,7 +585,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_get <GET>",
Expand Down Expand Up @@ -655,7 +655,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_post <POST>",
Expand Down Expand Up @@ -699,7 +699,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_get <GET>",
Expand Down Expand Up @@ -769,7 +769,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_post <POST>",
Expand Down Expand Up @@ -813,7 +813,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_get <GET>",
Expand Down Expand Up @@ -883,7 +883,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "on_post <POST>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "return_list <GET>",
Expand Down Expand Up @@ -384,7 +384,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "return_make_response_get <GET>",
Expand Down Expand Up @@ -432,7 +432,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "return_make_response_post <POST>",
Expand Down Expand Up @@ -463,7 +463,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "return_optional_alias_resp <GET>",
Expand Down Expand Up @@ -494,7 +494,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "return_root <GET>",
Expand Down Expand Up @@ -571,7 +571,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "user_score <POST>",
Expand Down Expand Up @@ -689,7 +689,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "user_score_annotated <POST>",
Expand Down Expand Up @@ -764,7 +764,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "user_score_model <POST>",
Expand Down Expand Up @@ -839,7 +839,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "user_score_skip_validation <POST>",
Expand Down Expand Up @@ -883,7 +883,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "summary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "return_list <GET>",
Expand Down Expand Up @@ -384,7 +384,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "return_make_response_get <GET>",
Expand Down Expand Up @@ -432,7 +432,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "return_make_response_post <POST>",
Expand Down Expand Up @@ -463,7 +463,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "return_optional_alias <GET>",
Expand Down Expand Up @@ -494,7 +494,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "return_root <GET>",
Expand Down Expand Up @@ -571,7 +571,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "user_score <POST>",
Expand Down Expand Up @@ -689,7 +689,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "user_score_annotated <POST>",
Expand Down Expand Up @@ -764,7 +764,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "user_score_model <POST>",
Expand Down Expand Up @@ -839,7 +839,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "user_score_skip_validation <POST>",
Expand Down Expand Up @@ -883,7 +883,7 @@
}
}
},
"description": "Unprocessable Entity"
"description": "Unprocessable Content"
}
},
"summary": "summary",
Expand Down
Loading

0 comments on commit 0cab826

Please sign in to comment.