Closed signebedi closed 2 months ago
I think this is as straightforward as a linked references subsection at the bottom of a given form - only if there are a non-zero set of backrefs. Same for users. Rendered as a datatable.
[bug] Pydantic upgrade breaks timezone config
I was able to verify that it is the pydantic version that breaks this test, because whereas the older version 2.7.1 had no issue with the field validator I had set up, an upgrade to the most recent version (2.9.0), did:
pip install -U pydantic
Requirement already satisfied: pydantic in ./venv/lib/python3.10/site-packages (2.7.1)
Collecting pydantic
Downloading pydantic-2.9.0-py3-none-any.whl (434 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 434.3/434.3 KB 515.2 kB/s eta 0:00:00
Requirement already satisfied: tzdata in ./venv/lib/python3.10/site-packages (from pydantic) (2024.1)
Requirement already satisfied: annotated-types>=0.4.0 in ./venv/lib/python3.10/site-packages (from pydantic) (0.6.0)
Requirement already satisfied: typing-extensions>=4.6.1 in ./venv/lib/python3.10/site-packages (from pydantic) (4.11.0)
Collecting pydantic-core==2.23.2
Downloading pydantic_core-2.23.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 4.5 MB/s eta 0:00:00
Installing collected packages: pydantic-core, pydantic
Attempting uninstall: pydantic-core
Found existing installation: pydantic_core 2.18.2
Uninstalling pydantic_core-2.18.2:
Successfully uninstalled pydantic_core-2.18.2
Attempting uninstall: pydantic
Found existing installation: pydantic 2.7.1
Uninstalling pydantic-2.7.1:
Successfully uninstalled pydantic-2.7.1
Successfully installed pydantic-2.9.0 pydantic-core-2.23.2
(venv) sig@brunhilda:~/Code/libreforms-fastapi$ uvicorn libreforms_fastapi.app:app --reload
INFO: Will watch for changes in these directories: ['/home/sig/Code/libreforms-fastapi']
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [16575] using WatchFiles
Process SpawnProcess-1:
Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/sig/Code/libreforms-fastapi/venv/lib/python3.10/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
target(sockets=sockets)
File "/home/sig/Code/libreforms-fastapi/venv/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
File "/home/sig/Code/libreforms-fastapi/venv/lib/python3.10/site-packages/uvicorn/server.py", line 69, in serve
await self._serve(sockets)
File "/home/sig/Code/libreforms-fastapi/venv/lib/python3.10/site-packages/uvicorn/server.py", line 76, in _serve
config.load()
File "/home/sig/Code/libreforms-fastapi/venv/lib/python3.10/site-packages/uvicorn/config.py", line 434, in load
self.loaded_app = import_from_string(self.app)
File "/home/sig/Code/libreforms-fastapi/venv/lib/python3.10/site-packages/uvicorn/importer.py", line 19, in import_from_string
module = importlib.import_module(module_str)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/sig/Code/libreforms-fastapi/libreforms_fastapi/app/__init__.py", line 335, in <module>
with get_config_context() as config:
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/home/sig/Code/libreforms-fastapi/libreforms_fastapi/app/__init__.py", line 289, in get_config_context
conf = get_config(_env)
File "/home/sig/Code/libreforms-fastapi/libreforms_fastapi/utils/config.py", line 364, in get_config
return DevelopmentConfig()
File "/home/sig/Code/libreforms-fastapi/venv/lib/python3.10/site-packages/pydantic_settings/main.py", line 144, in __init__
super().__init__(
File "/home/sig/Code/libreforms-fastapi/venv/lib/python3.10/site-packages/pydantic/main.py", line 211, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
File "/home/sig/Code/libreforms-fastapi/libreforms_fastapi/utils/config.py", line 111, in validate_timezone
tz = ZoneInfo(v)
File "/usr/lib/python3.10/zoneinfo/_tzpath.py", line 67, in find_tzfile
_validate_tzfile_path(key)
File "/usr/lib/python3.10/zoneinfo/_tzpath.py", line 80, in _validate_tzfile_path
if os.path.isabs(path):
File "/usr/lib/python3.10/posixpath.py", line 62, in isabs
s = os.fspath(s)
TypeError: expected str, bytes or os.PathLike object, not ZoneInfo
I think there are two logical steps we want to take to make this usable for people.
The first is to add a linked submissions area whenever we view a single submission, preferably at the bottom and maybe borrowing some of the styling from how Obsidian handles linked references.
The second is to do the same thing for linked to users at the bottom of their profiles. Now obviously we'll have to subject this to the viewing users permissions. They might not be able to see some of the forms that a user profile has linked to, but that's par for the course. We might be able to render these as another data table, but maybe the subdued one with fewer bells and whistles.