Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ venv.bak/
site

.tool-versions
.qodo/
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ It also adds a variety of more basic utilities that are useful across a wide var
* **CamelCase Conversions**: Convenience functions for converting strings from `snake_case` to `camelCase` or `PascalCase` and back
* **GUID Type**: The provided GUID type makes it easy to use UUIDs as the primary keys for your database tables

See the [docs](https://https://fastapiutils.github.io/fastapi-utils//) for more details and examples.
See the [docs](https://fastapiutils.github.io/fastapi-utils//) for more details and examples.

## Requirements

Expand Down
2 changes: 2 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Latest changes

* Fix: tasks.repeat_every() and related tests [#305](https://github.com/dmontagu/fastapi-utils/issues/305)
* Fix typo [#306](https://github.com/dmontagu/fastapi-utils/issues/306)
* Merge with [fastapi-utils](https://github.com/dmontagu/fastapi-utils)

## 0.6.0
Expand Down
4 changes: 2 additions & 2 deletions fastapi_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from .cbv_base import Api, Resource, set_responses, take_init_parameters

try:
__version__ = "0.8.0"
__version__ = "0.8.0"
except importlib.metadata.PackageNotFoundError as e:
warnings.warn(f"Could not determine version of {__name__}", stacklevel=1)
warnings.warn(str(e), stacklevel=1)
__version__ = "0.8.0"
__version__ = "0.8.0"


__all__ = [
Expand Down
18 changes: 12 additions & 6 deletions fastapi_utils/cbv.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,18 @@ def _register_endpoints(router: APIRouter, cls: Type[Any], *urls: str) -> None:
_allocate_routes_by_method_name(router, url, function_members)
router_roles = []
for route in router.routes:
if not isinstance(route, APIRoute):
raise ValueError("The provided routes should be of type APIRoute")

route_methods: Any = route.methods
cast(Tuple[Any], route_methods)
router_roles.append((route.path, tuple(route_methods)))
# Fix: Allow both APIRoute and WebSocketRoute to be consistent with processing logic
if not isinstance(route, (APIRoute, WebSocketRoute)):
raise ValueError("The provided routes should be of type APIRoute or WebSocketRoute")

# Only process route_methods for APIRoute (WebSocketRoute doesn't have methods)
if isinstance(route, APIRoute):
route_methods: Any = route.methods
cast(Tuple[Any], route_methods)
router_roles.append((route.path, tuple(route_methods)))
else:
# For WebSocketRoute, the actual route type name
router_roles.append((route.path, (type(route).__name__,)))

if len(set(router_roles)) != len(router_roles):
raise Exception("An identical route role has been implemented more then once")
Expand Down
645 changes: 455 additions & 190 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.8"

fastapi = ">=0.89,<1.0"
pydantic = ">1.0, <3.0"
sqlalchemy = { version = ">=1.4,<3.0", optional = true }
pydantic = ">=2.0"
sqlalchemy = "^2.0.41"
psutil = ">=5,<7"
pydantic-settings = { version= "^2.0.1", optional = true }
typing-inspect = { version = "^0.9.0", optional = true}
fastapi = "0.115.8"

[tool.poetry.group.dev.dependencies]
# Starlette features
Expand Down
104 changes: 52 additions & 52 deletions scripts/develop.sh
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
#!/usr/bin/env bash
set -e
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
cd "${PROJECT_ROOT}"
check_for_python3() {
command -v python3 >/dev/null 2>&1 || {
cat <<ERROR >&2
***Required*** command not found: python3
If pyenv is installed, you can install python3 via:
pyenv install 3.8.1 # update version as desired
See the following links for more information:
* https://github.com/pyenv/pyenv
* https://github.com/pyenv/pyenv-installer
ERROR
exit 1
}
}
check_for_poetry() {
command -v poetry >/dev/null 2>&1 || {
cat <<ERROR >&2
***Required*** command not found: poetry
This can be installed via:
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python3
See the following links for more information:
* https://poetry.eustace.io/docs/
* https://github.com/sdispater/poetry
ERROR
exit 1
}
}
check_for_python3
check_for_poetry
set -x
poetry install
{ set +x; } 2>/dev/null
echo ""
echo "Virtual environment interpreter details:"
poetry env info
#!/usr/bin/env bash
set -e

PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
cd "${PROJECT_ROOT}"

check_for_python3() {
command -v python3 >/dev/null 2>&1 || {
cat <<ERROR >&2
***Required*** command not found: python3

If pyenv is installed, you can install python3 via:

pyenv install 3.8.1 # update version as desired

See the following links for more information:
* https://github.com/pyenv/pyenv
* https://github.com/pyenv/pyenv-installer

ERROR
exit 1
}
}

check_for_poetry() {
command -v poetry >/dev/null 2>&1 || {
cat <<ERROR >&2
***Required*** command not found: poetry

This can be installed via:

curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python3

See the following links for more information:
* https://poetry.eustace.io/docs/
* https://github.com/sdispater/poetry

ERROR
exit 1
}
}

check_for_python3
check_for_poetry

set -x
poetry install

{ set +x; } 2>/dev/null
echo ""
echo "Virtual environment interpreter details:"
poetry env info