altasigma 3.12.0__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.
- {altasigma-3.12.0/altasigma.egg-info → altasigma-3.12.0.dev0}/PKG-INFO +1 -1
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/credentials/credential_utils.py +38 -0
- altasigma-3.12.0.dev0/altasigma/git_helper.py +82 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0/altasigma.egg-info}/PKG-INFO +1 -1
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma.egg-info/SOURCES.txt +2 -0
- altasigma-3.12.0.dev0/altasigma.egg-info/entry_points.txt +2 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/setup.py +6 -1
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/LICENSE +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/MANIFEST.in +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/README_pypi.md +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/__init__.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/config/__init__.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/config/config.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/config/http_session.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/credentials/__init__.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/credentials/token_refresher.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/initialize.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/io/__init__.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/io/augurdata.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/io/data_management.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/io/files.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/__init__.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_abstract.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_dev_mock.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_helpers.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_http.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/reports.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/progress_reporter/__init__.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/progress_reporter/progress_reporter.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/spark_session/__init__.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/spark_session/spark_session_util.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/utils/__init__.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/utils/notebook.py +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma.egg-info/dependency_links.txt +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma.egg-info/requires.txt +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma.egg-info/top_level.txt +0 -0
- {altasigma-3.12.0 → altasigma-3.12.0.dev0}/setup.cfg +0 -0
|
@@ -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())
|
|
@@ -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
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="altasigma",
|
|
5
|
-
version="3.12.0",
|
|
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.*']),
|
|
@@ -18,6 +18,11 @@ setup(
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_abstract.py
RENAMED
|
File without changes
|
{altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_dev_mock.py
RENAMED
|
File without changes
|
{altasigma-3.12.0 → altasigma-3.12.0.dev0}/altasigma/jobsupervisor/job_supervisor_helpers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|