Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pre-commit:
commands:
ruff-check:
glob: "*.py"
stage_fixed: true
run: ruff check {staged_files} --fix --exit-non-zero-on-fix
ruff-fmt:
glob: "*.py"
stage_fixed: true
run: ruff format --exit-non-zero-on-format {staged_files}
56 changes: 56 additions & 0 deletions pyproject.old.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[tool.poetry]
name = "slowapi"
version = "0.1.9"
description = "A rate limiting extension for Starlette and Fastapi"
authors = ["Laurent Savaete <laurent@where.tf>"]
license = "MIT"

readme = "README.md"

repository = "https://github.com/laurents/slowapi"
homepage = "https://github.com/laurents/slowapi"
documentation = "https://slowapi.readthedocs.io/en/latest/"

include = ["slowapi/py.typed"]

[tool.poetry.dependencies]
python = ">=3.7,<4.0"
limits = ">=2.3"
redis = {version = "^3.4.1", optional = true}

[tool.poetry.dev-dependencies]
isort = "^4.3.21"
mypy = "^0.910"
black = "^23.0.0"
fastapi = "^0.89.0"
lxml = "^4.9.1"
starlette = "^0.22.0"
mock = "^4.0.1"
hiro = "^0.5.1"
requests = "^2.22.0"
pytest = "~=6.2.5"
mkdocs = "^1.2.3"
mkautodoc = "^0.1.0"
types-redis = "^3.5.6"
coverage = "^6.3"
flake8 = "^4.0.1"
setuptools = "^65.5.0"
httpx = "^0.23.3"

[tool.black]
line-length = 88

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 88

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.extras]
redis = ["redis"]
145 changes: 96 additions & 49 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,56 +1,103 @@
[tool.poetry]
[project]
name = "slowapi"
version = "0.1.9"
description = "A rate limiting extension for Starlette and Fastapi"
authors = ["Laurent Savaete <laurent@where.tf>"]
license = "MIT"

version = "0.2.0"
description = "A rate limiting extension for Starlette and FastAPI"
readme = "README.md"
authors = [
{ name = "Laurent Savaete", email = "laurent@where.tf"},
{ name = "Noelle Wang", email = "73260931+No767@users.noreply.github.com" }
]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add all the people who actually contributed, what do you think? Or just have something like "slowapi contributors" with a link to the github repo?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depending on if we have a list, then sure we can go for it

requires-python = ">=3.10,<4"
dependencies = [
"fastapi>=0.116.1,<1",
"limits>=5.5.0,<6",
]

[project.optional-dependencies]
redis = [
"redis[hiredis]>=6.3.0,<7",
]
valkey = [
"valkey[libvalkey]>=6.1.0,<7",
]

[dependency-groups]
dev = [
"ruff>=0.12.7,<1",
"pyright[nodejs]>=1.1.403,<2",
"lefthook>=1.12.2,<2",
{include-group = "docs"},
{include-group = "test"}
]

docs = [
"mkdocs>=1.6.1,<2",
"mkdocstrings[python]>=0.30.0,<1"
]
test = [
"pytest>=8.4.1,<9",
"pytest-asyncio>=1.1.0,<2",
"coverage>=7.10.2,<8",
"httpx>=0.28.1,<1",
"hiro>=1.1.1,<2"
]

[tool.pyright]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use pyright when writing code (I'm not a VScode user), but I'm a bit hesitant to use it in CI, because it brings in the entire node stack with it, so more risks of breakage every now and then.
This does not prevent keeping the config here for people using it though.

As a side note, I just discovered https://github.com/astral-sh/ty which looks promising!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the version of pyright that is being used directly uses nodejs-wheel-binaries, which does not require any installation of Nodejs. I've used this version with nodejs-wheel-binaries within my own workflows, and have not needed to install Nodejs or anything

include = ["slowapi", "tests"]
exclude = ["**/__pycache__", "docs",]
reportMissingImports = "error"
typeCheckingMode = "standard"
reportUnnecessaryTypeIgnoreComment = "warning"

repository = "https://github.com/laurents/slowapi"
homepage = "https://github.com/laurents/slowapi"
documentation = "https://slowapi.readthedocs.io/en/latest/"

include = ["slowapi/py.typed"]

[tool.poetry.dependencies]
python = ">=3.7,<4.0"
limits = ">=2.3"
redis = {version = "^3.4.1", optional = true}

[tool.poetry.dev-dependencies]
isort = "^4.3.21"
mypy = "^0.910"
black = "^23.0.0"
fastapi = "^0.89.0"
lxml = "^4.9.1"
starlette = "^0.22.0"
mock = "^4.0.1"
hiro = "^0.5.1"
requests = "^2.22.0"
pytest = "~=6.2.5"
mkdocs = "^1.2.3"
mkautodoc = "^0.1.0"
types-redis = "^3.5.6"
coverage = "^6.3"
flake8 = "^4.0.1"
setuptools = "^65.5.0"
httpx = "^0.23.3"

[tool.black]
[tool.ruff]
line-length = 88
extend-include = ["slowapi", "tests"]
extend-exclude = ["**/__pycache__", "docs"]

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 88
[tool.ruff.lint]
ignore = [
"E501",
"N999",
"E402",
"S311",
"ASYNC109",
"S101",

# These are recommended by Ruff if the formatter is to be used: https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
"E114",
"E117",
"D206",
"D300",
"Q000",
"Q001",
"Q002",
"Q003",
"COM812",
"COM819",
"ISC001",
"ISC002"
]
select = ["E", "F", "N", "ASYNC", "S", "ERA", "I"]
fixable = ["ALL"]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.ruff.lint.isort]
combine-as-imports = true
force-wrap-aliases = true

[tool.ruff.format]
docstring-code-format = true

[tool.pytest.ini_options]
minversion = "8.0"
addopts = "-ra"
testpaths = ["tests"]
asyncio_default_fixture_loop_scope = "function"

[tool.poetry.extras]
redis = ["redis"]
[tool.uv.build-backend]
module-root = ""

[build-system]
requires = ["uv_build>=0.8.5,<0.9.0"]
build-backend = "uv_build"
Loading
Loading