curved-farmer-66180
09/17/2022, 3:03 AMdjango-ninja>=0.19.1
2. lockfile
// --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
// {
// "version": 2,
// "valid_for_interpreter_constraints": [
// "CPython>=3.7"
// ],
// "generated_with_requirements": [
// "ansicolors>=1.0.2",
// "django-ninja>=0.19.1",
// "django-stubs>=1.10.0",
// "django<4,>=3.2.13",
// "gunicorn>=20.1.0",
// "protobuf>=3.11.3",
// "pytest>=6.0.1",
// "requests>=2.25.1",
// "setuptools>=42.0.0",
// "translate>=3.2.1",
// "types-requests>=2.25.1"
// ]
// }
3. BUILD
# Copyright 2021 Pants project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).
python_sources(
name="lib",
dependencies=[
"helloworld/person/migrations",
]
)
python_tests(
name="tests",
dependencies=[
"helloworld", # For settings.py.
],
)
python_test_utils(
name="test_utils",
)
4. api.py
from ninja import NinjaAPI
api = NinjaAPI()
@api.get("/add")
def add(request, a:int, b:int):
return {"result": a + b}
enough-analyst-54434
09/17/2022, 3:23 AMenough-analyst-54434
09/17/2022, 3:33 AMcurved-farmer-66180
09/17/2022, 3:37 AMcurved-farmer-66180
09/17/2022, 3:46 AMpython_requirements(
name="requirements",
module_mapping={"django-ninja": ["ninja"]}
)
That works! Thanks a lot. @enough-analyst-54434