Skip to content

Upgrade path to Pydantic 2.0 #35

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

Merged
merged 8 commits into from
Aug 11, 2023
Merged

Conversation

turukawa
Copy link
Member

@turukawa turukawa commented Jul 25, 2023

Major path updates include:

  • frontend:
    • Node 16 to 18
    • Latest Pinia requires changes in stores, where imports are not required (cause actual errors), and parameter declaration must happen in functions.
  • backend and celeryworker:
    • Python 3.9 to 3.11
    • FastAPI 0.88 to 0.99 (Inboard 0.37 to 0.51)
    • Poetry to Hatch
    • Postgres 14 to 15

Review required on the new hatch pyproject.toml file, and to ensure that the environments are stable. @br3ndonland, I'd appreciate your review.

Major path updates include:

- frontend:
  - Node 16 to 18
  - Latest Pinia requires changes in `stores`, where imports are not required, and parameter declaration must happen in functions.
- backend and celeryworker:
  - Python 3.9 to 3.11
  - Poetry to Hatch
  - Postgres 14 to 15
@turukawa turukawa requested a review from br3ndonland July 25, 2023 07:34
@turukawa turukawa mentioned this pull request Jul 25, 2023
@turukawa
Copy link
Member Author

Getting this error on backend when calling the api:

2023-07-25 10:26:06 Traceback (most recent call last):
2023-07-25 10:26:06   File "<frozen runpy>", line 198, in _run_module_as_main
2023-07-25 10:26:06   File "<frozen runpy>", line 88, in _run_code
2023-07-25 10:26:06   File "/app/inboard/start.py", line 135, in <module>
2023-07-25 10:26:06     start_server(
2023-07-25 10:26:06   File "/app/inboard/start.py", line 123, in start_server
2023-07-25 10:26:06     uvicorn.run(**uvicorn_options)  # type: ignore[arg-type]
2023-07-25 10:26:06     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-07-25 10:26:06   File "/app/.venv/lib/python3.11/site-packages/uvicorn/main.py", line 573, in run
2023-07-25 10:26:06     ChangeReload(config, target=server.run, sockets=[sock]).run()
2023-07-25 10:26:06   File "/app/.venv/lib/python3.11/site-packages/uvicorn/supervisors/basereload.py", line 50, in run
2023-07-25 10:26:06     for changes in self:
2023-07-25 10:26:06   File "/app/.venv/lib/python3.11/site-packages/uvicorn/supervisors/basereload.py", line 69, in __next__
2023-07-25 10:26:06     return self.should_restart()
2023-07-25 10:26:06            ^^^^^^^^^^^^^^^^^^^^^
2023-07-25 10:26:06   File "/app/.venv/lib/python3.11/site-packages/uvicorn/supervisors/statreload.py", line 32, in should_restart
2023-07-25 10:26:06     for file in self.iter_py_files():
2023-07-25 10:26:06   File "/app/.venv/lib/python3.11/site-packages/uvicorn/supervisors/statreload.py", line 52, in iter_py_files
2023-07-25 10:26:06     for path in list(reload_dir.rglob("*.py")):
2023-07-25 10:26:06                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-07-25 10:26:06   File "/usr/local/lib/python3.11/pathlib.py", line 968, in rglob
2023-07-25 10:26:06     for p in selector.select_from(self):
2023-07-25 10:26:06   File "/usr/local/lib/python3.11/pathlib.py", line 408, in _select_from
2023-07-25 10:26:06     for p in successor_select(starting_point, is_dir, exists, scandir):
2023-07-25 10:26:06   File "/usr/local/lib/python3.11/pathlib.py", line 356, in _select_from
2023-07-25 10:26:06     entries = list(scandir_it)
2023-07-25 10:26:06               ^^^^^^^^^^^^^^^^
2023-07-25 10:26:06 OSError: [Errno 12] Cannot allocate memory: '/app/app'

Celeryworker fix:

Recommended `hatch run production:python /app/app/celeryworker_pre_start.py` does not work. Use `hatch run python /app/app/celeryworker_pre_start.py` instead.

Frontend:

Weird issue with latest version of Vite: #35

Requires changing of `/app` to *any other directory name*. This is a Docker/Vite issue and may be fixed in a future version of Vite.
@turukawa
Copy link
Member Author

The fix to frontend is related to a Vite error: scj2000/scj2000-web-v2@b923143

turukawa added 2 commits July 25, 2023 13:07
 Fixing Pinia referencing changes and standardising naming conventions
- Token invalid settings seems somewhat pointless ... just remove it entirely to avoid risk of weird conflicts
- Simplified crud paging with a site-level setting ... risk of some sort of DoS attack by having a way to bypass row-fetch limits
- Placeholder for a sockets-based API
Copy link

@br3ndonland br3ndonland left a comment

Choose a reason for hiding this comment

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

Thanks @turukawa. Great to see Hatch and inboard put to good use here. I have a few suggestions. Feel free to let me know if any further clarifications or changes are needed.

@turukawa turukawa merged commit c5cd1ba into master Aug 11, 2023
@turukawa turukawa deleted the upgrade-path-to-pydantic-2.0 branch August 11, 2023 09:16
echocraft201315 added a commit to echocraft201315/fastAPI-mongoDB that referenced this pull request Mar 27, 2025
Celeryworker fix:

Recommended `hatch run production:python /app/app/celeryworker_pre_start.py` does not work. Use `hatch run python /app/app/celeryworker_pre_start.py` instead.

Frontend:

Weird issue with latest version of Vite: whythawk/full-stack-fastapi-postgresql#35

Requires changing of `/app` to *any other directory name*. This is a Docker/Vite issue and may be fixed in a future version of Vite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants