fastlifeweb 0.19.0__py3-none-any.whl → 0.20.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.20.0 - Released on 2024-11-09
2
+ * Add a new class GenericRegistry in order to properly type custom Configurator / Registry / Settings
3
+ * Using InlineTemplate, we can pass arbitrary types for pydantic form
4
+
1
5
  ## 0.19.0 - Released on 2024-11-07
2
6
  * Drop Babel from depenencies for i18n, rely on GNUTranslations only
3
7
  * Change License to MIT
fastlife/__init__.py CHANGED
@@ -8,6 +8,7 @@ from .config import (
8
8
  Configurator,
9
9
  DefaultRegistry,
10
10
  GenericConfigurator,
11
+ GenericRegistry,
11
12
  Settings,
12
13
  configure,
13
14
  resource,
@@ -25,6 +26,7 @@ __all__ = [
25
26
  "GenericConfigurator",
26
27
  "Configurator",
27
28
  "DefaultRegistry",
29
+ "GenericRegistry",
28
30
  "TemplateParams",
29
31
  "Settings",
30
32
  "view_config",
@@ -1,7 +1,7 @@
1
1
  """Configure fastlife app for dependency injection."""
2
2
 
3
3
  from .configurator import Configurator, GenericConfigurator, configure
4
- from .registry import DefaultRegistry
4
+ from .registry import DefaultRegistry, GenericRegistry
5
5
  from .resources import resource, resource_view
6
6
  from .settings import Settings
7
7
  from .views import view_config
@@ -13,6 +13,7 @@ __all__ = [
13
13
  "view_config",
14
14
  "resource",
15
15
  "resource_view",
16
+ "GenericRegistry",
16
17
  "DefaultRegistry",
17
18
  "Settings",
18
19
  ]
@@ -1,5 +1,5 @@
1
1
  from collections.abc import Mapping
2
- from typing import TYPE_CHECKING, TypeVar
2
+ from typing import TYPE_CHECKING, Generic, TypeVar
3
3
 
4
4
  from fastlife.services.locale_negociator import LocaleNegociator, default_negociator
5
5
  from fastlife.services.translations import LocalizerFactory
@@ -11,10 +11,15 @@ if TYPE_CHECKING:
11
11
 
12
12
  from .settings import Settings
13
13
 
14
+ TSettings = TypeVar("TSettings", bound=Settings, covariant=True)
15
+ """
16
+ A TypeVar used to override the DefaultRegistry to add more helpers in the registry.
17
+ """
18
+
14
19
 
15
- class DefaultRegistry:
20
+ class GenericRegistry(Generic[TSettings]):
16
21
  """
17
- The application registry got fastlife dependency injection.
22
+ Application registry for fastlife dependency injection.
18
23
  It is initialized by the configurator and accessed by the `fastlife.Registry`.
19
24
  """
20
25
 
@@ -36,6 +41,12 @@ class DefaultRegistry:
36
41
  raise RuntimeError(f"No renderer registered for template {template}")
37
42
 
38
43
 
44
+ DefaultRegistry = GenericRegistry[Settings]
45
+ """
46
+ The default registry until you need to inject more component in the registry.
47
+ """
48
+
49
+
39
50
  TRegistry = TypeVar("TRegistry", bound=DefaultRegistry, covariant=True)
40
51
  """
41
52
  A TypeVar used to override the DefaultRegistry to add more helpers in the registry.
@@ -3,6 +3,7 @@
3
3
  from typing import ClassVar
4
4
 
5
5
  from pydantic import BaseModel
6
+ from pydantic.config import ConfigDict
6
7
 
7
8
 
8
9
  class InlineTemplate(BaseModel):
@@ -15,5 +16,7 @@ class InlineTemplate(BaseModel):
15
16
  tighly coupled with the view and its code can stay in the same module of that view.
16
17
  """
17
18
 
19
+ model_config = ConfigDict(arbitrary_types_allowed=True)
20
+
18
21
  template: ClassVar[str]
19
22
  """The template string to render."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastlifeweb
3
- Version: 0.19.0
3
+ Version: 0.20.0
4
4
  Summary: High-level web framework
5
5
  Author-Email: Guillaume Gauvrit <guillaume@gauvr.it>
6
6
  License: MIT License
@@ -37,8 +37,8 @@ Description-Content-Type: text/markdown
37
37
 
38
38
  # Fastlife
39
39
 
40
- [![Documentation](https://github.com/mardiros/fastlife/actions/workflows/gh-pages.yml/badge.svg)](https://mardiros.github.io/fastlife/)
41
- [![Continuous Integration](https://github.com/mardiros/fastlife/actions/workflows/main.yml/badge.svg)](https://github.com/mardiros/fastlife/actions/workflows/main.yml)
40
+ [![Documentation](https://github.com/mardiros/fastlife/actions/workflows/publish-doc.yml/badge.svg)](https://mardiros.github.io/fastlife/)
41
+ [![Continuous Integration](https://github.com/mardiros/fastlife/actions/workflows/tests.yml/badge.svg)](https://github.com/mardiros/fastlife/actions/workflows/tests.yml)
42
42
  [![Coverage Report](https://codecov.io/gh/mardiros/fastlife/graph/badge.svg?token=DTpi73d7mf)](https://codecov.io/gh/mardiros/fastlife)
43
43
  [![Maintainability](https://api.codeclimate.com/v1/badges/94d107797b15b5e8843e/maintainability)](https://codeclimate.com/github/mardiros/fastlife/maintainability)
44
44
 
@@ -1,5 +1,5 @@
1
- CHANGELOG.md,sha256=y7v81-bRMbfVQj3MFLZROiFv5PByE4MqdeMYm85gHfg,5823
2
- fastlife/__init__.py,sha256=a4-GFYXAQ0zLnEIQNIpZUpXtNkuPHIOfzLP5xOn2SRo,755
1
+ CHANGELOG.md,sha256=O4fJAjGiCGsX1L56Rdtl_4KbruwAsqsxihHgtd5FnDc,6032
2
+ fastlife/__init__.py,sha256=l8SVz6RNy8QJNKFwUx9OHt-V21r9yeKK8pLuUY1u4ps,799
3
3
  fastlife/adapters/__init__.py,sha256=WYjEN8gp4r7LCHqmIO5VzzvsT8QGRE3w4G47UwYDtAo,94
4
4
  fastlife/adapters/jinjax/__init__.py,sha256=4JRAUwFGpTxYtRlg5sU79AahxyAiRMhllRFHoI-dnug,117
5
5
  fastlife/adapters/jinjax/jinjax_ext/__init__.py,sha256=z6NWvHzTNEq6bVO4iJoTR6-y4A6UtS_VuSMV_tff1jY,49
@@ -1683,11 +1683,11 @@ fastlife/components/pydantic_form/Text.jinja,sha256=2f_3Q32GySHTLFt-YO8gEJNCY-3X
1683
1683
  fastlife/components/pydantic_form/Textarea.jinja,sha256=NzfCi5agRUSVcb5RXw0QamM8P1lZ-CdNI6P30zb2948,1155
1684
1684
  fastlife/components/pydantic_form/Union.jinja,sha256=czTska54z9KCZKu-FaycLmOvtH6y6CGUFQ8DHnkjrJk,1461
1685
1685
  fastlife/components/pydantic_form/Widget.jinja,sha256=EXskDqt22D5grpGVwlZA3ndve2Wr_6yQH4qVE9c31Og,397
1686
- fastlife/config/__init__.py,sha256=ThosRIPZ_fpD0exZu-kUC_f8ZNa5KyDlleWMmEHkjEo,448
1686
+ fastlife/config/__init__.py,sha256=R0HXh0rt6Aecf5kJmXvhH-6QrQb1SyuI83bOU8T80fc,488
1687
1687
  fastlife/config/configurator.py,sha256=sVecDJbjeRQRjULjbQH1JCeBOqvS6DUeQGJ5Nh2HQlw,22649
1688
1688
  fastlife/config/exceptions.py,sha256=kH2-akbzGeODlY_1bUhbzDKqBFrpOoqnVom0WPm0IGg,1237
1689
1689
  fastlife/config/openapiextra.py,sha256=rYoerrn9sni2XwnO3gIWqaz7M0aDZPhVLjzqhDxue0o,514
1690
- fastlife/config/registry.py,sha256=geny-liWxciPpHjmeFba9zLuXNWbz-R99VtzPS0whg0,1439
1690
+ fastlife/config/registry.py,sha256=zP_LPvwTcUZdrrsCnRaUfJzeYq7M_eVdRWlN0oO52RE,1754
1691
1691
  fastlife/config/resources.py,sha256=Wu3vVr7XD18Gf4-MYYCxAAnuRmsAJmpllonts_BVGdQ,8593
1692
1692
  fastlife/config/settings.py,sha256=t9goMfnc_oWrS_c3vgivIe0w6N2Byohcfol2CAnLiJs,3892
1693
1693
  fastlife/config/views.py,sha256=C6Ot3mxTyN5isVsIe5b9x-VzD2q76pJQ8xY2aPWdMZM,2460
@@ -1721,7 +1721,7 @@ fastlife/shared_utils/resolver.py,sha256=Wb9cO2MWavpti63hju15xmwFMgaD5DsQaxikRpB
1721
1721
  fastlife/templates/__init__.py,sha256=yB6Zpz-jsFytLAz4Z6Nmuvr7Z8kbCXSdgw6kMpggTxk,241
1722
1722
  fastlife/templates/binding.py,sha256=0pE2btOwLf4xOEgBXVOyz_dIX9tBCYCaJ7RhZI3knbs,1464
1723
1723
  fastlife/templates/constants.py,sha256=MGdUjkF9hsPMN8rOS49eWbAApcb8FL-FAeFvJU8k90M,8387
1724
- fastlife/templates/inline.py,sha256=amxtgWqN_NFXIVVkr_LGebRj55T_QwsDJdO42_mZGRI,604
1724
+ fastlife/templates/inline.py,sha256=wrZDAtd7zXcACHl2LVz0HqDT1VSPsiVy4srt3JSDiu4,704
1725
1725
  fastlife/testing/__init__.py,sha256=VpxkS3Zp3t_hH8dBiLaGFGhsvt511dhBS_8fMoFXdmU,99
1726
1726
  fastlife/testing/dom.py,sha256=dVzDoZokn-ii681UaEwAr-khM5KE-CHgXSSLSo24oH0,4489
1727
1727
  fastlife/testing/form.py,sha256=ST0xNCoUqz_oD92cWHzQ6CbJ5hFopvu_NNKpOfiuYWY,7874
@@ -1729,9 +1729,9 @@ fastlife/testing/session.py,sha256=LEFFbiR67_x_g-ioudkY0C7PycHdbDfaIaoo_G7GXQ8,2
1729
1729
  fastlife/testing/testclient.py,sha256=WmUnGkDPuSd4dKzTiXWyHWlJ31zBbySvMH9m8p0acg8,6741
1730
1730
  fastlife/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1731
1731
  fastlife/views/pydantic_form.py,sha256=4dv37JORLpvkgCgMGZfUN_qy7wme040GLZAzOTFqdnU,1367
1732
- fastlifeweb-0.19.0.dist-info/METADATA,sha256=fZYDwl_GvvfyJHuqTPLkWAYnm_uRpt85nEn2TcU73BM,3658
1733
- fastlifeweb-0.19.0.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
1734
- fastlifeweb-0.19.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1735
- fastlifeweb-0.19.0.dist-info/licenses/LICENSE,sha256=NlRX9Z-dcv8X1VFW9odlIQBbgNN9pcO94XzvKp2R16o,1075
1732
+ fastlifeweb-0.20.0.dist-info/METADATA,sha256=CRTUb1xqKtSTjd5lhZ-YRY9AAJZHjJW14vMvFJngjmk,3663
1733
+ fastlifeweb-0.20.0.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
1734
+ fastlifeweb-0.20.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1735
+ fastlifeweb-0.20.0.dist-info/licenses/LICENSE,sha256=NlRX9Z-dcv8X1VFW9odlIQBbgNN9pcO94XzvKp2R16o,1075
1736
1736
  tailwind.config.js,sha256=y_xTuRmjIdrfyo92PoUW0wjFTnkO27xepwfirkaCFno,1351
1737
- fastlifeweb-0.19.0.dist-info/RECORD,,
1737
+ fastlifeweb-0.20.0.dist-info/RECORD,,