Skip to main content

Access parameters from the Saphira.ai SysEng SSoT

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

saphira-0.0.16.tar.gz (8.2 kB view details)

Uploaded Source

File details

Details for the file saphira-0.0.16.tar.gz.

File metadata

  • Download URL: saphira-0.0.16.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for saphira-0.0.16.tar.gz
Algorithm Hash digest
SHA256 6a1fe1fc7342dc0bd6a8c1ca18492915a1e70619e0626c5ac8de4273bb91e0cf
MD5 fbda1a3bf5986279f110f92b72a7f3de
BLAKE2b-256 a39b5ec57062632ae704d276d4e50d4f6b33da54da04027541fdb9aab37aa4ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page