Skip to content

Commit

Permalink
Merge branch 'main' into manage-resource-exceptions
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
bolinocroustibat committed Sep 3, 2024
2 parents c332c6b + b6a6a3d commit 7041ed0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
- Update `csv-detective` to 0.7.2 which doesn't include yanked version of `requests` anymore [#142](https://github.com/datagouv/hydra/pull/142) and [#144](https://github.com/datagouv/hydra/pull/144)
- Update resource statuses in DB when crawling and analysing, and add resource status route [#119](https://github.com/datagouv/hydra/pull/119)
- Simplify `save_as_parquet` method, and fix type not compatible with Python 3.9; remove unused import [#156](https://github.com/datagouv/hydra/pull/156)
- Fix and simplify project metadata loading [#157](https://github.com/datagouv/hydra/pull/157)
- Manage large resources exceptions differently [#148](https://github.com/datagouv/hydra/pull/148)

## 1.0.1 (2023-01-04)
Expand Down
14 changes: 4 additions & 10 deletions udata_hydra/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import importlib.metadata
import logging
import os
from pathlib import Path
Expand All @@ -15,7 +16,6 @@ class Configurator:
def __init__(self):
if not self.configuration:
self.configure()
self.load_pyproject_info()

def configure(self) -> None:
# load default settings
Expand All @@ -29,15 +29,9 @@ def configure(self) -> None:
self.configuration = configuration
self.check()

def load_pyproject_info(self) -> None:
"""Get more info about the app from pyproject.toml"""
project_info: dict = {}
try:
project_info = toml.load("pyproject.toml")["project"]
except Exception as e:
log.error(f"Error while getting pyproject.toml info: {str(e)}")
self.configuration["APP_NAME"] = project_info.get("name", "udata-hydra")
self.configuration["APP_VERSION"] = project_info.get("version", "unknown")
# add project metadata to config
self.configuration["APP_NAME"] = "udata-hydra"
self.configuration["APP_VERSION"] = importlib.metadata.version("udata-hydra")

def override(self, **kwargs) -> None:
self.configuration.update(kwargs)
Expand Down

0 comments on commit 7041ed0

Please sign in to comment.