Sardou TOSCA Library
Project description
TOSCA in Swarmchestrate
This repository is home to TOSCA in the Swarmchestrate project, which will use TOSCA v2.0 to describe applications and capacities managed in a Swarmchestrate Universe.
Sardou TOSCA Library
Sardou validates and extracts info from a Swarmchestrate TOSCA template.
Prerequisites
- Python 3.10+
- Puccini: The current stable version can be found here Go-Puccini 0.22.x
- Minimum GLIBC 2.34 (Ubuntu 22.04 or higher)
Install Puccini on Linux by:
wget https://github.com/tliron/go-puccini/releases/download/v0.22.7/puccini_0.22.7_linux_amd64.deb && \
sudo dpkg -i puccini_0.22.7_linux_amd64.deb || sudo apt --fix-broken install -y && \
rm -f puccini_0.22.7_linux_amd64.deb
Installation
Install using the PyPi package
pip install Sardou
Usage
Import the Sardou TOSCA Library
from sardou import Sardou # note the uppercase F
Create a new Sardou object, passing it the path to your Swarmchestrate TOSCA template.
This will validate the template. If there are errors or warnings, they will be presented here.
>>> tosca = Sardou("my_app.yaml")
Processed successfully: my_app.yaml
Grab the QoS requirements as a Python object. You could wrap this as a dictionary and dump to JSON or YAML.
>>> tosca.get_qos()
[{'energy': {'type': 'swch:QoS.Energy.Budget', 'properties': {'priority': 0.3, 'target': 10}}}...
Grab the Resource requirements as a Python object. You could dump this to JSON or YAML.
>>> tosca.get_requirements()
{'worker-node': {'metadata': {'created_by': 'floria-tosca-lib', 'created_at': '2025-09-16T14:51:24Z', 'description': 'Generated from node worker-node', 'version': '1.0'}, 'capabilities': {'host': {'properties': {'num-cpus': {'$greater_than': 4}, 'mem-size': {'$greater_than': '8 GB'}}}, ...
You can traverse YAML maps using dot notation if needed.
>>> tosca.service_template.node_templates
{'swarm': {'type': 'swch:Swarm', 'directives': ['substitute']}, ...
Devs
It is recommended that developers open a GitHub Codespace on this repository, which includes dependencies and a Makefile for running Puccini manually.
TOSCA Template Validation with Puccini
This is an added feature that provides a Python validation library and script to check whether TOSCA service templates are valid using the Go-Puccini parser.
Validation Library (lib/validation.py )
- A library that defines the
validate_template()function to validate a single TOSCA YAML file. - Returns
Trueif the template is valid,Falseif not.
Validation Script (run_validation.py)
- A script that searches the
templates/folder and validates all.yamlfiles in one run. - Prints total successes/failures and exits with code
1if any file fails.
Run:
python3 run_validation.py
Contact
Contact Jay at Westminster for support with TOSCA and/or this repository.
Project details
Release history Release notifications | RSS feed
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 sardou-0.2.4.tar.gz.
File metadata
- Download URL: sardou-0.2.4.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efe186b115aacea87077162aa99f46ecfeaa9f840f00bac391b5382427dd9cdb
|
|
| MD5 |
5cd6131ccf595589c821d44cbd6d9ba5
|
|
| BLAKE2b-256 |
c7beb290b2f959da2e4b558f5085c4b40edfc22f4d2a6999b0804eec41fb76d4
|
File details
Details for the file sardou-0.2.4-py3-none-any.whl.
File metadata
- Download URL: sardou-0.2.4-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2896916a79b174b6c2ab9ce24ecf62845c976d1fbb0356f25c5f7c7b4309c35
|
|
| MD5 |
e84b6d5e998a6b9730a3ddb5742f5c03
|
|
| BLAKE2b-256 |
750439ed16bede524a59e6439fc6d78ee145c9cd0a79b681c8ce93ac84bd2b0e
|