hafnia 0.1.18__tar.gz → 0.1.23__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 (61) hide show
  1. hafnia-0.1.18/.github/workflows/publish_release.yaml → hafnia-0.1.23/.github/workflows/check_release.yaml +22 -6
  2. {hafnia-0.1.18 → hafnia-0.1.23}/.github/workflows/ci_cd.yaml +25 -25
  3. {hafnia-0.1.18 → hafnia-0.1.23}/.pre-commit-config.yaml +6 -1
  4. {hafnia-0.1.18 → hafnia-0.1.23}/PKG-INFO +2 -2
  5. {hafnia-0.1.18 → hafnia-0.1.23}/README.md +1 -1
  6. {hafnia-0.1.18 → hafnia-0.1.23}/pyproject.toml +1 -1
  7. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/platform/experiment.py +1 -0
  8. {hafnia-0.1.18 → hafnia-0.1.23}/uv.lock +1210 -1210
  9. {hafnia-0.1.18 → hafnia-0.1.23}/.devcontainer/devcontainer.json +0 -0
  10. {hafnia-0.1.18 → hafnia-0.1.23}/.devcontainer/hooks/post_create +0 -0
  11. {hafnia-0.1.18 → hafnia-0.1.23}/.github/dependabot.yaml +0 -0
  12. {hafnia-0.1.18 → hafnia-0.1.23}/.github/workflows/Dockerfile +0 -0
  13. {hafnia-0.1.18 → hafnia-0.1.23}/.github/workflows/build.yaml +0 -0
  14. {hafnia-0.1.18 → hafnia-0.1.23}/.github/workflows/lint.yaml +0 -0
  15. {hafnia-0.1.18 → hafnia-0.1.23}/.github/workflows/publish_docker.yaml +0 -0
  16. {hafnia-0.1.18 → hafnia-0.1.23}/.github/workflows/publish_pypi.yaml +0 -0
  17. {hafnia-0.1.18 → hafnia-0.1.23}/.github/workflows/tests.yaml +0 -0
  18. {hafnia-0.1.18 → hafnia-0.1.23}/.gitignore +0 -0
  19. {hafnia-0.1.18 → hafnia-0.1.23}/.python-version +0 -0
  20. {hafnia-0.1.18 → hafnia-0.1.23}/.vscode/extensions.json +0 -0
  21. {hafnia-0.1.18 → hafnia-0.1.23}/.vscode/launch.json +0 -0
  22. {hafnia-0.1.18 → hafnia-0.1.23}/.vscode/settings.json +0 -0
  23. {hafnia-0.1.18 → hafnia-0.1.23}/LICENSE +0 -0
  24. {hafnia-0.1.18 → hafnia-0.1.23}/docs/cli.md +0 -0
  25. {hafnia-0.1.18 → hafnia-0.1.23}/docs/release.md +0 -0
  26. {hafnia-0.1.18 → hafnia-0.1.23}/docs/s2m.md +0 -0
  27. {hafnia-0.1.18 → hafnia-0.1.23}/examples/dataset_builder.py +0 -0
  28. {hafnia-0.1.18 → hafnia-0.1.23}/examples/example_load_dataset.py +0 -0
  29. {hafnia-0.1.18 → hafnia-0.1.23}/examples/example_logger.py +0 -0
  30. {hafnia-0.1.18 → hafnia-0.1.23}/examples/example_torchvision_dataloader.py +0 -0
  31. {hafnia-0.1.18 → hafnia-0.1.23}/examples/script2model/pytorch/Dockerfile +0 -0
  32. {hafnia-0.1.18 → hafnia-0.1.23}/examples/script2model/pytorch/src/lib/train_utils.py +0 -0
  33. {hafnia-0.1.18 → hafnia-0.1.23}/examples/script2model/pytorch/src/scripts/train.py +0 -0
  34. {hafnia-0.1.18 → hafnia-0.1.23}/src/cli/__init__.py +0 -0
  35. {hafnia-0.1.18 → hafnia-0.1.23}/src/cli/__main__.py +0 -0
  36. {hafnia-0.1.18 → hafnia-0.1.23}/src/cli/config.py +0 -0
  37. {hafnia-0.1.18 → hafnia-0.1.23}/src/cli/consts.py +0 -0
  38. {hafnia-0.1.18 → hafnia-0.1.23}/src/cli/data_cmds.py +0 -0
  39. {hafnia-0.1.18 → hafnia-0.1.23}/src/cli/experiment_cmds.py +0 -0
  40. {hafnia-0.1.18 → hafnia-0.1.23}/src/cli/profile_cmds.py +0 -0
  41. {hafnia-0.1.18 → hafnia-0.1.23}/src/cli/runc_cmds.py +0 -0
  42. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/__init__.py +0 -0
  43. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/data/__init__.py +0 -0
  44. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/data/factory.py +0 -0
  45. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/experiment/__init__.py +0 -0
  46. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/experiment/hafnia_logger.py +0 -0
  47. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/http.py +0 -0
  48. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/log.py +0 -0
  49. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/platform/__init__.py +0 -0
  50. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/platform/api.py +0 -0
  51. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/platform/builder.py +0 -0
  52. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/platform/download.py +0 -0
  53. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/platform/executor.py +0 -0
  54. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/torch_helpers.py +0 -0
  55. {hafnia-0.1.18 → hafnia-0.1.23}/src/hafnia/utils.py +0 -0
  56. {hafnia-0.1.18 → hafnia-0.1.23}/tests/test_builder.py +0 -0
  57. {hafnia-0.1.18 → hafnia-0.1.23}/tests/test_check_example_scripts.py +0 -0
  58. {hafnia-0.1.18 → hafnia-0.1.23}/tests/test_cli.py +0 -0
  59. {hafnia-0.1.18 → hafnia-0.1.23}/tests/test_executor.py +0 -0
  60. {hafnia-0.1.18 → hafnia-0.1.23}/tests/test_mdi_logger.py +0 -0
  61. {hafnia-0.1.18 → hafnia-0.1.23}/tests/test_samples.py +0 -0
@@ -1,17 +1,23 @@
1
- name: Build and Publish Package
1
+ name: Check Release and Publish
2
2
  on:
3
3
  workflow_call:
4
4
  inputs:
5
5
  package-version:
6
6
  required: true
7
7
  type: string
8
-
8
+ outputs:
9
+ make_release:
10
+ description: "Whether to create a new release"
11
+ value: ${{ jobs.release.outputs.make_release }}
12
+
9
13
  permissions:
10
14
  contents: write
11
15
 
12
16
  jobs:
13
17
  release:
14
18
  runs-on: ubuntu-latest
19
+ outputs:
20
+ make_release: ${{ steps.check_release.outputs.make_release }}
15
21
  steps:
16
22
  - name: Download package artifact
17
23
  uses: actions/download-artifact@v4.2.1
@@ -37,11 +43,21 @@ jobs:
37
43
  echo "Checking if release tag exists: $TAG"
38
44
 
39
45
  if gh release view "$TAG" --repo="$GITHUB_REPOSITORY" &>/dev/null; then
40
- echo "::error::Release $TAG already exists. Please increment the version number."
41
- exit 1
46
+ echo "Release $TAG already exists. Skipping release creation."
47
+ echo "make_release=false" >> $GITHUB_OUTPUT
48
+ else
49
+ echo "Release does not exist. Will create new release."
50
+ echo "make_release=true" >> $GITHUB_OUTPUT
42
51
  fi
43
- echo "Release does not exist. Will create new release."
52
+
44
53
  - name: Create GitHub Release
54
+ if: steps.check_release.outputs.make_release == 'true'
45
55
  env:
46
56
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47
- run: "TAG=\"v${{ inputs.package-version }}\"\necho \"Creating release tag: $TAG\"\n\ngh release create \"$TAG\" --repo=\"$GITHUB_REPOSITORY\" \\\n --title=\"${GITHUB_REPOSITORY#*/} ${{ inputs.package_version }}\" \\\n --generate-notes\n \n"
57
+ run: |
58
+ TAG="v${{ inputs.package-version }}"
59
+ echo "Creating release tag: $TAG"
60
+
61
+ gh release create "$TAG" --repo="$GITHUB_REPOSITORY" \
62
+ --title="${GITHUB_REPOSITORY#*/} ${{ inputs.package-version }}" \
63
+ --generate-notes
@@ -44,14 +44,6 @@ jobs:
44
44
  with:
45
45
  python-version-file: "pyproject.toml"
46
46
 
47
- publish-pypi:
48
- name: Publish Package to PyPI
49
- needs: build
50
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
51
- uses: ./.github/workflows/publish_pypi.yaml
52
- with:
53
- environment: pypi
54
-
55
47
  publish-pypi-test:
56
48
  name: Publish Package to TestPyPI
57
49
  needs: build
@@ -59,15 +51,35 @@ jobs:
59
51
  uses: ./.github/workflows/publish_pypi.yaml
60
52
  with:
61
53
  environment: testpypi
54
+
55
+ publish-docker-staging:
56
+ name: Publish Docker Image to Staging
57
+ needs: [build, publish-pypi-test]
58
+ secrets: inherit
59
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
60
+ uses: ./.github/workflows/publish_docker.yaml
61
+ with:
62
+ python-version-file: "pyproject.toml"
63
+ package-version: ${{ needs.build.outputs.package-version }}
64
+ environment: "staging"
62
65
 
63
- publish-release:
64
- name: Publish Github release
65
- needs: publish-pypi
66
+ check-release:
67
+ name: Check if Release Exists
68
+ needs: build
66
69
  if: github.event_name == 'push' && github.ref == 'refs/heads/main'
67
- uses: ./.github/workflows/publish_release.yaml
70
+ uses: ./.github/workflows/check_release.yaml
68
71
  with:
69
72
  package-version: ${{ needs.build.outputs.package-version }}
70
-
73
+
74
+ publish-pypi:
75
+ name: Publish Package to PyPI
76
+ needs: [build, check-release]
77
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.check-release.outputs.make_release == 'true'
78
+ uses: ./.github/workflows/publish_pypi.yaml
79
+ with:
80
+ environment: pypi
81
+
82
+
71
83
  publish-docker-production:
72
84
  name: Publish Docker Image to Production
73
85
  needs: [build, publish-pypi]
@@ -79,15 +91,3 @@ jobs:
79
91
  package-version: ${{ needs.build.outputs.package-version }}
80
92
  environment: "production"
81
93
 
82
-
83
- publish-docker-staging:
84
- name: Publish Docker Image to Staging
85
- needs: [build, publish-pypi-test]
86
- secrets: inherit
87
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
88
- uses: ./.github/workflows/publish_docker.yaml
89
- with:
90
- python-version-file: "pyproject.toml"
91
- package-version: ${{ needs.build.outputs.package-version }}
92
- environment: "staging"
93
-
@@ -8,4 +8,9 @@ repos:
8
8
  files: ^(src|tests)/
9
9
  - id: ruff-format
10
10
  types_or: [python, pyi]
11
- files: ^(src|tests)/
11
+ files: ^(src|tests)/
12
+ - repo: https://github.com/astral-sh/uv-pre-commit
13
+ rev: 0.6.17
14
+ hooks:
15
+ # Update the uv lockfile
16
+ - id: uv-lock
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hafnia
3
- Version: 0.1.18
3
+ Version: 0.1.23
4
4
  Summary: Python tools for communication with Hafnia platform.
5
5
  Author-email: Ivan Sahumbaiev <ivsa@milestone.dk>
6
6
  License-File: LICENSE
@@ -87,7 +87,7 @@ and explore the dataset sample with a python script:
87
87
  ```python
88
88
  from hafnia.data import load_dataset
89
89
 
90
- dataset_splits = load_dataset("midwest-vehicle-detection")
90
+ dataset_splits = load_dataset("mnist")
91
91
  print(dataset_splits)
92
92
  print(dataset_splits["train"])
93
93
  ```
@@ -65,7 +65,7 @@ and explore the dataset sample with a python script:
65
65
  ```python
66
66
  from hafnia.data import load_dataset
67
67
 
68
- dataset_splits = load_dataset("midwest-vehicle-detection")
68
+ dataset_splits = load_dataset("mnist")
69
69
  print(dataset_splits)
70
70
  print(dataset_splits["train"])
71
71
  ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hafnia"
3
- version = "0.1.18"
3
+ version = "0.1.23"
4
4
  description = "Python tools for communication with Hafnia platform."
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Ivan Sahumbaiev", email = "ivsa@milestone.dk" }]
@@ -17,6 +17,7 @@ def get_dataset_id(dataset_name: str, endpoint: str, api_key: str) -> Optional[s
17
17
 
18
18
  def create_recipe(source_dir: Path, endpoint: str, api_key: str, organization_id: str) -> Optional[str]:
19
19
  headers = {"X-APIKEY": api_key, "accept": "application/json"}
20
+ source_dir = source_dir.resolve() # Ensure the path is absolute to handle '.' paths are given an appropriate name.
20
21
  path_recipe = get_recipe_path(recipe_name=source_dir.name)
21
22
  zip_path = archive_dir(source_dir, output_path=path_recipe)
22
23