From 0a3280c2e3dc6610c377c6426f12b6f5159c578c Mon Sep 17 00:00:00 2001 From: tarsil Date: Thu, 7 Mar 2024 18:51:40 +0000 Subject: [PATCH 1/5] Update docs and env vars --- docs/settings.md | 8 ++++---- mongoz/conf/__init__.py | 8 +++++--- pyproject.toml | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/settings.md b/docs/settings.md index 24a215b..b21d6b9 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -10,17 +10,17 @@ This is exactly what happened. The way of using the settings object within a Mongoz use of the ORM is via: -* **SETTINGS_MODULE** environment variable. +* **MONGOZ_SETTINGS_MODULE** environment variable. All the settings are **[Pydantic BaseSettings](https://pypi.org/project/pydantic-settings/)** objects which makes it easier to use and override when needed. -### SETTINGS_MODULE +### MONGOZ_SETTINGS_MODULE -Mongoz by default uses is looking for a `SETTINGS_MODULE` environment variable to run and +Mongoz by default uses is looking for a `MONGOZ_SETTINGS_MODULE` environment variable to run and apply the given settings to your instance. -If no `SETTINGS_MODULE` is found, Mongoz then uses its own internal settings which are +If no `MONGOZ_SETTINGS_MODULE` is found, Mongoz then uses its own internal settings which are widely applied across the system. #### Custom settings diff --git a/mongoz/conf/__init__.py b/mongoz/conf/__init__.py index 91f6a48..ffb438a 100644 --- a/mongoz/conf/__init__.py +++ b/mongoz/conf/__init__.py @@ -1,6 +1,8 @@ import os -if not os.environ.get("SETTINGS_MODULE"): - os.environ.setdefault("SETTINGS_MODULE", "mongoz.conf.global_settings.MongozSettings") +os.environ.setdefault("OVERRIDE_SETTINGS_MODULE_VARIABLE", "MONGOZ_SETTINGS_MODULE") -from dymmond_settings import settings as settings +if not os.environ.get("MONGOZ_SETTINGS_MODULE"): + os.environ.setdefault("MONGOZ_SETTINGS_MODULE", "mongoz.conf.global_settings.MongozSettings") + +from dymmond_settings import settings as settings # noqa diff --git a/pyproject.toml b/pyproject.toml index 724db0f..56dc294 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ classifiers = [ ] dependencies = [ "motor>=3.3.1", - "dymmond-settings>=1.0.2", + "dymmond-settings>=1.0.3", "orjson>=3.9.5", "pydantic>=2.5.3,<3.0.0", ] From d069341f6c377fd1a3fb4b5c2cac8efed1a5abb9 Mon Sep 17 00:00:00 2001 From: tarsil Date: Thu, 7 Mar 2024 18:54:19 +0000 Subject: [PATCH 2/5] Update requirements --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 56dc294..c842574 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ Source = "https://github.com/tarsil/mongoz" test = [ "autoflake>=2.0.2,<3.0.0", "black==24.1.1,<25.0", - "esmerald>=2.0.6", + "esmerald[testing]>=2.0.6", "isort>=5.12.0,<6.0.0", "mypy==1.5.1", "pytest>=7.2.2,<9.0.0", From ee3061b004fd5130bf1a4b8df96ef1f8ec33f79e Mon Sep 17 00:00:00 2001 From: tarsil Date: Thu, 7 Mar 2024 18:56:07 +0000 Subject: [PATCH 3/5] Update requirements --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c842574..987fe03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,9 +55,10 @@ Source = "https://github.com/tarsil/mongoz" [project.optional-dependencies] test = [ + "a2wsgi>1.10.0,<2.0.0", "autoflake>=2.0.2,<3.0.0", "black==24.1.1,<25.0", - "esmerald[testing]>=2.0.6", + "esmerald>=2.0.6", "isort>=5.12.0,<6.0.0", "mypy==1.5.1", "pytest>=7.2.2,<9.0.0", From a0a8bbbbd98ad564147fc760d4967e3c15436b56 Mon Sep 17 00:00:00 2001 From: tarsil Date: Thu, 7 Mar 2024 19:01:34 +0000 Subject: [PATCH 4/5] Fix wsgi dependency --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 987fe03..c81eb41 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ test = [ "a2wsgi>1.10.0,<2.0.0", "autoflake>=2.0.2,<3.0.0", "black==24.1.1,<25.0", - "esmerald>=2.0.6", + "esmerald[testing]>=2.0.6", "isort>=5.12.0,<6.0.0", "mypy==1.5.1", "pytest>=7.2.2,<9.0.0", From 2bea97d1fcf2f4cd2421c5bbbe2ce8241843a05f Mon Sep 17 00:00:00 2001 From: tarsil Date: Thu, 7 Mar 2024 19:06:45 +0000 Subject: [PATCH 5/5] Fix wsgi dependency --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c81eb41..395dfaa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,8 @@ test = [ "a2wsgi>1.10.0,<2.0.0", "autoflake>=2.0.2,<3.0.0", "black==24.1.1,<25.0", - "esmerald[testing]>=2.0.6", + "esmerald>=2.0.6", + "httpx>=0.25.0,<0.30.0", "isort>=5.12.0,<6.0.0", "mypy==1.5.1", "pytest>=7.2.2,<9.0.0",