datashare-python 0.2.20__py3-none-any.whl → 0.2.22__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.
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import shutil
2
3
  import tarfile
3
4
  from copy import deepcopy
4
5
  from importlib.resources import as_file, files
@@ -48,14 +49,17 @@ def build_template_tarball() -> None:
48
49
  def init_project(name: str, path: Path) -> None:
49
50
  destination = path / name
50
51
  template_tar = files("datashare_python")
52
+ package_name = name.replace("-", "_").lower()
51
53
  with (
52
54
  as_file(template_tar / "worker-template.tar.gz") as tar_path,
53
55
  tarfile.open(tar_path, mode="r:gz") as tar,
54
56
  ):
55
57
  tar.extractall(destination)
58
+ package_dir = destination / package_name
59
+ shutil.move(destination / "worker_template", package_dir)
56
60
  pyproject_toml_path = destination / "pyproject.toml"
57
61
  pyproject_toml = tomlkit.loads(pyproject_toml_path.read_text())
58
- pyproject_toml = _update_pyproject_toml(pyproject_toml, project_name=name)
62
+ pyproject_toml = _update_pyproject_toml(pyproject_toml, package_name=package_name)
59
63
  pyproject_toml_path.write_text(tomlkit.dumps(pyproject_toml))
60
64
 
61
65
 
@@ -63,10 +67,8 @@ _BASE_DEPS = {"datashare-python", "icij-common", "temporalio"}
63
67
 
64
68
 
65
69
  def _update_pyproject_toml(
66
- pyproject_toml: dict[str, Any], *, project_name: str
70
+ pyproject_toml: dict[str, Any], *, package_name: str
67
71
  ) -> dict[str, Any]:
68
- lower_snaked = project_name.replace("-", "_").lower()
69
-
70
72
  pyproject_toml = deepcopy(pyproject_toml)
71
73
 
72
74
  pyproject_toml["tool"]["uv"].pop("sources")
@@ -90,13 +92,17 @@ def _update_pyproject_toml(
90
92
  entry_points = project["entry-points"]
91
93
 
92
94
  wf_entry_point = entry_points["datashare.workflows"]["workflows"]
93
- wf_entry_point = wf_entry_point.replace("worker_template", lower_snaked)
95
+ wf_entry_point = wf_entry_point.replace("worker_template", package_name)
94
96
  entry_points["datashare.workflows"]["workflows"] = wf_entry_point
95
97
 
96
98
  activities_entry_point = entry_points["datashare.activities"]["activities"]
97
99
  activities_entry_point = activities_entry_point.replace(
98
- "worker_template", lower_snaked
100
+ "worker_template", package_name
99
101
  )
100
102
  entry_points["datashare.activities"]["activities"] = activities_entry_point
103
+ hatch_sdist = pyproject_toml["tool"]["hatch"]["build"]["targets"]["wheel"]
104
+ hatch_sdist["packages"] = [
105
+ i if i != "worker_template" else package_name for i in hatch_sdist["packages"]
106
+ ]
101
107
 
102
108
  return pyproject_toml
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datashare-python
3
- Version: 0.2.20
3
+ Version: 0.2.22
4
4
  Summary: Manage Pythoœn tasks and local resources in Datashare
5
5
  Project-URL: Homepage, https://icij.github.io/datashare-python/
6
6
  Project-URL: Documentation, https://icij.github.io/datashare-python/
@@ -10,10 +10,10 @@ datashare_python/exceptions.py,sha256=bVHEAXxDPKfxeeMC0hJXEsrJkgsKO2ESAhxWU96GA4
10
10
  datashare_python/local_client.py,sha256=GP9MTcHVQ1mcb2eO6TiQ7mzQdx199lZRhK8DRuJqJVQ,2359
11
11
  datashare_python/objects.py,sha256=UDc9PDaSXADLgmnfvqGBrDTmPVL-rRpyNHvY277-1x8,4147
12
12
  datashare_python/task_client.py,sha256=oTmP8bvZW0UyhLNMi1AV3XIAx7hrdbxNRss2Mw2azEc,8435
13
- datashare_python/template.py,sha256=esOppyXgVvWt2FexMVOdndddPVIR6j168dD39qMRwRY,3402
13
+ datashare_python/template.py,sha256=pamdaqnj3r00MESNLZuB7gCETylU_I42T7qo88607v8,3726
14
14
  datashare_python/types_.py,sha256=9Hk1XqpdXbM1TnEzwvJ5G9ABbaCZW9KgBTtiPBVn_7k,649
15
15
  datashare_python/utils.py,sha256=mFegsYFoIRzRtPhx12748qrahe-c0rKNx02-r8tTG8Q,12777
16
- datashare_python/worker-template.tar.gz,sha256=NtHCgIz6TUNBgJCPQRb5J04le32PgVPR5I4o7EszjjQ,142445
16
+ datashare_python/worker-template.tar.gz,sha256=amYr83agrHKIj9ymiF6PbV1XVN7CD09qwCavvxG21qY,142859
17
17
  datashare_python/worker.py,sha256=E1cECV0q2XcGI234gZZ5eBvqeULlTK0FUb0VSWkRQUI,2924
18
18
  datashare_python/cli/__init__.py,sha256=5MGSE_0SwlOiwbyPwsP8RIXlTBB2_GGP0zDg4l6UAIY,1479
19
19
  datashare_python/cli/local.py,sha256=S-7qMpSqzi0oMvu01TCFEb8tayEvpw4pXMdCszKEYtU,986
@@ -21,7 +21,7 @@ datashare_python/cli/project.py,sha256=w32Gy9AOL5B00uDT4in7YUCt2g68FnNbvwg2M3a8G
21
21
  datashare_python/cli/task.py,sha256=9If5OC7loG4C4gWWl4iOeqPJ4GOLlCWXQfuNLUHORrQ,5860
22
22
  datashare_python/cli/utils.py,sha256=p69CQb0zfixuyBkiZprhdMCc_NuYwXyAn6vC9H1UzAw,911
23
23
  datashare_python/cli/worker.py,sha256=lmxeZDhLbGb-98XplCERN3R3Yo-sU0UkhO7KIo9Zbo4,4401
24
- datashare_python-0.2.20.dist-info/METADATA,sha256=kmwue8v3rDgYRG-NYwr4vEFE6X9L39FkqiMNeGIwupw,959
25
- datashare_python-0.2.20.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
26
- datashare_python-0.2.20.dist-info/entry_points.txt,sha256=ILE7auxabHWiu3GC-AunWnzjhOI_SbZp7D4GqZHlLw4,68
27
- datashare_python-0.2.20.dist-info/RECORD,,
24
+ datashare_python-0.2.22.dist-info/METADATA,sha256=fvWeOHnHN3gkX7uYAYk6iDAQYL66eJGR26sZaCAKlJ8,959
25
+ datashare_python-0.2.22.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
26
+ datashare_python-0.2.22.dist-info/entry_points.txt,sha256=ILE7auxabHWiu3GC-AunWnzjhOI_SbZp7D4GqZHlLw4,68
27
+ datashare_python-0.2.22.dist-info/RECORD,,