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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute all routes from FastAPI app once #24

Closed

Commits on Mar 15, 2023

  1. Remove superfluous object

    I've used the tool pyupgrade[^1] to perform this cleanup, using the
    following command:
    
    ```console
    $ find examples fastapi_hypermodel tests -name "*.py" \
        -exec pyupgrade --py37-plus {} \;
    ```
    
    It could be useful to add this weapon in tox test suite for instance.
    
    [^1]: https://github.com/asottile/pyupgrade
    wo0dyn committed Mar 15, 2023
    Copy the full SHA
    e0ec4e8 View commit details
    Browse the repository at this point in the history
  2. Remove Pydantic (already dependency in FastAPI)

    I would remove Pydantic as a dependency for this project as it's already
    a dependency of FastAPI[^1] itself.
    
    [^1]: https://github.com/tiangolo/fastapi/blob/master/pyproject.toml#L45
    wo0dyn committed Mar 15, 2023
    Copy the full SHA
    02e0aad View commit details
    Browse the repository at this point in the history
  3. Remove unused dev dep: requests

    Unless I'm mistaken, these two dependencies are not used in the project.
    I would remove them as well.
    wo0dyn committed Mar 15, 2023
    Copy the full SHA
    03c1358 View commit details
    Browse the repository at this point in the history
  4. Remove unused Hypermodel private method

    I didn't find any usage of this method in the project. And since it was
    defined with a protected scope (by convention), I don't think it should
    be used somewhere else.
    wo0dyn committed Mar 15, 2023
    Copy the full SHA
    c1ec756 View commit details
    Browse the repository at this point in the history

Commits on Mar 16, 2023

  1. Lazy compute all routes from FastAPI app once

    Instead of keeping a reference to the FastAPI app, I think it's better
    to keep its routes. This way, on `HALFor()`, it's more convenient to
    retrieve a given route by its endpoint (aka route.name) rather than
    iterate on app.routes at every call.
    wo0dyn committed Mar 16, 2023
    Copy the full SHA
    0f58218 View commit details
    Browse the repository at this point in the history

Commits on Mar 19, 2023

  1. Apply suggestions from code review

    Co-authored-by: Nicolas Dubois <nicolas.c.dubois@gmail.com>
    jtc42 and wo0dyn committed Mar 19, 2023
    Copy the full SHA
    08145f9 View commit details
    Browse the repository at this point in the history
  2. Revert "Apply suggestions from code review"

    This reverts commit 08145f9.
    jtc42 committed Mar 19, 2023
    Copy the full SHA
    354e132 View commit details
    Browse the repository at this point in the history