ebi-eva-common-pyutils 0.7.0__tar.gz → 0.7.2__tar.gz

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.
Files changed (47) hide show
  1. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/CHANGELOG.md +13 -0
  2. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/PKG-INFO +1 -1
  3. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/config.py +6 -0
  4. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/logger.py +22 -8
  5. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/reference/assembly.py +6 -2
  6. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils.egg-info/PKG-INFO +1 -1
  7. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils.egg-info/requires.txt +1 -1
  8. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/setup.py +6 -3
  9. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/LICENSE +0 -0
  10. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/MANIFEST.in +0 -0
  11. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/README.md +0 -0
  12. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/__init__.py +0 -0
  13. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/assembly/__init__.py +0 -0
  14. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/assembly/assembly.py +0 -0
  15. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/assembly_utils.py +0 -0
  16. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/biosamples_communicators.py +0 -0
  17. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/command_utils.py +0 -0
  18. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/common_utils.py +0 -0
  19. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/contig_alias/__init__.py +0 -0
  20. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/contig_alias/contig_alias.py +0 -0
  21. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/ena_utils.py +0 -0
  22. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/file_utils.py +0 -0
  23. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/ncbi_utils.py +0 -0
  24. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/network_utils.py +0 -0
  25. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/reference/__init__.py +0 -0
  26. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/reference/sequence.py +0 -0
  27. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/spreadsheet/__init__.py +0 -0
  28. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/spreadsheet/metadata_xlsx_utils.py +0 -0
  29. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/taxonomy/__init__.py +0 -0
  30. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/taxonomy/taxonomy.py +0 -0
  31. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/variation/__init__.py +0 -0
  32. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils/variation/contig_utils.py +0 -0
  33. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils.egg-info/SOURCES.txt +0 -0
  34. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils.egg-info/dependency_links.txt +0 -0
  35. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_common_pyutils.egg-info/top_level.txt +0 -0
  36. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/__init__.py +0 -0
  37. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/archive_directory.py +0 -0
  38. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/config_utils.py +0 -0
  39. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/metadata_utils.py +0 -0
  40. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/mongo_utils.py +0 -0
  41. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/mongodb/__init__.py +0 -0
  42. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/mongodb/mongo_database.py +0 -0
  43. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/nextflow/__init__.py +0 -0
  44. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/nextflow/nextflow_pipeline.py +0 -0
  45. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/pg_utils.py +0 -0
  46. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/ebi_eva_internal_pyutils/spring_properties.py +0 -0
  47. {ebi_eva_common_pyutils-0.7.0 → ebi_eva_common_pyutils-0.7.2}/setup.cfg +0 -0
@@ -2,6 +2,19 @@
2
2
  Changelog for ebi_eva_common_pyutils
3
3
  ===========================
4
4
 
5
+ ## 0.7.2 (2025-06-19)
6
+ ---------------------
7
+
8
+ - Enable overwrite on existing config path.
9
+ - Update lxml
10
+
11
+
12
+ ## 0.7.1 (2025-05-21)
13
+ ---------------------
14
+
15
+ - Make sure all loggers are debug by default
16
+
17
+
5
18
  ## 0.7.0 (2025-04-14)
6
19
  ----------------------
7
20
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ebi_eva_common_pyutils
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: EBI EVA - Common Python Utilities
5
5
  Home-page: https://github.com/EBIVariation/eva-common-pyutils
6
6
  License: Apache
@@ -2,6 +2,9 @@ import os
2
2
 
3
3
  import yaml
4
4
 
5
+ from ebi_eva_common_pyutils.logger import logging_config as log_cfg
6
+
7
+ logger = log_cfg.get_logger(__name__)
5
8
 
6
9
  class Configuration:
7
10
  """
@@ -120,6 +123,9 @@ class WritableConfig(Configuration):
120
123
  for p in path[:-1]:
121
124
  if p not in top_level:
122
125
  top_level[p] = {}
126
+ elif not isinstance(top_level[p], dict):
127
+ logger.warning(f'Overwriting existing config path {".".join(path)}')
128
+ top_level[p] = {}
123
129
  top_level = top_level[p]
124
130
  top_level[path[-1]] = value
125
131
 
@@ -17,17 +17,28 @@ import logging.handlers
17
17
  from sys import stdout, stderr
18
18
  from cached_property import cached_property
19
19
 
20
+ # The way Logger/Handler/Formatter works
21
+ # - Logger create the log message
22
+ # - Formatter describe what is included in the lo message
23
+ # - Handler Propagate them to where they should go (file/screen, ...)
24
+ # Logger are part of hierarchy and always have parent up to the root logger.
25
+ # The root logger is usually set to WARNING level
26
+ # When a log is emitted to a logger, the logger checks it own level and propagate to its handler.
27
+ # If it does not have any handlers it propagates to its parent (unless propagate is set to false)
28
+ #
29
+ # SPECIAL CASE: When a logger has a level set to NOTSET (0) it inherit the level from its parent
30
+
20
31
 
21
32
  class LoggingConfiguration:
22
33
  """
23
- This class provides an all in one management of all loggers in the stack. By default it pulls existing loggers,
34
+ This class provides an all in one management of all loggers in the stack. By default, it pulls existing loggers,
24
35
  stores additional ones along with handlers and formatters.
