altasigma 3.11.2__tar.gz → 3.12.0.dev0__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 (38) hide show
  1. altasigma-3.12.0.dev0/LICENSE +19 -0
  2. {altasigma-3.11.2/altasigma.egg-info → altasigma-3.12.0.dev0}/PKG-INFO +3 -3
  3. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/credentials/credential_utils.py +38 -0
  4. altasigma-3.12.0.dev0/altasigma/git_helper.py +82 -0
  5. {altasigma-3.11.2 → altasigma-3.12.0.dev0/altasigma.egg-info}/PKG-INFO +3 -3
  6. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma.egg-info/SOURCES.txt +2 -0
  7. altasigma-3.12.0.dev0/altasigma.egg-info/entry_points.txt +2 -0
  8. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/setup.py +8 -3
  9. altasigma-3.11.2/LICENSE +0 -2
  10. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/MANIFEST.in +0 -0
  11. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/README_pypi.md +0 -0
  12. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/__init__.py +0 -0
  13. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/config/__init__.py +0 -0
  14. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/config/config.py +0 -0
  15. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/config/http_session.py +0 -0
  16. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/credentials/__init__.py +0 -0
  17. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/credentials/token_refresher.py +0 -0
  18. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/initialize.py +0 -0
  19. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/io/__init__.py +0 -0
  20. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/io/augurdata.py +0 -0
  21. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/io/data_management.py +0 -0
  22. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/io/files.py +0 -0
  23. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/__init__.py +0 -0
  24. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_abstract.py +0 -0
  25. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_dev_mock.py +0 -0
  26. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_helpers.py +0 -0
  27. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_http.py +0 -0
  28. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/reports.py +0 -0
  29. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/progress_reporter/__init__.py +0 -0
  30. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/progress_reporter/progress_reporter.py +0 -0
  31. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/spark_session/__init__.py +0 -0
  32. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/spark_session/spark_session_util.py +0 -0
  33. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/utils/__init__.py +0 -0
  34. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma/utils/notebook.py +0 -0
  35. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma.egg-info/dependency_links.txt +0 -0
  36. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma.egg-info/requires.txt +0 -0
  37. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/altasigma.egg-info/top_level.txt +0 -0
  38. {altasigma-3.11.2 → altasigma-3.12.0.dev0}/setup.cfg +0 -0
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2025 AltaSigma GmbH
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ IN THE SOFTWARE.
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: altasigma
3
- Version: 3.11.2
3
+ Version: 3.12.0.dev0
4
4
  Summary: Python helpers for data science and ML workflows on the AltaSigma AI platform
5
5
  Home-page: https://www.altasigma.com
6
6
  Author: AltaSigma GmbH
7
7
  Author-email: pypi@altasigma.com
8
- License: Proprietary
9
- Classifier: License :: Other/Proprietary License
8
+ License: MIT
9
+ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
@@ -146,6 +146,44 @@ class CredentialUtils:
146
146
  raise Exception(
147
147
  f"ERROR: Unexpected response from dataman: {data_sources_request.status_code}, {data_sources_request.text}")
148
148
 
149
+ def get_git_credentials(self, host: str) -> tuple[str, str, str]:
150
+ """
151
+ Retrieve Gitea credentials for a given host from the AltaSigma dashboard.
152
+
153
+ Acquires a Keycloak bearer via the same token flow as `get_credentials`,
154
+ then asks the dashboard for the per-user Gitea username/password bound to
155
+ the requested host.
156
+
157
+ Args:
158
+ host (str): The git host the user wants credentials for (e.g. "gitea.altasigma.internal").
159
+
160
+ Returns:
161
+ tuple: (username, password, expiresAt)
162
+
163
+ Raises:
164
+ Exception: If the user has not connected the given git host in the dashboard (404),
165
+ or if the dashboard returns any other non-2xx status.
166
+ """
167
+ (access_token, _refresh_token) = self._existing_token()
168
+ headers = {'Authorization': f'Bearer {access_token}'}
169
+
170
+ url = f'{self.dashboard_api_host}/git/{host}/credentials'
171
+ response = _http_session().get(url, headers=headers)
172
+
173
+ if response.status_code == 200:
174
+ res = response.json()
175
+ display_or_print(
176
+ msg_notebook=HTML("Successfully obtained git credentials"),
177
+ msg_other="Successfully obtained git credentials")
178
+ return res["username"], res["password"], res["expiresAt"]
179
+ elif response.status_code == 404:
180
+ raise Exception(
181
+ f"Git host '{host}' is not connected in the AltaSigma dashboard. "
182
+ f"Connect Gitea under Account → Integrations and retry.")
183
+ else:
184
+ raise Exception(
185
+ f"ERROR: Unexpected response from dashboard: {response.status_code}, {response.text}")
186
+
149
187
  def _refresh_token(self, refresh_token: str) -> tuple[str, str]:
150
188
  """
151
189
  Refresh an existing authentication token.
@@ -0,0 +1,82 @@
1
+ """
2
+ Git credential helper for the AltaSigma workbench.
3
+
4
+ Implements the git-credential-helper protocol (see `gitcredentials(7)`) so that
5
+ git can authenticate against per-user Gitea hosts using credentials fetched on
6
+ demand from the AltaSigma dashboard.
7
+
8
+ Installed as the console script `git-credential-altasigma`. Once a user runs
9
+ `git config credential.helper altasigma`, git will resolve that to this script
10
+ on PATH and invoke it with `get`, `store`, or `erase` subcommands.
11
+
12
+ Stdout is reserved exclusively for the two `username=...` / `password=...` lines
13
+ that git expects on success. Everything else (logs, errors) goes to stderr, and
14
+ any failure exits non-zero with empty stdout so git treats it as "no credentials"
15
+ and aborts cleanly.
16
+ """
17
+ import logging
18
+ import sys
19
+
20
+ from altasigma import CredentialUtils
21
+
22
+ logging.basicConfig(
23
+ stream=sys.stderr,
24
+ level=logging.WARNING,
25
+ format="%(levelname)s %(name)s: %(message)s",
26
+ )
27
+ logging.getLogger("urllib3").setLevel(logging.WARNING)
28
+ logging.getLogger("requests").setLevel(logging.WARNING)
29
+ logger = logging.getLogger(__name__)
30
+
31
+
32
+ def _parse_git_input(stream) -> dict:
33
+ """Parse git's credential-helper key=value stdin format into a dict.
34
+
35
+ Per gitcredentials(7), input is a sequence of `key=value` lines terminated
36
+ by a blank line. We tolerate EOF in place of the blank line.
37
+ """
38
+ fields = {}
39
+ for raw_line in stream:
40
+ line = raw_line.rstrip("\n").rstrip("\r")
41
+ if line == "":
42
+ break
43
+ key, sep, value = line.partition("=")
44
+ if sep != "=":
45
+ continue
46
+ fields[key] = value
47
+ return fields
48
+
49
+
50
+ def main() -> int:
51
+ if len(sys.argv) != 2:
52
+ logger.error("expected exactly one subcommand (get/store/erase)")
53
+ return 1
54
+
55
+ subcommand = sys.argv[1]
56
+
57
+ if subcommand in ("store", "erase"):
58
+ return 0
59
+
60
+ if subcommand != "get":
61
+ logger.error("unknown subcommand: %s", subcommand)
62
+ return 1
63
+
64
+ fields = _parse_git_input(sys.stdin)
65
+ host = fields.get("host")
66
+ if not host:
67
+ logger.error("git credential request missing required 'host' field")
68
+ return 1
69
+
70
+ try:
71
+ username, password, _expires_at = CredentialUtils().get_git_credentials(host)
72
+ except Exception as exc:
73
+ logger.error("failed to obtain git credentials for host %s: %s", host, exc)
74
+ return 1
75
+
76
+ sys.stdout.write(f"username={username}\n")
77
+ sys.stdout.write(f"password={password}\n")
78
+ return 0
79
+
80
+
81
+ if __name__ == "__main__":
82
+ sys.exit(main())
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: altasigma
3
- Version: 3.11.2
3
+ Version: 3.12.0.dev0
4
4
  Summary: Python helpers for data science and ML workflows on the AltaSigma AI platform
5
5
  Home-page: https://www.altasigma.com
6
6
  Author: AltaSigma GmbH
7
7
  Author-email: pypi@altasigma.com
8
- License: Proprietary
9
- Classifier: License :: Other/Proprietary License
8
+ License: MIT
9
+ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
@@ -3,10 +3,12 @@ MANIFEST.in
3
3
  README_pypi.md
4
4
  setup.py
5
5
  altasigma/__init__.py
6
+ altasigma/git_helper.py
6
7
  altasigma/initialize.py
7
8
  altasigma.egg-info/PKG-INFO
8
9
  altasigma.egg-info/SOURCES.txt
9
10
  altasigma.egg-info/dependency_links.txt
11
+ altasigma.egg-info/entry_points.txt
10
12
  altasigma.egg-info/requires.txt
11
13
  altasigma.egg-info/top_level.txt
12
14
  altasigma/config/__init__.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ git-credential-altasigma = altasigma.git_helper:main
@@ -2,22 +2,27 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="altasigma",
5
- version="3.11.2",
5
+ version="3.12.0-dev0",
6
6
  author="AltaSigma GmbH",
7
7
  author_email="pypi@altasigma.com",
8
8
  packages=find_packages(exclude=['altasigma.test', 'altasigma.test.*']),
9
9
  url="https://www.altasigma.com",
10
- license="Proprietary",
10
+ license="MIT",
11
11
  description="Python helpers for data science and ML workflows on the AltaSigma AI platform",
12
12
  long_description=open("README_pypi.md").read(),
13
13
  long_description_content_type="text/markdown",
14
14
  python_requires=">=3.10",
15
15
  classifiers=[
16
- "License :: Other/Proprietary License",
16
+ "License :: OSI Approved :: MIT License",
17
17
  "Programming Language :: Python :: 3",
18
18
  "Programming Language :: Python :: 3.10",
19
19
  "Programming Language :: Python :: 3.11",
20
20
  ],
21
+ entry_points={
22
+ "console_scripts": [
23
+ "git-credential-altasigma=altasigma.git_helper:main",
24
+ ],
25
+ },
21
26
  # Broadest possible ranges
22
27
  install_requires=[
23
28
  # Seems stable enough that a 3 release would probably affect us
altasigma-3.11.2/LICENSE DELETED
@@ -1,2 +0,0 @@
1
- Copyright (c) 2025 AltaSigma GmbH
2
- All rights reserved.
File without changes
File without changes