apizit-cli 0.3.0__tar.gz → 0.4.0b1__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 (25) hide show
  1. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/PKG-INFO +12 -5
  2. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/README.md +11 -4
  3. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/pyproject.toml +34 -34
  4. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/__init__.py +3 -3
  5. apizit_cli-0.4.0b1/src/apizit_cli/account.py +107 -0
  6. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/commands.py +380 -359
  7. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/context.py +234 -232
  8. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/main.py +191 -185
  9. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/operations.py +885 -867
  10. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/presentation.py +602 -552
  11. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/PKG-INFO +12 -5
  12. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/SOURCES.txt +1 -0
  13. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/setup.cfg +0 -0
  14. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/authentication.py +0 -0
  15. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/configuration.py +0 -0
  16. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/credential_store.py +0 -0
  17. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/domains.py +0 -0
  18. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/errors.py +0 -0
  19. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/http.py +0 -0
  20. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/selection.py +0 -0
  21. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli/sources.py +0 -0
  22. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/dependency_links.txt +0 -0
  23. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/entry_points.txt +0 -0
  24. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/requires.txt +0 -0
  25. {apizit_cli-0.3.0 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apizit-cli
3
- Version: 0.3.0
3
+ Version: 0.4.0b1
4
4
  Summary: Launch supported Python, JavaScript, TypeScript or Java APIs from your terminal or CI.
5
5
  Author: APIZIT
6
6
  Classifier: Environment :: Console
@@ -21,19 +21,23 @@ Check a project, launch its analyzed source and get its live API URL from your t
21
21
  Managed adapters cover Flask, FastAPI, Django, Express, NestJS and Spring Boot;
22
22
  APIZIT Linking provides declarative Python routes. Scan to confirm compatibility.
23
23
 
24
- Python 3.12 or later is required. Install with pip (or py -m pip on Windows):
24
+ Python 3.12 or later is required. This guide covers prerelease 0.4.0b1.
25
+ Install that exact version with pip (or py -m pip on Windows):
25
26
 
26
27
  ```sh
27
- python -m pip install apizit-cli
28
+ python -m pip install apizit-cli==0.4.0b1
28
29
  apizit login
30
+ apizit account setup
29
31
  apizit workspace use
30
32
  apizit scan .
31
33
  apizit deploy --from-scan latest
32
34
  apizit api show
33
35
  ```
34
36
 
35
- Use `python -m pip install --upgrade apizit-cli` to update.
36
- `pipx install apizit-cli` is an isolated alternative. No AWS account, Docker or backend checkout is needed.
37
+ Use `python -m pip install --upgrade apizit-cli==0.4.0b1` to update.
38
+ `pipx install apizit-cli==0.4.0b1` is an isolated alternative. An unversioned install
39
+ can select an older stable release. No AWS account, Docker or backend checkout is needed.
40
+ Account setup asks for your public username and explicit choices after reviewing required documents.
37
41
 
38
42
  The default view summarizes outcomes. `--verbose` adds technical details; `--json` preserves
39
43
  the complete versioned result and takes priority. Existing IDs and CI scripts remain supported.
@@ -43,6 +47,9 @@ Names and slugs resolve accessible resources only; ambiguous names need IDs.
43
47
  Interactive operations save non-secret references in `.apizit/operations.json`, scoped by folder,
44
48
  endpoint and workspace. `latest` resumes the recorded operation. `deploy --from-scan latest`
45
49
  reuses the exact scanned snapshot, excluding later edits. `deploy .` uploads current bytes.
50
+ The short commands above assume the same project folder. Copy the complete `Next:`
51
+ command after scanning an absolute path; its `--project-dir`, endpoint and workspace
52
+ keep the scan context when you execute it from another directory.
46
53
 
47
54
  APIZIT remains prelaunch. The default endpoint is `https://api.apizit.com/v1` (protected main domain).
48
55
  For TEST, pass `--endpoint https://api-test.apizit.com/v1` or set `APIZIT_API_URL` on every command.
@@ -4,19 +4,23 @@ Check a project, launch its analyzed source and get its live API URL from your t
4
4
  Managed adapters cover Flask, FastAPI, Django, Express, NestJS and Spring Boot;
5
5
  APIZIT Linking provides declarative Python routes. Scan to confirm compatibility.
6
6
 
7
- Python 3.12 or later is required. Install with pip (or py -m pip on Windows):
7
+ Python 3.12 or later is required. This guide covers prerelease 0.4.0b1.
8
+ Install that exact version with pip (or py -m pip on Windows):
8
9
 
9
10
  ```sh
10
- python -m pip install apizit-cli
11
+ python -m pip install apizit-cli==0.4.0b1
11
12
  apizit login
13
+ apizit account setup
12
14
  apizit workspace use
13
15
  apizit scan .
14
16
  apizit deploy --from-scan latest
15
17
  apizit api show
16
18
  ```
17
19
 
18
- Use `python -m pip install --upgrade apizit-cli` to update.
19
- `pipx install apizit-cli` is an isolated alternative. No AWS account, Docker or backend checkout is needed.
20
+ Use `python -m pip install --upgrade apizit-cli==0.4.0b1` to update.
21
+ `pipx install apizit-cli==0.4.0b1` is an isolated alternative. An unversioned install
22
+ can select an older stable release. No AWS account, Docker or backend checkout is needed.
23
+ Account setup asks for your public username and explicit choices after reviewing required documents.
20
24
 
21
25
  The default view summarizes outcomes. `--verbose` adds technical details; `--json` preserves
22
26
  the complete versioned result and takes priority. Existing IDs and CI scripts remain supported.
@@ -26,6 +30,9 @@ Names and slugs resolve accessible resources only; ambiguous names need IDs.
26
30
  Interactive operations save non-secret references in `.apizit/operations.json`, scoped by folder,
27
31
  endpoint and workspace. `latest` resumes the recorded operation. `deploy --from-scan latest`
28
32
  reuses the exact scanned snapshot, excluding later edits. `deploy .` uploads current bytes.
33
+ The short commands above assume the same project folder. Copy the complete `Next:`
34
+ command after scanning an absolute path; its `--project-dir`, endpoint and workspace
35
+ keep the scan context when you execute it from another directory.
29
36
 
30
37
  APIZIT remains prelaunch. The default endpoint is `https://api.apizit.com/v1` (protected main domain).
31
38
  For TEST, pass `--endpoint https://api-test.apizit.com/v1` or set `APIZIT_API_URL` on every command.
@@ -1,34 +1,34 @@
1
- [build-system]
2
- requires = ["setuptools>=77"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "apizit-cli"
7
- version = "0.3.0"
8
- description = "Launch supported Python, JavaScript, TypeScript or Java APIs from your terminal or CI."
9
- readme = "README.md"
10
- requires-python = ">=3.12"
11
- authors = [{name = "APIZIT"}]
12
- classifiers = [
13
- "Environment :: Console",
14
- "Operating System :: OS Independent",
15
- "Programming Language :: Python :: 3",
16
- "Programming Language :: Python :: 3.12",
17
- ]
18
- dependencies = [
19
- "requests>=2.32.0,<3",
20
- "pydantic>=2.12.5,<3",
21
- "pyyaml>=6.0.3,<7",
22
- "keyring>=25.7,<26",
23
- "pathspec>=1,<2",
24
- ]
25
-
26
- [project.scripts]
27
- apizit = "apizit_cli.main:main"
28
-
29
- [tool.setuptools.packages.find]
30
- where = ["src"]
31
- include = ["apizit_cli*"]
32
-
33
- [tool.setuptools.package-data]
34
- apizit_cli = ["data/*.json", "data/*.md", "data/*.yaml"]
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "apizit-cli"
7
+ version = "0.4.0b1"
8
+ description = "Launch supported Python, JavaScript, TypeScript or Java APIs from your terminal or CI."
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ authors = [{name = "APIZIT"}]
12
+ classifiers = [
13
+ "Environment :: Console",
14
+ "Operating System :: OS Independent",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.12",
17
+ ]
18
+ dependencies = [
19
+ "requests>=2.32.0,<3",
20
+ "pydantic>=2.12.5,<3",
21
+ "pyyaml>=6.0.3,<7",
22
+ "keyring>=25.7,<26",
23
+ "pathspec>=1,<2",
24
+ ]
25
+
26
+ [project.scripts]
27
+ apizit = "apizit_cli.main:main"
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
31
+ include = ["apizit_cli*"]
32
+
33
+ [tool.setuptools.package-data]
34
+ apizit_cli = ["data/*.json", "data/*.md", "data/*.yaml"]
@@ -1,3 +1,3 @@
1
- """The APIZIT HTTP client. Importing this package never initializes a session."""
2
-
3
- __version__ = "0.3.0"
1
+ """The APIZIT HTTP client. Importing this package never initializes a session."""
2
+
3
+ __version__ = "0.4.0b1"
@@ -0,0 +1,107 @@
1
+ """Account setup through the existing server-owned profile and acceptance contracts."""
2
+
3
+ import re
4
+ import sys
5
+
6
+ from apizit_cli.errors import CliError, EXIT_USAGE
7
+ from apizit_cli.presentation import safe_text
8
+
9
+
10
+ def account_command(runner):
11
+ profile = runner.get("/account/profile", workspace=False)
12
+ if runner.args.command_path == "account show":
13
+ return profile
14
+ username = runner.args.username or profile.get("username")
15
+ if not username:
16
+ if runner.non_interactive:
17
+ raise CliError(
18
+ "Provide a public username: apizit account setup <username>.",
19
+ code="USERNAME_REQUIRED",
20
+ exit_code=EXIT_USAGE,
21
+ )
22
+ print("Public username: ", end="", file=sys.stderr, flush=True)
23
+ username = sys.stdin.readline().strip()
24
+ # Format, uniqueness and rename rules belong to the server, never to a second CLI model.
25
+ if profile.get("legal_acceptance_current") is True:
26
+ if username == profile.get("username"):
27
+ return {"profile": profile, "already_complete": True}
28
+ updated = runner.client.request(
29
+ "PUT",
30
+ "/account/profile",
31
+ workspace=False,
32
+ body={
33
+ "username": username,
34
+ "company_name": profile.get("company_name"),
35
+ "profession": profile.get("profession"),
36
+ },
37
+ )
38
+ return {"profile": updated}
39
+
40
+ requirements = profile.get("legal_requirements") or runner.get(
41
+ "/account/legal-requirements", workspace=False, authenticated=False
42
+ )
43
+ documents = requirements.get("documents")
44
+ if (
45
+ not isinstance(documents, list)
46
+ or not documents
47
+ or any(
48
+ not isinstance(doc, dict)
49
+ or not re.fullmatch(r"[a-z][a-z0-9_]{0,63}", str(doc.get("document_id", "")))
50
+ or not re.fullmatch(r"[a-zA-Z0-9.-]{1,64}", str(doc.get("version", "")))
51
+ or doc.get("choice") not in {"agreement", "acknowledgement"}
52
+ or not isinstance(doc.get("url"), str)
53
+ or not doc["url"].startswith("https://")
54
+ for doc in documents
55
+ )
56
+ ):
57
+ raise CliError(
58
+ "APIZIT returned invalid account document requirements.", code="INVALID_RESPONSE"
59
+ )
60
+ expected = {f"{doc['document_id']}={doc['version']}" for doc in documents}
61
+ selected = runner.args.accept_document or []
62
+ if selected and (set(selected) != expected or len(selected) != len(expected)):
63
+ raise CliError(
64
+ "Document choices do not match the current versions. Review account show before retrying.",
65
+ code="LEGAL_DOCUMENT_VERSION_CHANGED",
66
+ exit_code=EXIT_USAGE,
67
+ )
68
+ if not selected:
69
+ if runner.non_interactive:
70
+ raise CliError(
71
+ "Review the current documents with apizit account show. Then repeat account setup "
72
+ "with --accept-document DOCUMENT_ID=VERSION for each explicit choice.",
73
+ code="LEGAL_ACCEPTANCE_REQUIRED",
74
+ exit_code=EXIT_USAGE,
75
+ details={"required_documents": documents},
76
+ )
77
+ for doc in documents:
78
+ verb = "agree to" if doc["choice"] == "agreement" else "acknowledge"
79
+ print(
80
+ f"{safe_text(doc.get('title') or doc['document_id'])} "
81
+ f"(version {safe_text(doc['version'])}): {safe_text(doc['url'])}",
82
+ file=sys.stderr,
83
+ )
84
+ print(
85
+ f'After reviewing this document, type "yes" to {verb} it: ',
86
+ end="",
87
+ file=sys.stderr,
88
+ flush=True,
89
+ )
90
+ if sys.stdin.readline().strip() != "yes":
91
+ raise CliError(
92
+ "Account setup was not submitted. No document choice was saved.",
93
+ code="CONFIRMATION_DECLINED",
94
+ exit_code=EXIT_USAGE,
95
+ )
96
+ return runner.client.request(
97
+ "POST",
98
+ "/account/onboarding",
99
+ workspace=False,
100
+ body={
101
+ "username": username,
102
+ "legal_acceptances": [
103
+ {"document_id": doc["document_id"], "version": doc["version"], "accepted": True}
104
+ for doc in documents
105
+ ],
106
+ },
107
+ )