thds.core 1.33.20250409200947__py3-none-any.whl → 1.34.20250415__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.

Potentially problematic release.


This version of thds.core might be problematic. Click here for more details.

@@ -5,5 +5,6 @@ yet will not be downloaded (if non-local) until it is actually opened or unwrapp
5
5
 
6
6
  from . import serde, tree # noqa: F401
7
7
  from ._construct import from_file, from_uri, path_from_uri, register_from_uri_handler # noqa: F401
8
+ from ._construct_tree import tree_from_directory # noqa: F401
8
9
  from ._download import Downloader, register_download_handler # noqa: F401
9
10
  from .src import Source # noqa: F401
@@ -0,0 +1,18 @@
1
+ import os
2
+ import typing as ty
3
+ from pathlib import Path
4
+
5
+ from ..files import path_from_uri
6
+ from ._construct import from_file
7
+ from .tree import SourceTree
8
+
9
+
10
+ def tree_from_directory(dirpath: ty.Union[str, os.PathLike]) -> SourceTree:
11
+ path = path_from_uri(dirpath) if isinstance(dirpath, str) else Path(dirpath)
12
+
13
+ if path.exists() and not path.is_dir():
14
+ raise NotADirectoryError(f"File '{path}' is not a directory")
15
+ if not path.exists():
16
+ raise FileNotFoundError(f"Directory '{path}' not found")
17
+
18
+ return SourceTree(sources=[from_file(file) for file in path.glob("**/*") if file.is_file()])
thds/core/source/tree.py CHANGED
@@ -93,8 +93,15 @@ class SourceTree(os.PathLike):
93
93
  )
94
94
  )
95
95
  ]
96
- local_logical_root = Path(logical_root.find(map(str, local_paths), self.higher_logical_root))
97
- assert local_logical_root.is_dir()
96
+
97
+ if len(local_paths) == 1:
98
+ local_logical_root = local_paths[0].parent.resolve()
99
+ else:
100
+ local_logical_root = Path(
101
+ logical_root.find(map(str, local_paths), self.higher_logical_root)
102
+ )
103
+ assert local_logical_root.is_dir()
104
+
98
105
  if not dest_dir:
99
106
  return local_logical_root
100
107
 
@@ -1,14 +1,14 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: thds.core
3
- Version: 1.33.20250409200947
3
+ Version: 1.34.20250415
4
4
  Summary: Core utilities.
5
5
  Author-email: Trilliant Health <info@trillianthealth.com>
6
6
  License: MIT
7
7
  Project-URL: Repository, https://github.com/TrilliantHealth/trilliant-data-science
8
- Requires-Python: >=3.8
8
+ Requires-Python: >=3.9
9
9
  Description-Content-Type: text/markdown
10
- Requires-Dist: attrs >=22.2.0
11
- Requires-Dist: cattrs >=22.2.0
10
+ Requires-Dist: attrs>=22.2.0
11
+ Requires-Dist: cattrs>=22.2.0
12
12
  Requires-Dist: setuptools
13
13
  Requires-Dist: typing-extensions
14
14
 
@@ -46,12 +46,13 @@ thds/core/log/json_formatter.py,sha256=C5bRsSbAqaQqfTm88jc3mYe3vwKZZLAxET8s7_u7a
46
46
  thds/core/log/kw_formatter.py,sha256=9-MVOd2r5NEkYNne9qWyFMeR5lac3w7mjHXsDa681i0,3379
47
47
  thds/core/log/kw_logger.py,sha256=CyZVPnkUMtrUL2Lyk261AIEPmoP-buf_suFAhQlU1io,4063
48
48
  thds/core/log/logfmt.py,sha256=i66zoG2oERnE1P_0TVXdlfJ1YgUmvtMjqRtdV5u2SvU,10366
49
- thds/core/source/__init__.py,sha256=RiaUHNunoaw4XJUrwR5vJzSS6HGxOUKUONR_ipX5654,424
49
+ thds/core/source/__init__.py,sha256=0Zy3mwJgwLtc4jq14Cwu6d_Rq-aZOMIlu4zaADeKgmo,487
50
50
  thds/core/source/_construct.py,sha256=plSyQZRe8h0X7PpbfMjhm1qkFgrcyuSrReyWQo28YfA,3121
51
+ thds/core/source/_construct_tree.py,sha256=5Zk3a5a0uVxklWw6q4JOvI_bErqwlBngUz4TyEAWn1g,616
51
52
  thds/core/source/_download.py,sha256=pUhkphHdB7y4ZpxZZ6ITIS5giXMHuRf420yYAJwx6aE,2924
52
53
  thds/core/source/serde.py,sha256=wXCfuv_Dv3QvJJr-uebGmTrfhCU_1a8VX3VJnXhVHfU,3539
53
54
  thds/core/source/src.py,sha256=9A_8kSBUc5k6OLAYe5EW_VogpXFIqofow7Rxl8xv-eg,4559
54
- thds/core/source/tree.py,sha256=vjAqnQXGE0XiI0WvlLyXGqEAZbyjq6XmdUeWAR0HI4M,4144
55
+ thds/core/source/tree.py,sha256=iNCoCE655MwXQwc2Y0IIm1HMVk5Inj0NGVU9U8Wl_90,4317
55
56
  thds/core/sqlite/__init__.py,sha256=tDMzuO76qTtckJHldPQ6nPZ6kcvhhoJrVuuW42JtaSQ,606
56
57
  thds/core/sqlite/connect.py,sha256=l4QaSAI8RjP7Qh2FjmJ3EwRgfGf65Z3-LjtC9ocHM_U,977
57
58
  thds/core/sqlite/copy.py,sha256=y3IRQTBrWDfKuVIfW7fYuEgwRCRKHjN0rxVFkIb9VrQ,1155
@@ -67,8 +68,8 @@ thds/core/sqlite/structured.py,sha256=SvZ67KcVcVdmpR52JSd52vMTW2ALUXmlHEeD-VrzWV
67
68
  thds/core/sqlite/types.py,sha256=oUkfoKRYNGDPZRk29s09rc9ha3SCk2SKr_K6WKebBFs,1308
68
69
  thds/core/sqlite/upsert.py,sha256=BmKK6fsGVedt43iY-Lp7dnAu8aJ1e9CYlPVEQR2pMj4,5827
69
70
  thds/core/sqlite/write.py,sha256=z0219vDkQDCnsV0WLvsj94keItr7H4j7Y_evbcoBrWU,3458
70
- thds_core-1.33.20250409200947.dist-info/METADATA,sha256=vLS8ThQmppWpX0I_NbVG_SB2Z46p94paU7clk7BVklU,2277
71
- thds_core-1.33.20250409200947.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
72
- thds_core-1.33.20250409200947.dist-info/entry_points.txt,sha256=bOCOVhKZv7azF3FvaWX6uxE6yrjK6FcjqhtxXvLiFY8,161
73
- thds_core-1.33.20250409200947.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
74
- thds_core-1.33.20250409200947.dist-info/RECORD,,
71
+ thds_core-1.34.20250415.dist-info/METADATA,sha256=hKvrKssYHF18xNzWH5gB_RvxAZo583s5eqstHJeoNfw,2269
72
+ thds_core-1.34.20250415.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
73
+ thds_core-1.34.20250415.dist-info/entry_points.txt,sha256=bOCOVhKZv7azF3FvaWX6uxE6yrjK6FcjqhtxXvLiFY8,161
74
+ thds_core-1.34.20250415.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
75
+ thds_core-1.34.20250415.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.2)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5