amdp-python-sdk
Current version: 0.1.0a1
Python SDK for the AMD Platform API Services.
Table of Contents
- Installation
- Getting Started
- Development Setup
- License
- Regenerate the OpenAPI libraries
- Testing
- Build
- Changelog
Installation
pip install amdp-python-sdk
Quick Start
from amdp_python_sdk import AMDP
# Connect with explicit credentials
sdk = AMDP.connect(
client_id="your-client-id",
client_secret="your-secret",
user_service_hostname="https://amdp.cdc.gov/user-service",
workflow_service_hostname="https://amdp.cdc.gov/workflow-service",
sample_service_hostname="https://amdp.cdc.gov/sample-service"
)
# Upload samples with intuitive chaining
result = (
sdk.workspace("My Workspace")
.project("My Project")
.upload_sample_sheet("samples.csv")
)
print(f"Uploaded {len(result.samples)} samples")
Alternatively, set environment variables and connect without parameters:
export AMDP_CLIENT_ID="your-client-id"
export AMDP_CLIENT_SECRET="your-secret"
export AMDP_USER_SERVICE_HOSTNAME="https://amdp.cdc.gov/user-service"
export AMDP_WORKFLOW_SERVICE_HOSTNAME="https://amdp.cdc.gov/workflow-service"
export AMDP_SAMPLE_SERVICE_HOSTNAME="https://amdp.cdc.gov/sample-service"
from amdp_python_sdk import AMDP
sdk = AMDP.connect() # Reads credentials from environment
Getting Started
See using-sdk.md and usage_examples.py for comprehensive usage information.
Development Setup
-
Install Python 3.12 (minimum 3.10) in WSL
sudo apt install python3.12 python-is-python3 -y
-
Install Hatch in WSL
## Install pipx first sudo apt install pipx -y pipx install hatch
-
Install Python and Pylance extensions in VS Code
-
In VS Code settings, select 'Extensions' on the left hand side, and then select 'Pylance'. Look for 'Python › Analysis: Type Checking Mode' and set the dropdown value to 'Strict'
-
Create and start Hatch virtual environment
# will install all specified dependencies from the toml # Note the path given for the source command hatch shell local
-
In VS Code, set the "Python: Select Interpreter" setting and select "Enter interpreter path...", and use the path noted from step 4.
-
(Optional) Download VS Code extensions for Black Formatter, isort, and Flake8.
Running Hatch-Static-Analysis scripts
# list report of black and isort formatting
hatch run hatch-static-analysis format-check
# fix formatting with black and isort
hatch run hatch-static-analysis format-fix
# run flake8 linter script
hatch run hatch-static-analysis lint-check
Re-creating Hatch virtual environment from scratch
At the project root, run:
hatch env remove <envname>
then run:
hatch env create <envname>
Regenerate the OpenAPI libraries
If the API source code has been updated you can regenerate the openAPI based python libraries.
With the API services running locally, first navigate to this repository then run:
podman-compose up
Each library will be regenerated in the ./generated directory.
Installation in Hatch Environments
The generated packages (oamd_sample_openApi, oamd_user_openApi, oamd_workflow_openApi) are automatically installed when you use Hatch environments:
- Regular environments (local, dev, test, etc.): The packages are installed automatically via the
{root:uri}dependencies inpyproject.toml - Test environments (hatch-test): The packages are installed automatically via
post-install-commandsinpyproject.toml
No manual installation is required when working with Hatch environments.
Manual Installation (Outside Hatch)
If you need to test the generated packages individually outside of Hatch environments, install them manually:
pip install -e generated/samples
pip install -e generated/users
pip install -e generated/workflow
Testing
For instructions on using the test_sdk_functions.py script to test functions, please see using-test-sdk-script.md.
To run unit tests use the following hatch test command:
hatch test
Build
To build use the hatch build command and the build files will be generated in ./dist.
hatch build
Changelog
See CHANGELOG.md for full details.
License
amdp-python-sdk is distributed under the terms of the MIT license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file amdp_python_sdk-1.0.0.tar.gz.
File metadata
- Download URL: amdp_python_sdk-1.0.0.tar.gz
- Upload date:
- Size: 560.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
004759280b31d9d9a3a1943a6329ac5710227e26e039ab22f780c089944cf300
|
|
| MD5 |
cd634ec5371d3f81ac53e4d3c8cf89ef
|
|
| BLAKE2b-256 |
d8367accf3ec7edeaa6d520a7cb4dbcca2842b33e5c9f944459af98dab01b52b
|
File details
Details for the file amdp_python_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: amdp_python_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 800.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6958f2841563cb2fc13574431e38baed44eb1ad639620d8bde8d8a7250c2773
|
|
| MD5 |
c3a09ea688f17d54c54872e8dfaacd82
|
|
| BLAKE2b-256 |
2d521769752f35bfe8f432ece90a1b6ef162c54296b62564405f00fd7a6d7bb3
|