8000 Type Annotations by sakosha · Pull Request #188 · aio-libs/aioftp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Type Annotations #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
0ef1cc4
added type annotations
sakosha May 21, 2025
743be6c
added typing-extensions as a dependency
sakosha May 22, 2025
cbb43a8
formatting
sakosha May 22, 2025
b8b4c59
stringify circular references
sakosha May 22, 2025
6b45e0b
stringify circular references
sako 8000 sha May 22, 2025
b86bc9c
stringify circular references
sakosha May 22, 2025
03e92d8
mypy ci & pre-commit
sakosha May 22, 2025
0078e7e
more general type: ignore for siosocks
sakosha May 22, 2025
3d0fa27
added py.typed marker
sakosha May 22, 2025
6f064f2
remove deprecated packages from [tool.mypy]
sakosha Jun 1, 2025
94024ef
adjust type ignore for 3.12+
sakosha Jun 1, 2025
9cd8b80
ci w/ explicit-package-bases
sakosha Jun 1, 2025
a5e8a11
ci w/ explicit PYTHONPATH tweaking
sakosha Jun 1, 2025
749136c
ci w/ explicit PYTHONPATH tweaking
sakosha Jun 1, 2025
cff444b
Merge remote-tracking branch 'origin/master'
sakosha Jun 1, 2025
f4ca5ef
ci w/ checking the sources
sakosha Jun 1, 2025
b802767
add explicit annotations for Lister.iter class var
sakosha Jun 1, 2025
0864852
added ignore_missing_imports = true
Jun 2, 2025
7eeafeb
removed pathlib namespace
Jun 2, 2025
2af1dee
removed 3.12+ check from get_stream
Jun 2, 2025
6df0f5f
removed datetime module namespace
Jun 2, 2025
94f5d3f
specify src dir for mypy
Jun 2, 2025
8f5ceee
do not specify files for mypy in CI
Jun 2, 2025
ed631c5
remove uv.lock
Jun 2, 2025
d443be1
use property to unify `if stream is None` check
Jun 2, 2025
f55095b
remove explicit file paths from pre-commit mypy
Jun 2, 2025
7bef304
make parse_line methods accept bytes only
Jun 2, 2025
768e1d4
make parse_line methods accept bytes only
Jun 2, 2025
c597018
close shall use _stream value directly
Jun 2, 2025
a73de68
use <<: *python-linters instead of pass_filenames
Jun 3, 2025
48cfc17
move Code into common.py to use `wrap_into_codes`
Jun 9, 2025
7516dc3
use 2nd approach from https://github.com/aio-libs/aioftp/pull/188/fil…
Jun 9, 2025
ae05da0
use warn_unreachable option for mypy
Jun 9, 2025
a8ae0eb
Merge branch 'master' into master
sakosha Jun 11, 2025
12c6336
address https://github.com/aio-libs/aioftp/pull/188/files#r2119625268
sakosha Jun 11, 2025
6635393
remove version check
sakosha Jun 12, 2025
8c138f7
make AbstractPathIO generic over Path type
sakosha Jun 12, 2025
f0c9b82
remove easy `server.py` type: ignores
sakosha Jun 12, 2025
3c28d4f
use Node instead of NodeProtocol
sakosha Jun 12, 2025
f877596
adjust _blocking_io for `AsyncPathIO.list` method
sakosha Jun 12, 2025
ec53fb9
make AbstractPathIO & it's subclasses methods mostly the same
sakosha Jun 12, 2025
8faa523
make Node is_dir/is_file checks explicit for type narrowing
sakosha Jun 12, 2025
8f320f2
convert from pathlib import ...
sakosha Jun 12, 2025
e71bc28
partially revert AsyncPathIO __anext__ method
sakosha Jun 13, 2025
52cf765
move type-checking hook to the end
sakosha Jun 13, 2025
dcccc55
Merge remote-tracking branch 'upstream/master'
sakosha Jun 15, 2025
8fffd8e
added TODO: remove typing-extensions dependency.
sakosha Jun 15, 2025
e711c35
remove redundant type-check ci stage.
sakosha Jun 15, 2025
496c1fd
use local mypy for pre-commit
sakosha Jun 15, 2025
f9a616b
Address code review
sakosha Jun 15, 2025
1cda798
add docstring for AsyncListerMixin.__aiter__
sakosha Jun 15, 2025
947f992
use _stream in _open_connection, remove type ignores
sakosha Jun 15, 2025
59cb487
remove Connection quotes
sakosha Jun 15, 2025
ff8e598
install `typing-extensions` only for `python-version<3.11`
Jun 16, 2025
64cffb4
install `typing-extensions` only for `python-version<3.11`
Jun 16, 2025
7638b07
Merge remote-tracking branch 'origin/master'
Jun 16, 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
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ repos:
name: Check with ruff
entry: ruff
args: ["check", "--fix", "."]

- <<: *python-linters
id: mypy
name: Type check with mypy
entry: mypy
args: ["--config-file", "pyproject.toml"]
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ classifiers = [
"Topic :: Internet :: File Transfer Protocol (FTP)",
]

# TODO: remove `typing-extensions` when requires-python = ">= 3.11"
dependencies = [
"typing-extensions>=4.13.2; python_version < '3.11'", # 3.9-10 typing support
]

[project.urls]
Github = "https://github.com/aio-libs/aioftp"
Documentation = "https://aioftp.rtfd.io"
Expand All @@ -62,6 +67,7 @@ dev = [
# linters
"pre-commit",
"ruff",
"mypy",
]

[build-system]
Expand All @@ -70,6 +76,7 @@ build-backend = "setuptools.build_meta"

[tool.setuptools]
packages.find.where = ["src"]
package-data.aioftp = ["py.typed"]

# tools
[tool.ruff]
Expand All @@ -80,6 +87,13 @@ src = ["src"]
exclude = ["ftpbench.py"]


[tool.mypy]
files = "src/aioftp"
pretty = true
strict = true
ignore_missing_imports = true
warn_unreachable = true

[tool.coverage]
run.source = ["./src/aioftp"]
run.omit = ["./src/aioftp/__main__.py"]
Expand Down
2 changes: 1 addition & 1 deletion src/aioftp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
version = tuple(map(int, __version__.split(".")))

__all__ = (
client.__all__ + server.__all__ + errors.__all__ + common.__all__ + pathio.__all__ + ("version", "__version__")
client.__all__ + server.__all__ + errors.__all__ + common.__all__ + pathio.__all__ + ("version", "__version__") # type: ignore[name-defined]
)
5 changes: 3 additions & 2 deletions src/aioftp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import contextlib
import logging
import socket
from typing import Any

import aioftp

Expand Down Expand Up @@ -67,7 +68,7 @@
)
if args.memory:
user = aioftp.User(args.login, args.password, base_path="/")
path_io_factory = aioftp.MemoryPathIO
path_io_factory: type[aioftp.AbstractPathIO[Any]] = aioftp.MemoryPathIO
else:
if args.home:
user = aioftp.User(args.login, args.password, base_path=args.home)
Expand All @@ -81,7 +82,7 @@
}[args.family]


async def main():
async def main() -> None:
server = aioftp.Server([user], path_io_factory=path_io_factory)
await server.run(args.host, args.port, family=family)

Expand Down
Loading
0