Skip to content

Why are Param Functions uppercased? #4303

@aryaniyaps

Description

@aryaniyaps

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google "How to X in FastAPI" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to FastAPI but to Pydantic.
  • I already checked if it is not related to FastAPI but to Swagger UI.
  • I already checked if it is not related to FastAPI but to ReDoc.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

from fastapi import FastAPI, Depends

app = FastAPI()

def get_dep():
    pass


@app.get("/)
def my_route(dep = Depends(get_dep)):
    pass

Description

I really like FastAPI's dependency injection system. It makes it really easy to write scalable apps with less code. However, I dont understand why param functions like Depends and Security are uppercased.

After all, they are functions and this violates PEP8.

I find it more pythonic to make the function names lowercase, although I'm sure there would be a reason behind this decision.

Example:

from fastapi import FastAPI, depends

app = FastAPI()

def get_dep():
    pass


@app.get("/)
def my_route(dep = depends(get_dep)):
    pass

I would like to hear the thought process behind this from the maintainers!

Operating System

Windows

Operating System Details

No response

FastAPI Version

0.70

Python Version

3.9

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions