From baef5d5e7316d16a39a0a729962de5e340177e2c Mon Sep 17 00:00:00 2001 From: Magnus Breder Birkenes Date: Fri, 2 Aug 2024 11:12:08 +0200 Subject: [PATCH] feat: config using env variables --- dhlab.env | 3 --- dhlab/constants.py | 11 ++++------- pyproject.toml | 3 +-- 3 files changed, 5 insertions(+), 12 deletions(-) delete mode 100644 dhlab.env diff --git a/dhlab.env b/dhlab.env deleted file mode 100644 index 1bdf071..0000000 --- a/dhlab.env +++ /dev/null @@ -1,3 +0,0 @@ -NB_DHLAB_BASE_URL = "https://api.nb.no/dhlab" #: REST-API URL adress to fulltext query functions -NB_DHLAB_NGRAM_API = "https://api.nb.no/dhlab/nb_ngram/ngram/query" #: URL adress for API calls to ngram-databases -NB_DHLAB_GALAXY_API = "https://api.nb.no/dhlab/nb_ngram_galaxies/galaxies/query" #: URL adress for word galaxy API queries \ No newline at end of file diff --git a/dhlab/constants.py b/dhlab/constants.py index 63449bf..35c0834 100644 --- a/dhlab/constants.py +++ b/dhlab/constants.py @@ -1,10 +1,7 @@ import os -from dotenv import load_dotenv -load_dotenv("dhlab.env") # take environment variables +"""Constant variables used across modules, override using environment variable""" -"""Constant variables used across modules, change in dhlab.env or through environment variable""" - -BASE_URL = os.getenv("NB_DHLAB_BASE_URL") #: REST-API URL adress to fulltext query functions -NGRAM_API = os.getenv("NB_DHLAB_NGRAM_API") #: URL adress for API calls to ngram-databases -GALAXY_API = os.getenv("NB_DHLAB_GALAXY_API") #: URL adress for word galaxy API queries +BASE_URL = os.getenv("NB_DHLAB_BASE_URL", "https://api.nb.no/dhlab") #: REST-API URL adress to fulltext query functions +NGRAM_API = os.getenv("NB_DHLAB_NGRAM_API", "https://api.nb.no/dhlab/nb_ngram/ngram/query") #: URL adress for API calls to ngram-databases +GALAXY_API = os.getenv("NB_DHLAB_GALAXY_API", "https://api.nb.no/dhlab/nb_ngram_galaxies/galaxies/query") #: URL adress for word galaxy API queries diff --git a/pyproject.toml b/pyproject.toml index f374501..48e4f80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -include = ["CHANGELOG.md", "LICENSE", "dhlab.env"] +include = ["CHANGELOG.md", "LICENSE"] exclude = ["docs/", "tests/"] [tool.poetry.urls] @@ -34,7 +34,6 @@ scipy = { version = "^1.11.3", python = ">=3.9,<3.13" } openpyxl = "^3.1.2" beautifulsoup4 = "^4.12.2" numpy = "^1.26.3" -python-dotenv = "^1.0.1" [tool.poetry.group.docs.dependencies] Sphinx = "^7.2.6"