-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpyproject.toml
108 lines (87 loc) · 3 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
[tool.poetry]
authors = ["Drew Silcock <[email protected]>"]
description = "Text generation with DistilGPT2 as a REST API."
license = "MIT"
name = "distilgpt2-api"
version = "0.1.0"
[tool.poetry.dependencies]
fastapi = "^0.111.1"
gunicorn = "^22.0.0"
python = "~3.11"
transformers = "^4.43.2"
uvicorn = {extras = ["standard"], version = "^0.30.3"}
[[tool.poetry.dependencies.torch]]
markers = "sys_platform == 'linux'"
url = "https://download.pytorch.org/whl/cpu/torch-2.4.0%2Bcpu-cp311-cp311-linux_x86_64.whl"
[[tool.poetry.dependencies.torch]]
markers = "sys_platform == 'win32'"
url = "https://download.pytorch.org/whl/cpu/torch-2.4.0%2Bcpu-cp311-cp311-win_amd64.whl"
[[tool.poetry.dependencies.torch]]
markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'"
# Last pytorch version to support x86_64 on macOS is 2.2.2.
url = "https://download.pytorch.org/whl/cpu/torch-2.2.2-cp311-none-macosx_10_9_x86_64.whl"
[[tool.poetry.dependencies.torch]]
markers = "sys_platform == 'darwin' and platform_machine == 'arm64'"
url = "https://download.pytorch.org/whl/cpu/torch-2.4.0-cp311-none-macosx_11_0_arm64.whl"
[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
mypy = "^1.11.0"
pytest = "^8.3.2"
ruff = "^0.5.5"
poethepoet = "^0.27.0"
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0"]
[tool.ruff.lint]
ignore = ["E501"]
select = ["I", "E", "N"]
[tool.mypy]
python_version = "3.10"
exclude = ['\.venv']
warn_return_any = true
warn_unused_configs = true
# Pydantic required config, see
# https://docs.pydantic.dev/latest/integrations/mypy/#enabling-the-plugin
# I've relaxed these a bit to make it less annoying to the workshop attendees who have
# to fix them, which isn't the focus of the workshop.
check_untyped_defs = true
disallow_any_generics = false
disallow_untyped_defs = false
follow_imports = "silent"
no_implicit_reexport = true
plugins = ["pydantic.mypy"]
warn_redundant_casts = true
warn_unused_ignores = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
[tool.poe.tasks]
_black_check = "black --check src tests"
_mypy_check = "mypy src tests"
_ruff_check = "ruff check src tests"
_black_fix = "black src tests"
_ruff_fix = "ruff check --fix-only --exit-zero src tests"
_test = "pytest --verbose"
_test_with_output = "pytest --verbose --capture=no"
[tool.poe.tasks.api]
help = "Run the API"
cmd = "uvicorn distilgpt2_api.api:app --reload"
[tool.poe.tasks.lint]
help = "Run all linters"
sequence = ["_black_check", "_ruff_check", "_mypy_check"]
[tool.poe.tasks.format]
help = "Run all formatters"
sequence = ["_ruff_fix", "_black_fix"]
[tool.poe.tasks.test]
help = "Run all tests"
sequence = ["_test"]
[tool.poe.tasks.test-with-output]
help = "Run all tests (show output from tests)"
sequence = ["_test_with_output"]
[tool.poe.tasks.pre-commit]
help = "Run all formatting tasks followed by all linting tasks."
sequence = ["format", "lint"]
[[tool.mypy.overrides]]
ignore_missing_imports = true
module = ["transformers"]