datashare-python 0.2.19__tar.gz → 0.2.21__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 (28) hide show
  1. {datashare_python-0.2.19 → datashare_python-0.2.21}/PKG-INFO +1 -1
  2. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/template.py +19 -7
  3. datashare_python-0.2.21/datashare_python/worker-template.tar.gz +0 -0
  4. {datashare_python-0.2.19 → datashare_python-0.2.21}/pyproject.toml +2 -2
  5. datashare_python-0.2.19/datashare_python/worker-template.tar.gz +0 -0
  6. {datashare_python-0.2.19 → datashare_python-0.2.21}/.gitignore +0 -0
  7. {datashare_python-0.2.19 → datashare_python-0.2.21}/README.md +0 -0
  8. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/.gitignore +0 -0
  9. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/__init__.py +0 -0
  10. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/__main__.py +0 -0
  11. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/cli/__init__.py +0 -0
  12. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/cli/local.py +0 -0
  13. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/cli/project.py +0 -0
  14. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/cli/task.py +0 -0
  15. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/cli/utils.py +0 -0
  16. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/cli/worker.py +0 -0
  17. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/config.py +0 -0
  18. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/conftest.py +0 -0
  19. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/constants.py +0 -0
  20. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/dependencies.py +0 -0
  21. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/discovery.py +0 -0
  22. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/exceptions.py +0 -0
  23. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/local_client.py +0 -0
  24. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/objects.py +0 -0
  25. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/task_client.py +0 -0
  26. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/types_.py +0 -0
  27. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/utils.py +0 -0
  28. {datashare_python-0.2.19 → datashare_python-0.2.21}/datashare_python/worker.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datashare-python
3
- Version: 0.2.19
3
+ Version: 0.2.21
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/
@@ -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
@@ -22,7 +23,11 @@ ALLOWED_EXTS = {
22
23
 
23
24
  class CopyTemplateHook(BuildHookInterface):
24
25
  def initialize(self, version: str, build_data: dict[str, Any]) -> None: # noqa: ARG002
25
- build_template_tarball()
26
+ # Only generate the worker template when building the sources,
27
+ # the wheel is then generated from this first build
28
+ if self.target_name == "sdist":
29
+ build_template_tarball()
30
+ build_data["artifacts"].append("datashare_python/worker-template.tar.gz")
26
31
 
27
32
 
28
33
  def build_template_tarball() -> None:
@@ -44,14 +49,17 @@ def build_template_tarball() -> None:
44
49
  def init_project(name: str, path: Path) -> None:
45
50
  destination = path / name
46
51
  template_tar = files("datashare_python")
52
+ package_name = name.replace("-", "_").lower()
47
53
  with (
48
54
  as_file(template_tar / "worker-template.tar.gz") as tar_path,
49
55
  tarfile.open(tar_path, mode="r:gz") as tar,
50
56
  ):
51
57
  tar.extractall(destination)
58
+ package_dir = destination / package_name
59
+ shutil.move(destination / "worker_template", package_dir)
52
60
  pyproject_toml_path = destination / "pyproject.toml"
53
61
  pyproject_toml = tomlkit.loads(pyproject_toml_path.read_text())
54
- pyproject_toml = _update_pyproject_toml(pyproject_toml, project_name=name)
62
+ pyproject_toml = _update_pyproject_toml(pyproject_toml, package_name=package_name)
55
63
  pyproject_toml_path.write_text(tomlkit.dumps(pyproject_toml))
56
64
 
57
65
 
@@ -59,10 +67,8 @@ _BASE_DEPS = {"datashare-python", "icij-common", "temporalio"}
59
67
 
60
68
 
61
69
  def _update_pyproject_toml(
62
- pyproject_toml: dict[str, Any], *, project_name: str
70
+ pyproject_toml: dict[str, Any], *, package_name: str
63
71
  ) -> dict[str, Any]:
64
- lower_snaked = project_name.replace("-", "_").lower()
65
-
66
72
  pyproject_toml = deepcopy(pyproject_toml)
67
73
 
68
74
  pyproject_toml["tool"]["uv"].pop("sources")
@@ -86,13 +92,19 @@ def _update_pyproject_toml(
86
92
  entry_points = project["entry-points"]
87
93
 
88
94
  wf_entry_point = entry_points["datashare.workflows"]["workflows"]
89
- wf_entry_point = wf_entry_point.replace("worker_template", lower_snaked)
95
+ wf_entry_point = wf_entry_point.replace("worker_template", package_name)
90
96
  entry_points["datashare.workflows"]["workflows"] = wf_entry_point
91
97
 
92
98
  activities_entry_point = entry_points["datashare.activities"]["activities"]
93
99
  activities_entry_point = activities_entry_point.replace(
94
- "worker_template", lower_snaked
100
+ "worker_template", package_name
95
101
  )
96
102
  entry_points["datashare.activities"]["activities"] = activities_entry_point
97
103
 
104
+ hatch_sdist = pyproject_toml["tool"]["hatch"]["build"]["targets"]["sdist"]
105
+ hatch_sdist["only-include"] = [
106
+ i if i != "worker_template" else package_name
107
+ for i in hatch_sdist["only-include"]
108
+ ]
109
+
98
110
  return pyproject_toml
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "datashare-python"
3
- version = "0.2.19"
3
+ version = "0.2.21"
4
4
  description = "Manage Pythoœn tasks and local resources in Datashare"
5
5
  authors = [
6
6
  { name = "Clément Doumouro", email = "cdoumouro@icij.org" },
@@ -47,7 +47,7 @@ only-include = ["datashare_python"]
47
47
 
48
48
  [tool.hatch.build.targets.wheel]
49
49
  artifacts = [
50
- "worker-template.tar.gz"
50
+ "datashare_python/worker-template.tar.gz"
51
51
  ]
52
52
 
53
53