Metadata-Version: 2.1
Name: saphira
Version: 0.0.11
Summary: Access parameters from the Saphira.ai SysEng SSoT
Author-email: Saphira AI <contact@saphira.ai>
License: MIT License
        
        Copyright (c) 2023 Saphira
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://www.saphira.ai
Keywords: saphira,parameter,hardware
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: ipynbname
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: bumpver; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: pip-tools; extra == "dev"
Requires-Dist: pytest; extra == "dev"

# 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 the API Token

If you have created a Saphira account, please click the [settings link](https://prod.saphira.ai/dashboard/settings) 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. 

# Setting Up and Using the API

To use the API, please make sure the environment variable SAPHIRA_API_TOKEN is set based on the value in the account you find above.

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)
```