25
36
  """
26
37
 
27
38
  default_fmt = '[%(asctime)s][%(name)s][%(levelname)s] %(message)s'
28
39
  default_datefmt = '%Y-%b-%d %H:%M:%S'
29
40
 
30
- def __init__(self, use_existing_logger=True, log_level=logging.INFO):
41
+ def __init__(self, use_existing_logger=True, log_level=logging.DEBUG):
31
42
  self.blank_formatter = logging.Formatter()
32
43
  self.handlers = set()
33
44
  if use_existing_logger:
@@ -38,6 +49,8 @@ class LoggingConfiguration:
38
49
  else:
39
50
  self.loggers = {}
40
51
  self._log_level = log_level
52
+ if log_level is not None:
53
+ self.set_log_level(log_level)
41
54
 
42
55
  @cached_property
43
56
  def formatter(self):
@@ -61,8 +74,8 @@ class LoggingConfiguration:
61
74
  else:
62
75
  logger = logging.getLogger(name)
63
76
  self.loggers[name] = logger
64
-
65
- logger.setLevel(level or self._log_level)
77
+ log_level = level if level > self._log_level else self._log_level
78
+ logger.setLevel(log_level)
66
79
  for h in self.handlers:
67
80
  logger.addHandler(h)
68
81
 
@@ -74,19 +87,20 @@ class LoggingConfiguration:
74
87
  :param logging.Handler handler:
75
88
  :param int level: Log level to assign to the created handler
76
89
  """
77
- handler.setLevel(level or self._log_level)
90
+ log_level = level if level > self._log_level else self._log_level
91
+ handler.setLevel(log_level)
78
92
  handler.setFormatter(self.formatter)
79
93
  for name in self.loggers:
80
94
  self.loggers[name].addHandler(handler)
81
95
  self.handlers.add(handler)
82
96
 
83
- def add_stdout_handler(self, level=None):
97
+ def add_stdout_handler(self, level=logging.INFO):
84
98
  self.add_handler(logging.StreamHandler(stdout), level=level or self._log_level)
85
99
 
86
- def add_stderr_handler(self, level=None):
100
+ def add_stderr_handler(self, level=logging.INFO):
87
101
  self.add_handler(logging.StreamHandler(stderr), level=level or self._log_level)
88
102
 
89
- def add_file_handler(self, filename, level=None):
103
+ def add_file_handler(self, filename, level=logging.INFO):
90
104
  self.add_handler(logging.FileHandler(filename=filename), level=level or self._log_level)
91
105
 
92
106
  def set_log_level(self, level):
@@ -236,8 +236,12 @@ class NCBIAssembly(AppLogger):
236
236
  urllib.request.urlretrieve(url, output_file)
237
237
 
238
238
  def download_or_construct(self, genbank_only=False, overwrite=False):
239
- """First download the assembly report and fasta from the FTP, then append any missing contig from
240
- the assembly report to the assembly fasta."""
239
+ """
240
+ First download the assembly report and fasta from the FTP, then append any missing contig from
241
+ the assembly report to the assembly fasta.
242
+ Setting genbank_only = True ensure that only contigs that have genbank accession will be added to the assembly fasta.
243
+ Setting overwrite = True delete any existing fasta file and assembly report. then download them again.
244
+ """
241
245
  self.download_assembly_report(overwrite)
242
246
  try:
243
247
  self.download_assembly_fasta(overwrite)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ebi-eva-common-pyutils
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: EBI EVA - Common Python Utilities
5
5
  Home-page: https://github.com/EBIVariation/eva-common-pyutils
6
6
  License: Apache
@@ -1,5 +1,5 @@
1
1
  requests==2.*
2
- lxml==4.*,>4.9
2
+ lxml==5.*
3
3
  pyyaml==6.*
4
4
  cached-property==1.5.*
5
5
  retry==0.*,>0.9
@@ -1,19 +1,22 @@
1
1
  import os
2
2
  from distutils.core import setup
3
+ from os.path import abspath, dirname, join
3
4
 
4
5
  from setuptools import find_packages
6
+ base_dir = abspath(dirname(__file__))
7
+ requirements_txt = join(base_dir, 'requirements.txt')
8
+ requirements = [l.strip() for l in open(requirements_txt) if l and not l.startswith('#')]
5
9
 
6
10
  setup(
7
11
  name='ebi_eva_common_pyutils',
8
12
  scripts=[os.path.join(os.path.dirname(__file__), 'ebi_eva_internal_pyutils', 'archive_directory.py')],
9
13
  packages=find_packages(),
10
- version='0.7.0',
14
+ version='0.7.2',
11
15
  license='Apache',
12
16
  description='EBI EVA - Common Python Utilities',
13
17
  url='https://github.com/EBIVariation/eva-common-pyutils',
14
18
  keywords=['EBI', 'EVA', 'PYTHON', 'UTILITIES'],
15
- install_requires=['requests==2.*', 'lxml>4.9,==4.*', 'pyyaml==6.*', 'cached-property==1.5.*', 'retry>0.9,==0.*',
16
- 'openpyxl==3.*'],
19
+ install_requires=requirements,
17
20
  extras_require={'eva-internal': ['psycopg2-binary', 'pymongo', 'networkx<=2.5']},
18
21
  classifiers=[
19
22
  'Development Status :: 5 - Production/Stable',