Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
e5171a0
[gunicorn] Initial commit: create_baseline_stubs
eugeneliukindev Sep 7, 2025
abab2e7
[gunicorn] Add metadata
eugeneliukindev Sep 7, 2025
7ec2ee6
[gunicorn] Create _types.pyi file
eugeneliukindev Sep 7, 2025
93780f5
[gunicorn] Update stubs for util.pyi
eugeneliukindev Sep 7, 2025
d863249
[gunicorn] Update stubs for systemd.pyi
eugeneliukindev Sep 7, 2025
cf928b2
[gunicorn] Update stubs for sock.pyi
eugeneliukindev Sep 7, 2025
41a6c47
[gunicorn] Update stubs for reloader.pyi
eugeneliukindev Sep 7, 2025
1d917a5
[gunicorn] Update stubs for pidfile.pyi
eugeneliukindev Sep 7, 2025
4a0e58a
[gunicorn] Update stubs for glogging.pyi
eugeneliukindev Sep 7, 2025
ba4e46d
[gunicorn] Update stubs for errors.pyi
eugeneliukindev Sep 7, 2025
5e538fb
[gunicorn] Update stubs for debug.pyi
eugeneliukindev Sep 7, 2025
ad1bfe2
[gunicorn] Add type alias for parse_address function in util.pyi
eugeneliukindev Sep 7, 2025
7224967
[gunicorn] Add type construct (py3.12) instead TypeAlias
eugeneliukindev Sep 7, 2025
a4d6294
[gunicorn] Update stubs for config.pyi
eugeneliukindev Sep 8, 2025
af6f58a
[gunicorn] Fix load_class function type annotation
eugeneliukindev Sep 9, 2025
2117471
[gunicorn] Fix logger_class property return type annotation
eugeneliukindev Sep 9, 2025
e1138bd
[gunicorn] Fix worker_class property return type annotation
eugeneliukindev Sep 9, 2025
b3f5b4f
[gunicorn] Update stubs for arbiter.pyi
eugeneliukindev Sep 9, 2025
f97a5f6
[gunicorn] Update stubs for __init__.pyi
eugeneliukindev Sep 9, 2025
bfabbcb
[gunicorn] Update stubs for workers/workertmp.pyi
eugeneliukindev Sep 9, 2025
b25a69a
[gunicorn] Fix ssl_context function return type annotation
eugeneliukindev Sep 9, 2025
f23abec
[gunicorn] Update stubs for workers/sync.pyi
eugeneliukindev Sep 9, 2025
fc17f3f
[gunicorn] Move _AddressType to file ._types.pyi
eugeneliukindev Sep 9, 2025
9550632
[gunicorn] Update stubs for workers/gtornado.pyi
eugeneliukindev Sep 9, 2025
f444d1a
[gunicorn] Add override decorator
eugeneliukindev Sep 9, 2025
9168bfa
[gunicorn] Add types-tornado in METADATA.toml requires
eugeneliukindev Sep 9, 2025
43b02f0
[gunicorn] Update stubs for workers/gthread.pyi
eugeneliukindev Sep 9, 2025
e29de4a
[gunicorn] Update stubs for workers/ggevent.pyi
eugeneliukindev Sep 9, 2025
401499a
[gunicorn] Update stubs for workers/geventlet.pyi
eugeneliukindev Sep 9, 2025
c513eb5
[gunicorn] Update stubs for workers/base_async.pyi
eugeneliukindev Sep 9, 2025
268be54
[gunicorn] Delete EventMask type from reloader.pyi
eugeneliukindev Sep 9, 2025
4ce39a0
[gunicorn] Add prefix '_' to types in reloader.pyi
eugeneliukindev Sep 9, 2025
23d0ded
[gunicorn] Add type: ignore for inotify library in reloader.pyi
eugeneliukindev Sep 9, 2025
24d5028
[gunicorn] Update stubs for workers/base.pyi
eugeneliukindev Sep 9, 2025
32dc3eb
[gunicorn] Fix logger annotations
eugeneliukindev Sep 9, 2025
2d75465
[gunicorn] Update stubs for workers/__init__.pyi
eugeneliukindev Sep 9, 2025
e529ff9
[gunicorn] Fix handle_request return type annotation
eugeneliukindev Sep 9, 2025
5fe6ade
[gunicorn] Fix _LogLevelType type in glogging.pyi
eugeneliukindev Sep 9, 2025
d1efd54
[gunicorn] Update stubs for instrument/statsd.pyi
eugeneliukindev Sep 9, 2025
b133c64
[gunicorn] Add documentation for _EnvironType in _types.pyi
eugeneliukindev Sep 9, 2025
6a2ac3c
[gunicorn] Update stubs for http/wsgi.pyi
eugeneliukindev Sep 9, 2025
afd9783
[gunicorn] Refactor: migrate from typing.Type to builtin type annotat…
eugeneliukindev Sep 9, 2025
157a62c
[gunicorn] Update stubs for http/unreader.pyi
eugeneliukindev Sep 9, 2025
800d710
[gunicorn] Update stubs for http/parser.pyi
eugeneliukindev Sep 9, 2025
a50e7b7
[gunicorn] Update stubs for http/message.pyi
eugeneliukindev Sep 9, 2025
63b2fd0
[gunicorn] Update stubs for http/errors.pyi
eugeneliukindev Sep 9, 2025
1c85564
[gunicorn] Update stubs for http/body.pyi
eugeneliukindev Sep 9, 2025
d3cb245
[gunicorn] Add _ASGIAppType in _types.pyi
eugeneliukindev Sep 9, 2025
5c323bd
[gunicorn] Update stubs for app/base.pyi
eugeneliukindev Sep 9, 2025
a10038b
[gunicorn] Update stubs for app/pasterapp.pyi
eugeneliukindev Sep 9, 2025
1f73313
[gunicorn] Update stubs for app/wsgiapp.pyi
eugeneliukindev Sep 9, 2025
0aa6efd
[gunicorn] Add stubtest_allowlist.txt
eugeneliukindev Sep 9, 2025
d723565
[gunicorn] Add return type annotation for is_already_handled function
eugeneliukindev Sep 9, 2025
aff785b
[gunicorn] Add 'args', 'kwargs' type annotation for __init__ function
eugeneliukindev Sep 9, 2025
a74424e
[gunicorn] run script 'pre-commit run --all-files'
eugeneliukindev Sep 9, 2025
35e4307
[gunicorn] Fix: flake8, ruff, black rules
eugeneliukindev Sep 9, 2025
d98998b
[gunicorn] Fix: mypy errors
eugeneliukindev Sep 10, 2025
cb7f7f4
[gunicorn] Fix: pyright errors
eugeneliukindev Sep 10, 2025
23a6754
[gunicorn] Use _DictConfigArgs annotation instead custom TypedDict
eugeneliukindev Sep 10, 2025
ad13dea
[gunicorn] Supress mypy imports
eugeneliukindev Sep 10, 2025
9d38f82
[gunicorn] Supress pyright, mypy imports
eugeneliukindev Sep 10, 2025
2678a62
[gunicorn] Add ClassVar annotations
eugeneliukindev Sep 10, 2025
0aa8e18
[gunicorn] Add supported_platforms and ci_platforms in METADATA.toml
eugeneliukindev Sep 10, 2025
616d381
[gunicorn] Add [tool.stubtest]
eugeneliukindev Sep 10, 2025
1e72ba7
[gunicorn] Fix: InotifyReloader.get_dirs return annotation
eugeneliukindev Sep 10, 2025
e68b65a
Merge branch 'main' into main
eugeneliukindev Sep 10, 2025
99b2e89
[gunicorn] Add stub for UnixSocket
eugeneliukindev Sep 10, 2025
1a91edf
[gunicorn] Suppress eventlet imports
eugeneliukindev Sep 10, 2025
21716db
Merge remote-tracking branch 'origin/main'
eugeneliukindev Sep 10, 2025
366f6fd
[gunicorn] Suppress tornado imports
eugeneliukindev Sep 10, 2025
71121bc
[gunicorn] Add stubtest_allowlist_darwin.txt
eugeneliukindev Sep 10, 2025
eb159a7
[gunicorn] Delete types-tornado from requires
eugeneliukindev Sep 10, 2025
0fb0617
[gunicorn] Remove suppress import error
eugeneliukindev Sep 11, 2025
0445324
[gunicorn] Add stubtest_requirements versions
eugeneliukindev Sep 11, 2025
fa28ecf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 11, 2025
0b1574d
Merge branch 'main' into main
eugeneliukindev Sep 12, 2025
6aac2eb
[gunicorn] Add description for stubtest allowlist (InotifyReloader me…
eugeneliukindev Sep 19, 2025
864a9c6
[gunicorn] Add different stubs for different OS for InotifyReloader
eugeneliukindev Sep 19, 2025
568a9b7
[gunicorn] Add description about helper _types.pyi file
eugeneliukindev Sep 19, 2025
86b3615
[gunicorn] Add link to pep instead of duplicating documentation
eugeneliukindev Sep 19, 2025
85b153a
[gunicorn] Use collection.abc interface instead of its specific imple…
eugeneliukindev Sep 19, 2025
7f4167c
[gunicorn] Change returning from `None` to `object`
eugeneliukindev Sep 19, 2025
c0294c8
[gunicorn] Fix parse_chunked func return type
eugeneliukindev Sep 19, 2025
e99ae0d
[gunicorn] Add function signature mapping to logging.Logger
eugeneliukindev Sep 19, 2025
8564c9f
[gunicorn] Add stubs for respiter arg
eugeneliukindev Sep 19, 2025
f3d740e
[gunicorn] Delete __init__ method from ThreadWorker
eugeneliukindev Sep 19, 2025
f0a7685
[gunicorn] Add _ConfigValueType
eugeneliukindev Sep 19, 2025
d3cc1e2
[gunicorn] Add _AnyValidatorType
eugeneliukindev Sep 19, 2025
d497e64
[gunicorn] Fix Setting.type stub
eugeneliukindev Sep 19, 2025
c917fa4
[gunicorn] Delete Any annotations from validators
eugeneliukindev Sep 19, 2025
07a1f3c
[gunicorn] Add comment for `Any` annotation
eugeneliukindev Sep 19, 2025
60c219f
[gunicorn] Fix validate_callable annotation
eugeneliukindev Sep 19, 2025
448c4bb
[gunicorn] Fix load_entry_point `Any` return annotation
eugeneliukindev Sep 19, 2025
343f4f4
[gunicorn] Fix validate_post_request annotation
eugeneliukindev Sep 19, 2025
3243431
[gunicorn] Add `_CallableValidatorType` type
eugeneliukindev Sep 19, 2025
1d41e83
[gunicorn] Change Setting.validator to common stub with comment
eugeneliukindev Sep 19, 2025
a365ecc
[gunicorn] Add @overload decorators to validate_bool, validate_string…
eugeneliukindev Sep 19, 2025
b0735d1
[gunicorn] run `pre-commit run --all-files`
eugeneliukindev Sep 19, 2025
588640a
[gunicorn] Remove extra argument
eugeneliukindev Sep 19, 2025
e134479
[gunicorn] delete allowlist darwin
eugeneliukindev Sep 19, 2025
abd30fb
[gunicorn] add comment about gunicorn.__main__
eugeneliukindev Sep 19, 2025
79b3948
[gunicorn] Fix 'get_arity' func 'f' annotation
eugeneliukindev Sep 20, 2025
d7aeca8
[gunicorn] Fix 'SettingMeta' method '__new__' return type
eugeneliukindev Sep 20, 2025
aea18a2
[gunicorn] Fix '__version__' type
eugeneliukindev Sep 20, 2025
003db6a
[gunicorn] Delete stubtest_allowlist_darwin.txt
eugeneliukindev Sep 20, 2025
8cfa2ac
Merge branch 'main' into main
eugeneliukindev Sep 20, 2025
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
1 change: 1 addition & 0 deletions pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"stubs/grpcio-reflection/grpc_reflection/v1alpha",
"stubs/grpcio-status/grpc_status",
"stubs/grpcio/grpc/__init__.pyi",
"stubs/gunicorn",
"stubs/hdbcli/hdbcli/dbapi.pyi",
"stubs/html5lib",
"stubs/httplib2",
Expand Down
5 changes: 5 additions & 0 deletions stubs/gunicorn/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Is not present in runtime. For more details, see the file itself.
gunicorn._types

# .pyi file doesn't exist
gunicorn.__main__
8 changes: 8 additions & 0 deletions stubs/gunicorn/METADATA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = "23.0.*"
upstream_repository = "https://github.com/benoitc/gunicorn"
requires = ["types-gevent"]

[tool.stubtest]
supported_platforms = ["linux", "darwin"]
ci_platforms = ["linux", "darwin"]
stubtest_requirements = ["gevent>=1.4.0", "eventlet>=0.24.1,!=0.36.0", "tornado>=0.2", "setproctitle", "PasteDeploy", "inotify"]
4 changes: 4 additions & 0 deletions stubs/gunicorn/gunicorn/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version_info: tuple[int, int, int]
__version__: str
SERVER: str
SERVER_SOFTWARE: str
23 changes: 23 additions & 0 deletions stubs/gunicorn/gunicorn/_types.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### This .pyi file is a helper for centralized storage types that are reused across different runtime modules. ###
from _typeshed import FileDescriptor
from collections.abc import Awaitable, Callable, Iterable, MutableMapping
from typing import Any
from typing_extensions import LiteralString, TypeAlias

_StatusType: TypeAlias = str
_HeadersType: TypeAlias = Iterable[tuple[str, str]]

_EnvironType: TypeAlias = MutableMapping[str, Any] # See https://peps.python.org/pep-0333/
_StartResponseType: TypeAlias = Callable[[_StatusType, _HeadersType], None]
_ResponseBodyType: TypeAlias = Iterable[bytes]
_WSGIAppType: TypeAlias = Callable[[_EnvironType, _StartResponseType], _ResponseBodyType] # noqa: Y047

_ScopeType: TypeAlias = MutableMapping[str, Any]
_MessageType: TypeAlias = MutableMapping[str, Any]
_ReceiveType: TypeAlias = Callable[[], Awaitable[_MessageType]]
_SendType: TypeAlias = Callable[[_MessageType], Awaitable[None]]
_ASGIAppType: TypeAlias = Callable[[_ScopeType, _ReceiveType, _SendType], Awaitable[None]] # noqa: Y047

_UnixSocketPathType: TypeAlias = str
_TcpAddressType: TypeAlias = tuple[LiteralString, int] # noqa: Y047
_AddressType: TypeAlias = _UnixSocketPathType | FileDescriptor | _TcpAddressType # noqa: Y047
Empty file.
36 changes: 36 additions & 0 deletions stubs/gunicorn/gunicorn/app/base.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from argparse import ArgumentParser, Namespace
from typing import Any
from typing_extensions import override

from gunicorn.config import Config
from gunicorn.glogging import Logger as GLogger

from .._types import _ASGIAppType, _WSGIAppType

class BaseApplication:
usage: str | None
cfg: Config
callable: _WSGIAppType | _ASGIAppType | None
prog: str | None
logger: GLogger

def __init__(self, usage: str | None = None, prog: str | None = None) -> None: ...
def do_load_config(self) -> None: ...
def load_default_config(self) -> None: ...
def init(self, parser: ArgumentParser, opts: Namespace, args: list[str]) -> dict[str, Any] | None: ...
def load(self) -> _WSGIAppType | _ASGIAppType: ...
def load_config(self) -> None: ...
def reload(self) -> None: ...
def wsgi(self) -> _WSGIAppType | _ASGIAppType: ...
def run(self) -> None: ...

class Application(BaseApplication):
def chdir(self) -> None: ...
def get_config_from_filename(self, filename: str) -> dict[str, Any]: ...
def get_config_from_module_name(self, module_name: str) -> dict[str, Any]: ...
def load_config_from_module_name_or_filename(self, location: str) -> dict[str, Any]: ...
def load_config_from_file(self, filename: str) -> dict[str, Any]: ...
@override
def load_config(self) -> None: ...
@override
def run(self) -> None: ...
7 changes: 7 additions & 0 deletions stubs/gunicorn/gunicorn/app/pasterapp.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from typing import Any

from .._types import _WSGIAppType

def get_wsgi_app(config_uri: str, name: str | None = None, defaults: dict[str, Any] | None = None) -> _WSGIAppType: ...
def has_logging_config(config_file: str) -> bool: ...
def serve(app: _WSGIAppType, global_conf: dict[str, Any], **local_conf: Any) -> None: ...
20 changes: 20 additions & 0 deletions stubs/gunicorn/gunicorn/app/wsgiapp.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from argparse import ArgumentParser, Namespace
from typing_extensions import override

from gunicorn.app.base import Application

from .._types import _WSGIAppType

class WSGIApplication(Application):
app_uri: str | None

@override
def init(self, parser: ArgumentParser, opts: Namespace, args: list[str]) -> None: ...
@override
def load_config(self) -> None: ...
def load_wsgiapp(self) -> _WSGIAppType: ...
def load_pasteapp(self) -> _WSGIAppType: ...
@override
def load(self) -> _WSGIAppType: ...

def run(prog: str | None = None) -> None: ...
68 changes: 68 additions & 0 deletions stubs/gunicorn/gunicorn/arbiter.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import socket
from types import FrameType
from typing import ClassVar

from gunicorn.app.base import BaseApplication
from gunicorn.config import Config
from gunicorn.glogging import Logger as GLogger
from gunicorn.workers.base import Worker

from ._types import _AddressType
from .pidfile import Pidfile

class Arbiter:
WORKER_BOOT_ERROR: ClassVar[int]
APP_LOAD_ERROR: ClassVar[int]
START_CTX: ClassVar[dict[int | str, str | list[str]]]
LISTENERS: ClassVar[list[socket.socket]]
WORKERS: ClassVar[dict[int, Worker]]
PIPE: ClassVar[list[int]]
SIG_QUEUE: ClassVar[list[int]]
SIGNALS: ClassVar[list[int]]
SIG_NAMES: ClassVar[dict[int, str]]
log: GLogger | None
pidfile: Pidfile | None
systemd: bool
worker_age: int
reexec_pid: int
master_pid: int
master_name: str
pid: int
app: BaseApplication
cfg: Config
worker_class: type[Worker]
address: list[_AddressType]
timeout: int
proc_name: str
num_workers: int

def __init__(self, app: BaseApplication) -> None: ...
def setup(self, app: BaseApplication) -> None: ...
def start(self) -> None: ...
def init_signals(self) -> None: ...
def signal(self, sig: int, frame: FrameType | None) -> None: ...
def run(self) -> None: ...
def handle_chld(self, sig: int, frame: FrameType | None) -> None: ...
def handle_hup(self) -> None: ...
def handle_term(self) -> None: ...
def handle_int(self) -> None: ...
def handle_quit(self) -> None: ...
def handle_ttin(self) -> None: ...
def handle_ttou(self) -> None: ...
def handle_usr1(self) -> None: ...
def handle_usr2(self) -> None: ...
def handle_winch(self) -> None: ...
def maybe_promote_master(self) -> None: ...
def wakeup(self) -> None: ...
def halt(self, reason: str | None = None, exit_status: int = 0) -> None: ...
def sleep(self) -> None: ...
def stop(self, graceful: bool = True) -> None: ...
def reexec(self) -> None: ...
def reload(self) -> None: ...
def murder_workers(self) -> None: ...
def reap_workers(self) -> None: ...
def manage_workers(self) -> None: ...
def spawn_worker(self) -> int: ...
def spawn_workers(self) -> None: ...
def kill_workers(self, sig: int) -> None: ...
def kill_worker(self, pid: int, sig: int) -> None: ...
Loading
Loading