perceptic-core-client 0.5.0__tar.gz → 0.6.0__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.
Potentially problematic release.
This version of perceptic-core-client might be problematic. Click here for more details.
- perceptic_core_client-0.6.0/PKG-INFO +179 -0
- perceptic_core_client-0.6.0/README.md +158 -0
- perceptic_core_client-0.6.0/VERSION +1 -0
- {perceptic_core_client-0.5.0 → perceptic_core_client-0.6.0}/pyproject.toml +1 -1
- {perceptic_core_client-0.5.0 → perceptic_core_client-0.6.0}/setup.py +3 -2
- perceptic_core_client-0.6.0/src/perceptic_core_client.egg-info/PKG-INFO +179 -0
- {perceptic_core_client-0.5.0 → perceptic_core_client-0.6.0}/src/perceptic_core_client.egg-info/SOURCES.txt +1 -0
- perceptic_core_client-0.5.0/PKG-INFO +0 -38
- perceptic_core_client-0.5.0/README.md +0 -17
- perceptic_core_client-0.5.0/src/perceptic_core_client.egg-info/PKG-INFO +0 -38
- {perceptic_core_client-0.5.0 → perceptic_core_client-0.6.0}/MANIFEST.in +0 -0
- {perceptic_core_client-0.5.0 → perceptic_core_client-0.6.0}/scripts/generate_client.py +0 -0
- {perceptic_core_client-0.5.0 → perceptic_core_client-0.6.0}/setup.cfg +0 -0
- {perceptic_core_client-0.5.0 → perceptic_core_client-0.6.0}/src/perceptic_core_client.egg-info/dependency_links.txt +0 -0
- {perceptic_core_client-0.5.0 → perceptic_core_client-0.6.0}/src/perceptic_core_client.egg-info/requires.txt +0 -0
- {perceptic_core_client-0.5.0 → perceptic_core_client-0.6.0}/src/perceptic_core_client.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: perceptic-core-client
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: Python client for Perceptic Core
|
|
5
|
+
Author-email: Your Name <you@example.com>
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Requires-Python: >=3.9
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: urllib3<3.0.0,>=2.1.0
|
|
11
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
12
|
+
Requires-Dist: pydantic>=2
|
|
13
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest; extra == "dev"
|
|
16
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
17
|
+
Requires-Dist: ruff; extra == "dev"
|
|
18
|
+
Requires-Dist: mypy; extra == "dev"
|
|
19
|
+
Requires-Dist: build; extra == "dev"
|
|
20
|
+
Requires-Dist: requests; extra == "dev"
|
|
21
|
+
|
|
22
|
+
# Perceptic Core API - Python Client Package
|
|
23
|
+
|
|
24
|
+
This directory contains the source code, build configuration, and generation scripts for the `perceptic-core-client` Python package. This package provides a client library for interacting with the Perceptic Core API.
|
|
25
|
+
|
|
26
|
+
**Note:** The actual client code within `src/perceptic_core_client/` is automatically generated during the build process from the OpenAPI specification located in the parent `perceptic-core-server` project (`../openapi/`) and is **not** checked into Git.
|
|
27
|
+
|
|
28
|
+
## Generation Process
|
|
29
|
+
|
|
30
|
+
The Python client code is generated using `openapi-generator-cli` based on the OpenAPI specification found at `../openapi/openapi.yaml` (relative to this directory).
|
|
31
|
+
|
|
32
|
+
This generation happens automatically as part of the package build process (`python -m build`) defined in `setup.py`.
|
|
33
|
+
|
|
34
|
+
**Requirements for Building:**
|
|
35
|
+
* Python >= 3.9
|
|
36
|
+
* `setuptools`, `wheel`, `build` Python packages
|
|
37
|
+
* Java Runtime Environment (JRE)
|
|
38
|
+
* `openapi-generator-cli` (Installable via npm: `npm install -g @openapitools/openapi-generator-cli`)
|
|
39
|
+
* The `PACKAGE_VERSION` environment variable must be set to the desired version string (e.g., `0.5.0`) before building.
|
|
40
|
+
* The OpenAPI spec file (`../openapi/openapi.yaml` or `.json`) must exist, typically generated by the parent Quarkus project's build.
|
|
41
|
+
|
|
42
|
+
## Building Manually (for Development/Testing)
|
|
43
|
+
|
|
44
|
+
While the primary build and publish mechanism is via GitHub Actions, you can build the package locally for testing:
|
|
45
|
+
|
|
46
|
+
1. **Navigate** to this directory (`perceptic-core-python-client`).
|
|
47
|
+
2. **Set up environment:**
|
|
48
|
+
```bash
|
|
49
|
+
# Create/activate a virtual environment
|
|
50
|
+
python -m venv .venv
|
|
51
|
+
source .venv/bin/activate # Linux/macOS
|
|
52
|
+
# .venv\Scripts\activate # Windows
|
|
53
|
+
|
|
54
|
+
# Install build and dev dependencies
|
|
55
|
+
pip install -e ".[dev]"
|
|
56
|
+
```
|
|
57
|
+
3. **Set required environment variables:**
|
|
58
|
+
```bash
|
|
59
|
+
# Bash/Zsh
|
|
60
|
+
export PACKAGE_VERSION="<target-version>" # e.g., 0.5.1.dev0
|
|
61
|
+
# OPENAPI_SPEC_PATH is determined automatically by setup.py now
|
|
62
|
+
|
|
63
|
+
# Windows CMD
|
|
64
|
+
# set PACKAGE_VERSION=<target-version>
|
|
65
|
+
|
|
66
|
+
# Windows PowerShell
|
|
67
|
+
# $env:PACKAGE_VERSION = "<target-version>"
|
|
68
|
+
```
|
|
69
|
+
4. **Run build:** Ensure the spec file exists at `../openapi/openapi.yaml` (or `.json`).
|
|
70
|
+
```bash
|
|
71
|
+
python -m build
|
|
72
|
+
```
|
|
73
|
+
This will generate the client code in `src/` and create distribution files (`.whl`, `.tar.gz`) in the `dist/` directory.
|
|
74
|
+
|
|
75
|
+
## Publishing
|
|
76
|
+
|
|
77
|
+
This package is automatically published to GitHub Packages via the GitHub Actions workflow defined in `.github/workflows/publish-python-client.yml` in the root of the `perceptic-core-server` repository. Publishing is triggered when a Git tag (e.g., `0.5.0`, `1.0.0`) is pushed to the repository.
|
|
78
|
+
|
|
79
|
+
## Installation (from GitHub Packages)
|
|
80
|
+
|
|
81
|
+
To use this client in your Python projects, install it from GitHub Packages.
|
|
82
|
+
|
|
83
|
+
1. **Configure pip:** You need to tell pip where to find the package. Add the following lines to your `pip.conf` / `pip.ini` file, or configure it using environment variables/command-line arguments. Replace `<YOUR_GITHUB_OWNER>` with the GitHub username or organization that owns the repository (e.g., `perceptic-core`).
|
|
84
|
+
|
|
85
|
+
```ini
|
|
86
|
+
[global]
|
|
87
|
+
extra-index-url = [https://pypi.pkg.github.com/](https://pypi.pkg.github.com/)<YOUR_GITHUB_OWNER>/
|
|
88
|
+
```
|
|
89
|
+
*Alternatively, use `--extra-index-url` on the command line.*
|
|
90
|
+
|
|
91
|
+
2. **Authentication (if repository is private):** You may need to authenticate pip to GitHub Packages. The recommended method is using a Personal Access Token (PAT) with the `read:packages` scope. Configure pip to use your GitHub username and the PAT. Refer to GitHub documentation for the latest authentication methods.
|
|
92
|
+
|
|
93
|
+
3. **Install the package:**
|
|
94
|
+
```bash
|
|
95
|
+
pip install perceptic-core-client
|
|
96
|
+
```
|
|
97
|
+
*(Specify a version if needed: `pip install perceptic-core-client==<version>`)*
|
|
98
|
+
|
|
99
|
+
## Usage Example
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import os
|
|
103
|
+
from perceptic_core_client import ApiClient, Configuration, ApiException
|
|
104
|
+
from perceptic_core_client.api.user_resource_api import UserResourceApi # Example API
|
|
105
|
+
from pprint import pprint
|
|
106
|
+
|
|
107
|
+
# --- Configuration ---
|
|
108
|
+
# Replace with the actual host of your Perceptic Core API instance
|
|
109
|
+
API_HOST = os.environ.get("PERCEPTIC_CORE_HOST", "http://localhost:8080")
|
|
110
|
+
|
|
111
|
+
# Obtain your authentication token separately
|
|
112
|
+
# (e.g., from Keycloak, environment variable, another library)
|
|
113
|
+
ACCESS_TOKEN = os.environ.get("PERCEPTIC_CORE_TOKEN")
|
|
114
|
+
|
|
115
|
+
if not ACCESS_TOKEN:
|
|
116
|
+
print("Error: PERCEPTIC_CORE_TOKEN environment variable not set.")
|
|
117
|
+
exit(1)
|
|
118
|
+
# ---
|
|
119
|
+
|
|
120
|
+
print(f"Configuring client for host: {API_HOST}")
|
|
121
|
+
|
|
122
|
+
# Configure API client
|
|
123
|
+
configuration = Configuration(host=API_HOST)
|
|
124
|
+
configuration.access_token = ACCESS_TOKEN # Set token for potential internal use
|
|
125
|
+
|
|
126
|
+
# Initialize API client
|
|
127
|
+
api_client = ApiClient(configuration=configuration)
|
|
128
|
+
|
|
129
|
+
# Explicitly set the Authorization header (recommended)
|
|
130
|
+
api_client.set_default_header("Authorization", f"Bearer {ACCESS_TOKEN}")
|
|
131
|
+
|
|
132
|
+
# --- Example API Call: Get current user info ---
|
|
133
|
+
user_api = UserResourceApi(api_client=api_client)
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
print("Calling /api/v1/users/me...")
|
|
137
|
+
me_response = user_api.api_v1_users_me_get()
|
|
138
|
+
print("API call successful. User Info:")
|
|
139
|
+
pprint(me_response.to_dict()) # Use to_dict() for cleaner printing
|
|
140
|
+
|
|
141
|
+
except ApiException as e:
|
|
142
|
+
print(f"API Exception calling UserResourceApi->api_v1_users_me_get: {e}\n")
|
|
143
|
+
# You can inspect e.status, e.reason, e.body, e.headers
|
|
144
|
+
except Exception as e:
|
|
145
|
+
print(f"An unexpected error occurred: {e}\n")
|
|
146
|
+
|
|
147
|
+
# --- Example: Create a Connection (replace with actual details) ---
|
|
148
|
+
# from perceptic_core_client.api.connection_resource_api import ConnectionResourceApi
|
|
149
|
+
# from perceptic_core_client.models import (
|
|
150
|
+
# CreateConnectionRequest,
|
|
151
|
+
# ConnectionSettingsApiDto,
|
|
152
|
+
# S3ConnectionSettingsApiDto # Example setting type
|
|
153
|
+
# )
|
|
154
|
+
#
|
|
155
|
+
# connection_api = ConnectionResourceApi(api_client=api_client)
|
|
156
|
+
#
|
|
157
|
+
# try:
|
|
158
|
+
# print("Attempting to create a connection...")
|
|
159
|
+
# connection_request = CreateConnectionRequest(
|
|
160
|
+
# name="my-s3-connection",
|
|
161
|
+
# description="Connection to my S3 bucket",
|
|
162
|
+
# settings=ConnectionSettingsApiDto(
|
|
163
|
+
# actual_instance=S3ConnectionSettingsApiDto(
|
|
164
|
+
# type="v1/s3",
|
|
165
|
+
# region="us-east-1", # Replace with actual values
|
|
166
|
+
# access_key="YOUR_ACCESS_KEY",
|
|
167
|
+
# secret_key="YOUR_SECRET_KEY",
|
|
168
|
+
# url="[https://s3.amazonaws.com](https://s3.amazonaws.com)" # Optional endpoint URL
|
|
169
|
+
# )
|
|
170
|
+
# )
|
|
171
|
+
# )
|
|
172
|
+
# create_response = connection_api.api_v1_connections_post(connection_request)
|
|
173
|
+
# print("Connection created successfully:")
|
|
174
|
+
# pprint(create_response.to_dict())
|
|
175
|
+
#
|
|
176
|
+
# except ApiException as e:
|
|
177
|
+
# print(f"API Exception creating connection: {e}\n")
|
|
178
|
+
# except Exception as e:
|
|
179
|
+
# print(f"An unexpected error occurred: {e}\n")
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Perceptic Core API - Python Client Package
|
|
2
|
+
|
|
3
|
+
This directory contains the source code, build configuration, and generation scripts for the `perceptic-core-client` Python package. This package provides a client library for interacting with the Perceptic Core API.
|
|
4
|
+
|
|
5
|
+
**Note:** The actual client code within `src/perceptic_core_client/` is automatically generated during the build process from the OpenAPI specification located in the parent `perceptic-core-server` project (`../openapi/`) and is **not** checked into Git.
|
|
6
|
+
|
|
7
|
+
## Generation Process
|
|
8
|
+
|
|
9
|
+
The Python client code is generated using `openapi-generator-cli` based on the OpenAPI specification found at `../openapi/openapi.yaml` (relative to this directory).
|
|
10
|
+
|
|
11
|
+
This generation happens automatically as part of the package build process (`python -m build`) defined in `setup.py`.
|
|
12
|
+
|
|
13
|
+
**Requirements for Building:**
|
|
14
|
+
* Python >= 3.9
|
|
15
|
+
* `setuptools`, `wheel`, `build` Python packages
|
|
16
|
+
* Java Runtime Environment (JRE)
|
|
17
|
+
* `openapi-generator-cli` (Installable via npm: `npm install -g @openapitools/openapi-generator-cli`)
|
|
18
|
+
* The `PACKAGE_VERSION` environment variable must be set to the desired version string (e.g., `0.5.0`) before building.
|
|
19
|
+
* The OpenAPI spec file (`../openapi/openapi.yaml` or `.json`) must exist, typically generated by the parent Quarkus project's build.
|
|
20
|
+
|
|
21
|
+
## Building Manually (for Development/Testing)
|
|
22
|
+
|
|
23
|
+
While the primary build and publish mechanism is via GitHub Actions, you can build the package locally for testing:
|
|
24
|
+
|
|
25
|
+
1. **Navigate** to this directory (`perceptic-core-python-client`).
|
|
26
|
+
2. **Set up environment:**
|
|
27
|
+
```bash
|
|
28
|
+
# Create/activate a virtual environment
|
|
29
|
+
python -m venv .venv
|
|
30
|
+
source .venv/bin/activate # Linux/macOS
|
|
31
|
+
# .venv\Scripts\activate # Windows
|
|
32
|
+
|
|
33
|
+
# Install build and dev dependencies
|
|
34
|
+
pip install -e ".[dev]"
|
|
35
|
+
```
|
|
36
|
+
3. **Set required environment variables:**
|
|
37
|
+
```bash
|
|
38
|
+
# Bash/Zsh
|
|
39
|
+
export PACKAGE_VERSION="<target-version>" # e.g., 0.5.1.dev0
|
|
40
|
+
# OPENAPI_SPEC_PATH is determined automatically by setup.py now
|
|
41
|
+
|
|
42
|
+
# Windows CMD
|
|
43
|
+
# set PACKAGE_VERSION=<target-version>
|
|
44
|
+
|
|
45
|
+
# Windows PowerShell
|
|
46
|
+
# $env:PACKAGE_VERSION = "<target-version>"
|
|
47
|
+
```
|
|
48
|
+
4. **Run build:** Ensure the spec file exists at `../openapi/openapi.yaml` (or `.json`).
|
|
49
|
+
```bash
|
|
50
|
+
python -m build
|
|
51
|
+
```
|
|
52
|
+
This will generate the client code in `src/` and create distribution files (`.whl`, `.tar.gz`) in the `dist/` directory.
|
|
53
|
+
|
|
54
|
+
## Publishing
|
|
55
|
+
|
|
56
|
+
This package is automatically published to GitHub Packages via the GitHub Actions workflow defined in `.github/workflows/publish-python-client.yml` in the root of the `perceptic-core-server` repository. Publishing is triggered when a Git tag (e.g., `0.5.0`, `1.0.0`) is pushed to the repository.
|
|
57
|
+
|
|
58
|
+
## Installation (from GitHub Packages)
|
|
59
|
+
|
|
60
|
+
To use this client in your Python projects, install it from GitHub Packages.
|
|
61
|
+
|
|
62
|
+
1. **Configure pip:** You need to tell pip where to find the package. Add the following lines to your `pip.conf` / `pip.ini` file, or configure it using environment variables/command-line arguments. Replace `<YOUR_GITHUB_OWNER>` with the GitHub username or organization that owns the repository (e.g., `perceptic-core`).
|
|
63
|
+
|
|
64
|
+
```ini
|
|
65
|
+
[global]
|
|
66
|
+
extra-index-url = [https://pypi.pkg.github.com/](https://pypi.pkg.github.com/)<YOUR_GITHUB_OWNER>/
|
|
67
|
+
```
|
|
68
|
+
*Alternatively, use `--extra-index-url` on the command line.*
|
|
69
|
+
|
|
70
|
+
2. **Authentication (if repository is private):** You may need to authenticate pip to GitHub Packages. The recommended method is using a Personal Access Token (PAT) with the `read:packages` scope. Configure pip to use your GitHub username and the PAT. Refer to GitHub documentation for the latest authentication methods.
|
|
71
|
+
|
|
72
|
+
3. **Install the package:**
|
|
73
|
+
```bash
|
|
74
|
+
pip install perceptic-core-client
|
|
75
|
+
```
|
|
76
|
+
*(Specify a version if needed: `pip install perceptic-core-client==<version>`)*
|
|
77
|
+
|
|
78
|
+
## Usage Example
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
import os
|
|
82
|
+
from perceptic_core_client import ApiClient, Configuration, ApiException
|
|
83
|
+
from perceptic_core_client.api.user_resource_api import UserResourceApi # Example API
|
|
84
|
+
from pprint import pprint
|
|
85
|
+
|
|
86
|
+
# --- Configuration ---
|
|
87
|
+
# Replace with the actual host of your Perceptic Core API instance
|
|
88
|
+
API_HOST = os.environ.get("PERCEPTIC_CORE_HOST", "http://localhost:8080")
|
|
89
|
+
|
|
90
|
+
# Obtain your authentication token separately
|
|
91
|
+
# (e.g., from Keycloak, environment variable, another library)
|
|
92
|
+
ACCESS_TOKEN = os.environ.get("PERCEPTIC_CORE_TOKEN")
|
|
93
|
+
|
|
94
|
+
if not ACCESS_TOKEN:
|
|
95
|
+
print("Error: PERCEPTIC_CORE_TOKEN environment variable not set.")
|
|
96
|
+
exit(1)
|
|
97
|
+
# ---
|
|
98
|
+
|
|
99
|
+
print(f"Configuring client for host: {API_HOST}")
|
|
100
|
+
|
|
101
|
+
# Configure API client
|
|
102
|
+
configuration = Configuration(host=API_HOST)
|
|
103
|
+
configuration.access_token = ACCESS_TOKEN # Set token for potential internal use
|
|
104
|
+
|
|
105
|
+
# Initialize API client
|
|
106
|
+
api_client = ApiClient(configuration=configuration)
|
|
107
|
+
|
|
108
|
+
# Explicitly set the Authorization header (recommended)
|
|
109
|
+
api_client.set_default_header("Authorization", f"Bearer {ACCESS_TOKEN}")
|
|
110
|
+
|
|
111
|
+
# --- Example API Call: Get current user info ---
|
|
112
|
+
user_api = UserResourceApi(api_client=api_client)
|
|
113
|
+
|
|
114
|
+
try:
|
|
115
|
+
print("Calling /api/v1/users/me...")
|
|
116
|
+
me_response = user_api.api_v1_users_me_get()
|
|
117
|
+
print("API call successful. User Info:")
|
|
118
|
+
pprint(me_response.to_dict()) # Use to_dict() for cleaner printing
|
|
119
|
+
|
|
120
|
+
except ApiException as e:
|
|
121
|
+
print(f"API Exception calling UserResourceApi->api_v1_users_me_get: {e}\n")
|
|
122
|
+
# You can inspect e.status, e.reason, e.body, e.headers
|
|
123
|
+
except Exception as e:
|
|
124
|
+
print(f"An unexpected error occurred: {e}\n")
|
|
125
|
+
|
|
126
|
+
# --- Example: Create a Connection (replace with actual details) ---
|
|
127
|
+
# from perceptic_core_client.api.connection_resource_api import ConnectionResourceApi
|
|
128
|
+
# from perceptic_core_client.models import (
|
|
129
|
+
# CreateConnectionRequest,
|
|
130
|
+
# ConnectionSettingsApiDto,
|
|
131
|
+
# S3ConnectionSettingsApiDto # Example setting type
|
|
132
|
+
# )
|
|
133
|
+
#
|
|
134
|
+
# connection_api = ConnectionResourceApi(api_client=api_client)
|
|
135
|
+
#
|
|
136
|
+
# try:
|
|
137
|
+
# print("Attempting to create a connection...")
|
|
138
|
+
# connection_request = CreateConnectionRequest(
|
|
139
|
+
# name="my-s3-connection",
|
|
140
|
+
# description="Connection to my S3 bucket",
|
|
141
|
+
# settings=ConnectionSettingsApiDto(
|
|
142
|
+
# actual_instance=S3ConnectionSettingsApiDto(
|
|
143
|
+
# type="v1/s3",
|
|
144
|
+
# region="us-east-1", # Replace with actual values
|
|
145
|
+
# access_key="YOUR_ACCESS_KEY",
|
|
146
|
+
# secret_key="YOUR_SECRET_KEY",
|
|
147
|
+
# url="[https://s3.amazonaws.com](https://s3.amazonaws.com)" # Optional endpoint URL
|
|
148
|
+
# )
|
|
149
|
+
# )
|
|
150
|
+
# )
|
|
151
|
+
# create_response = connection_api.api_v1_connections_post(connection_request)
|
|
152
|
+
# print("Connection created successfully:")
|
|
153
|
+
# pprint(create_response.to_dict())
|
|
154
|
+
#
|
|
155
|
+
# except ApiException as e:
|
|
156
|
+
# print(f"API Exception creating connection: {e}\n")
|
|
157
|
+
# except Exception as e:
|
|
158
|
+
# print(f"An unexpected error occurred: {e}\n")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.6.0
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "perceptic-core-client"
|
|
7
|
-
|
|
7
|
+
dynamic = ["version"]
|
|
8
8
|
description = "Python client for Perceptic Core"
|
|
9
9
|
authors = [{name = "Your Name", email = "you@example.com"}]
|
|
10
10
|
readme = "README.md"
|
|
@@ -88,9 +88,7 @@ class CustomSdist(sdist):
|
|
|
88
88
|
run_generation_script()
|
|
89
89
|
super().run()
|
|
90
90
|
|
|
91
|
-
# Run setup() with standard arguments and custom commands
|
|
92
91
|
setup(
|
|
93
|
-
# Most metadata is now in pyproject.toml
|
|
94
92
|
packages=find_packages(where='src'),
|
|
95
93
|
package_dir={'': 'src'},
|
|
96
94
|
cmdclass={
|
|
@@ -99,4 +97,7 @@ setup(
|
|
|
99
97
|
'sdist': CustomSdist,
|
|
100
98
|
},
|
|
101
99
|
include_package_data=True,
|
|
100
|
+
package_data={
|
|
101
|
+
"perceptic_core_client": ["**/*"],
|
|
102
|
+
},
|
|
102
103
|
)
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: perceptic-core-client
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: Python client for Perceptic Core
|
|
5
|
+
Author-email: Your Name <you@example.com>
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Requires-Python: >=3.9
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: urllib3<3.0.0,>=2.1.0
|
|
11
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
12
|
+
Requires-Dist: pydantic>=2
|
|
13
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest; extra == "dev"
|
|
16
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
17
|
+
Requires-Dist: ruff; extra == "dev"
|
|
18
|
+
Requires-Dist: mypy; extra == "dev"
|
|
19
|
+
Requires-Dist: build; extra == "dev"
|
|
20
|
+
Requires-Dist: requests; extra == "dev"
|
|
21
|
+
|
|
22
|
+
# Perceptic Core API - Python Client Package
|
|
23
|
+
|
|
24
|
+
This directory contains the source code, build configuration, and generation scripts for the `perceptic-core-client` Python package. This package provides a client library for interacting with the Perceptic Core API.
|
|
25
|
+
|
|
26
|
+
**Note:** The actual client code within `src/perceptic_core_client/` is automatically generated during the build process from the OpenAPI specification located in the parent `perceptic-core-server` project (`../openapi/`) and is **not** checked into Git.
|
|
27
|
+
|
|
28
|
+
## Generation Process
|
|
29
|
+
|
|
30
|
+
The Python client code is generated using `openapi-generator-cli` based on the OpenAPI specification found at `../openapi/openapi.yaml` (relative to this directory).
|
|
31
|
+
|
|
32
|
+
This generation happens automatically as part of the package build process (`python -m build`) defined in `setup.py`.
|
|
33
|
+
|
|
34
|
+
**Requirements for Building:**
|
|
35
|
+
* Python >= 3.9
|
|
36
|
+
* `setuptools`, `wheel`, `build` Python packages
|
|
37
|
+
* Java Runtime Environment (JRE)
|
|
38
|
+
* `openapi-generator-cli` (Installable via npm: `npm install -g @openapitools/openapi-generator-cli`)
|
|
39
|
+
* The `PACKAGE_VERSION` environment variable must be set to the desired version string (e.g., `0.5.0`) before building.
|
|
40
|
+
* The OpenAPI spec file (`../openapi/openapi.yaml` or `.json`) must exist, typically generated by the parent Quarkus project's build.
|
|
41
|
+
|
|
42
|
+
## Building Manually (for Development/Testing)
|
|
43
|
+
|
|
44
|
+
While the primary build and publish mechanism is via GitHub Actions, you can build the package locally for testing:
|
|
45
|
+
|
|
46
|
+
1. **Navigate** to this directory (`perceptic-core-python-client`).
|
|
47
|
+
2. **Set up environment:**
|
|
48
|
+
```bash
|
|
49
|
+
# Create/activate a virtual environment
|
|
50
|
+
python -m venv .venv
|
|
51
|
+
source .venv/bin/activate # Linux/macOS
|
|
52
|
+
# .venv\Scripts\activate # Windows
|
|
53
|
+
|
|
54
|
+
# Install build and dev dependencies
|
|
55
|
+
pip install -e ".[dev]"
|
|
56
|
+
```
|
|
57
|
+
3. **Set required environment variables:**
|
|
58
|
+
```bash
|
|
59
|
+
# Bash/Zsh
|
|
60
|
+
export PACKAGE_VERSION="<target-version>" # e.g., 0.5.1.dev0
|
|
61
|
+
# OPENAPI_SPEC_PATH is determined automatically by setup.py now
|
|
62
|
+
|
|
63
|
+
# Windows CMD
|
|
64
|
+
# set PACKAGE_VERSION=<target-version>
|
|
65
|
+
|
|
66
|
+
# Windows PowerShell
|
|
67
|
+
# $env:PACKAGE_VERSION = "<target-version>"
|
|
68
|
+
```
|
|
69
|
+
4. **Run build:** Ensure the spec file exists at `../openapi/openapi.yaml` (or `.json`).
|
|
70
|
+
```bash
|
|
71
|
+
python -m build
|
|
72
|
+
```
|
|
73
|
+
This will generate the client code in `src/` and create distribution files (`.whl`, `.tar.gz`) in the `dist/` directory.
|
|
74
|
+
|
|
75
|
+
## Publishing
|
|
76
|
+
|
|
77
|
+
This package is automatically published to GitHub Packages via the GitHub Actions workflow defined in `.github/workflows/publish-python-client.yml` in the root of the `perceptic-core-server` repository. Publishing is triggered when a Git tag (e.g., `0.5.0`, `1.0.0`) is pushed to the repository.
|
|
78
|
+
|
|
79
|
+
## Installation (from GitHub Packages)
|
|
80
|
+
|
|
81
|
+
To use this client in your Python projects, install it from GitHub Packages.
|
|
82
|
+
|
|
83
|
+
1. **Configure pip:** You need to tell pip where to find the package. Add the following lines to your `pip.conf` / `pip.ini` file, or configure it using environment variables/command-line arguments. Replace `<YOUR_GITHUB_OWNER>` with the GitHub username or organization that owns the repository (e.g., `perceptic-core`).
|
|
84
|
+
|
|
85
|
+
```ini
|
|
86
|
+
[global]
|
|
87
|
+
extra-index-url = [https://pypi.pkg.github.com/](https://pypi.pkg.github.com/)<YOUR_GITHUB_OWNER>/
|
|
88
|
+
```
|
|
89
|
+
*Alternatively, use `--extra-index-url` on the command line.*
|
|
90
|
+
|
|
91
|
+
2. **Authentication (if repository is private):** You may need to authenticate pip to GitHub Packages. The recommended method is using a Personal Access Token (PAT) with the `read:packages` scope. Configure pip to use your GitHub username and the PAT. Refer to GitHub documentation for the latest authentication methods.
|
|
92
|
+
|
|
93
|
+
3. **Install the package:**
|
|
94
|
+
```bash
|
|
95
|
+
pip install perceptic-core-client
|
|
96
|
+
```
|
|
97
|
+
*(Specify a version if needed: `pip install perceptic-core-client==<version>`)*
|
|
98
|
+
|
|
99
|
+
## Usage Example
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import os
|
|
103
|
+
from perceptic_core_client import ApiClient, Configuration, ApiException
|
|
104
|
+
from perceptic_core_client.api.user_resource_api import UserResourceApi # Example API
|
|
105
|
+
from pprint import pprint
|
|
106
|
+
|
|
107
|
+
# --- Configuration ---
|
|
108
|
+
# Replace with the actual host of your Perceptic Core API instance
|
|
109
|
+
API_HOST = os.environ.get("PERCEPTIC_CORE_HOST", "http://localhost:8080")
|
|
110
|
+
|
|
111
|
+
# Obtain your authentication token separately
|
|
112
|
+
# (e.g., from Keycloak, environment variable, another library)
|
|
113
|
+
ACCESS_TOKEN = os.environ.get("PERCEPTIC_CORE_TOKEN")
|
|
114
|
+
|
|
115
|
+
if not ACCESS_TOKEN:
|
|
116
|
+
print("Error: PERCEPTIC_CORE_TOKEN environment variable not set.")
|
|
117
|
+
exit(1)
|
|
118
|
+
# ---
|
|
119
|
+
|
|
120
|
+
print(f"Configuring client for host: {API_HOST}")
|
|
121
|
+
|
|
122
|
+
# Configure API client
|
|
123
|
+
configuration = Configuration(host=API_HOST)
|
|
124
|
+
configuration.access_token = ACCESS_TOKEN # Set token for potential internal use
|
|
125
|
+
|
|
126
|
+
# Initialize API client
|
|
127
|
+
api_client = ApiClient(configuration=configuration)
|
|
128
|
+
|
|
129
|
+
# Explicitly set the Authorization header (recommended)
|
|
130
|
+
api_client.set_default_header("Authorization", f"Bearer {ACCESS_TOKEN}")
|
|
131
|
+
|
|
132
|
+
# --- Example API Call: Get current user info ---
|
|
133
|
+
user_api = UserResourceApi(api_client=api_client)
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
print("Calling /api/v1/users/me...")
|
|
137
|
+
me_response = user_api.api_v1_users_me_get()
|
|
138
|
+
print("API call successful. User Info:")
|
|
139
|
+
pprint(me_response.to_dict()) # Use to_dict() for cleaner printing
|
|
140
|
+
|
|
141
|
+
except ApiException as e:
|
|
142
|
+
print(f"API Exception calling UserResourceApi->api_v1_users_me_get: {e}\n")
|
|
143
|
+
# You can inspect e.status, e.reason, e.body, e.headers
|
|
144
|
+
except Exception as e:
|
|
145
|
+
print(f"An unexpected error occurred: {e}\n")
|
|
146
|
+
|
|
147
|
+
# --- Example: Create a Connection (replace with actual details) ---
|
|
148
|
+
# from perceptic_core_client.api.connection_resource_api import ConnectionResourceApi
|
|
149
|
+
# from perceptic_core_client.models import (
|
|
150
|
+
# CreateConnectionRequest,
|
|
151
|
+
# ConnectionSettingsApiDto,
|
|
152
|
+
# S3ConnectionSettingsApiDto # Example setting type
|
|
153
|
+
# )
|
|
154
|
+
#
|
|
155
|
+
# connection_api = ConnectionResourceApi(api_client=api_client)
|
|
156
|
+
#
|
|
157
|
+
# try:
|
|
158
|
+
# print("Attempting to create a connection...")
|
|
159
|
+
# connection_request = CreateConnectionRequest(
|
|
160
|
+
# name="my-s3-connection",
|
|
161
|
+
# description="Connection to my S3 bucket",
|
|
162
|
+
# settings=ConnectionSettingsApiDto(
|
|
163
|
+
# actual_instance=S3ConnectionSettingsApiDto(
|
|
164
|
+
# type="v1/s3",
|
|
165
|
+
# region="us-east-1", # Replace with actual values
|
|
166
|
+
# access_key="YOUR_ACCESS_KEY",
|
|
167
|
+
# secret_key="YOUR_SECRET_KEY",
|
|
168
|
+
# url="[https://s3.amazonaws.com](https://s3.amazonaws.com)" # Optional endpoint URL
|
|
169
|
+
# )
|
|
170
|
+
# )
|
|
171
|
+
# )
|
|
172
|
+
# create_response = connection_api.api_v1_connections_post(connection_request)
|
|
173
|
+
# print("Connection created successfully:")
|
|
174
|
+
# pprint(create_response.to_dict())
|
|
175
|
+
#
|
|
176
|
+
# except ApiException as e:
|
|
177
|
+
# print(f"API Exception creating connection: {e}\n")
|
|
178
|
+
# except Exception as e:
|
|
179
|
+
# print(f"An unexpected error occurred: {e}\n")
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: perceptic-core-client
|
|
3
|
-
Version: 0.5.0
|
|
4
|
-
Summary: Python client for Perceptic Core
|
|
5
|
-
Author-email: Your Name <you@example.com>
|
|
6
|
-
License: Proprietary
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Requires-Python: >=3.9
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
Requires-Dist: urllib3<3.0.0,>=2.1.0
|
|
11
|
-
Requires-Dist: python-dateutil>=2.8.2
|
|
12
|
-
Requires-Dist: pydantic>=2
|
|
13
|
-
Requires-Dist: typing-extensions>=4.7.1
|
|
14
|
-
Provides-Extra: dev
|
|
15
|
-
Requires-Dist: pytest; extra == "dev"
|
|
16
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
|
17
|
-
Requires-Dist: ruff; extra == "dev"
|
|
18
|
-
Requires-Dist: mypy; extra == "dev"
|
|
19
|
-
Requires-Dist: build; extra == "dev"
|
|
20
|
-
Requires-Dist: requests; extra == "dev"
|
|
21
|
-
|
|
22
|
-
# Perceptic Core Python Client
|
|
23
|
-
|
|
24
|
-
This package provides a Python client for the Perceptic Core API.
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
(Instructions will be added once packaging is set up)
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
|
|
32
|
-
(Example usage will be added)
|
|
33
|
-
|
|
34
|
-
## Building
|
|
35
|
-
|
|
36
|
-
This package requires Java and `openapi-generator-cli` to be installed for the build process, as it generates the client code from the OpenAPI specification during the build.
|
|
37
|
-
|
|
38
|
-
(Detailed build instructions will be added)
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Perceptic Core Python Client
|
|
2
|
-
|
|
3
|
-
This package provides a Python client for the Perceptic Core API.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
(Instructions will be added once packaging is set up)
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
(Example usage will be added)
|
|
12
|
-
|
|
13
|
-
## Building
|
|
14
|
-
|
|
15
|
-
This package requires Java and `openapi-generator-cli` to be installed for the build process, as it generates the client code from the OpenAPI specification during the build.
|
|
16
|
-
|
|
17
|
-
(Detailed build instructions will be added)
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: perceptic-core-client
|
|
3
|
-
Version: 0.5.0
|
|
4
|
-
Summary: Python client for Perceptic Core
|
|
5
|
-
Author-email: Your Name <you@example.com>
|
|
6
|
-
License: Proprietary
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Requires-Python: >=3.9
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
Requires-Dist: urllib3<3.0.0,>=2.1.0
|
|
11
|
-
Requires-Dist: python-dateutil>=2.8.2
|
|
12
|
-
Requires-Dist: pydantic>=2
|
|
13
|
-
Requires-Dist: typing-extensions>=4.7.1
|
|
14
|
-
Provides-Extra: dev
|
|
15
|
-
Requires-Dist: pytest; extra == "dev"
|
|
16
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
|
17
|
-
Requires-Dist: ruff; extra == "dev"
|
|
18
|
-
Requires-Dist: mypy; extra == "dev"
|
|
19
|
-
Requires-Dist: build; extra == "dev"
|
|
20
|
-
Requires-Dist: requests; extra == "dev"
|
|
21
|
-
|
|
22
|
-
# Perceptic Core Python Client
|
|
23
|
-
|
|
24
|
-
This package provides a Python client for the Perceptic Core API.
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
(Instructions will be added once packaging is set up)
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
|
|
32
|
-
(Example usage will be added)
|
|
33
|
-
|
|
34
|
-
## Building
|
|
35
|
-
|
|
36
|
-
This package requires Java and `openapi-generator-cli` to be installed for the build process, as it generates the client code from the OpenAPI specification during the build.
|
|
37
|
-
|
|
38
|
-
(Detailed build instructions will be added)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|