Skip to content
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

Update ASGI requirements #911

Merged
merged 5 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
12 changes: 10 additions & 2 deletions piccolo/apps/asgi/commands/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@

TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), "templates/app/")
SERVERS = ["uvicorn", "Hypercorn"]
ROUTERS = ["starlette", "fastapi", "blacksheep", "litestar", "esmerald"]
ADMIN_DEPENDENCIES = ["piccolo_admin>=1.0.0"]
ROUTER_DEPENDENCIES = {
"fastapi": ["fastapi>=0.100.0"],
"starlette": ["starlette", *ADMIN_DEPENDENCIES],
"fastapi": ["fastapi>=0.100.0", *ADMIN_DEPENDENCIES],
"blacksheep": ["blacksheep", *ADMIN_DEPENDENCIES],
"litestar": ["litestar", *ADMIN_DEPENDENCIES],
# We don't currently use Piccolo Admin with esmerald, due to dependency
# conflicts with FastAPI. We'll revisit this at some point in the future
# when newer versions of FastAPI are released (DT - 12th December 2023).
"esmerald": ["esmerald"],
}
Copy link
Member Author

@dantownsend dantownsend Dec 12, 2023

Choose a reason for hiding this comment

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

I decided to omit piccolo_admin from esmerald this way instead of having this in requirements.txt.jinja:

{% if "esmerald" not in router_dependencies %}
piccolo_admin
{% endif %}

Because at some point I'd like to version pin the routers a bit more. So it might be that we have esmerald>X.X.X in which case the if statement would fail.

ROUTERS = list(ROUTER_DEPENDENCIES.keys())


def print_instruction(message: str):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
{{ router_dependency }}
{% endfor -%}
{{ server }}
jinja2
piccolo[postgres]
piccolo_admin
requests
piccolo[postgres]>=1.0.0
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if this will cause any problems ... i.e. it means that all of routers must support Pydantic v2. Will see when the CI runs.

Loading