Saphira Python Setup
To get the Python set up, just run the following command from any standard command line tool:
pip install saphira
We currently support Python >= 3.9, but can introduce other support if needed. Please reach out to founders@saphira.ai if this is needed.
Getting & Setting the API Token
If you have created a Saphira account, please click the settings link and scroll down to API token on the General tab to see the API token. This token will not change and will be the same token throughout using our API.
To set the API token, please make sure the environment variable SAPHIRA_API_TOKEN is set based on the value in the account you find above.
Setting Up and Using the API
To access individual values linked to requirements of a specific project, please use the command below:
saphira.get_param(<project>, <req>)
One idiosyncrasy is that the project ID currently contains .json, so copy that full value from the URL. Additionally, the requirement value is just the requirement name.
Using the CLI
Simply pass the project_id and pipe in details, starting with the unique test name on its own line:
cat test.txt | python -m saphira <uuid>.json
API Outputs
When you call API, we capture the script that the API is referenced in. As a longer term initiative, we could version these scripts and even surface this whole script collection within a git repo.
While get_param instantiates the test that you see in the UI, update_test_status marks it as passing or failing. As you can see from the lib header, we offer a few different possible inputs:
update_test_status(project: str, requirement: str, passing: bool = False, test_result: Optional[TestResult] = None, exception: Exception = None)
Note that we’ll treat the filename as the test name, which is why you don’t have to manually pass it here. Furthermore, the TestResult type is from UnitTest, so that you can do the following:
test = unittest.main(exit=False)
saphira.update_test_status(PROJECT, REQ, test_result=test.result)
Finally, you could alternatively pass an exception, like this:
except Exception as e:
saphira.update_test_status(PROJECT, REQ, exception=e)
Metadata
Release files for saphira 0.0.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| saphira-0.0.16.tar.gz | 8.2 kB | Without provenance | Details for saphira-0.0.16.tar.gz |
Release files / saphira-0.0.16.tar.gz
| Download URL | saphira-0.0.16.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a1fe1fc7342dc0bd6a8c1ca18492915a1e70619e0626c5ac8de4273bb91e0cf
|
|
BLAKE2b-256 checksum How to use checksums |
a39b5ec57062632ae704d276d4e50d4f6b33da54da04027541fdb9aab37aa4ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for saphira 0.0.16
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.