Skip to content

Development Environment

nh916 edited this page Jul 31, 2023 · 3 revisions

Setting Up the Development Environment

  1. clone the repository
  2. install requirements_dev.txt
    • pip install -r requirements_dev.txt
    • pip install -r requirements_docs.txt

      in case of doing documentation work and need to run the documentation locally

    Refer to requirements.txt wiki for more information

  3. make necessary changes
  4. test your code by running all the tests and being sure they pass

Environment Variables

For development and CI, CRIPT Python SDK expects some variables on the machine and if it does not exist it might throw an error.

CRIPT_TESTS

If this is set to True then pytest, will run all integration tests, otherwise if set to False or if it doesn't exist then it will skip them. The value for the HAS_INTEGRATION_TESTS_ENABLED variable can be changed manually within conftest.py

CRIPT_HOST

This is the variable that specifies the host, used for testing in conftest.py to test the Python SDK against the API. It can be manually set within conftest.py if needed.

Example

http://mycriptapp.org

CRIPT_TOKEN

This is the variable that specifies the API token used for testing in conftest.py to test the Python SDK against the API. It can be manually set within conftest.py if needed.

Example

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

CRIPT_STORAGE_TOKEN

This is the variable that specifies cloud storage token to upload local files, and is used for testing in conftest.py to test the Python SDK against the API. It can be manually set within conftest.py if needed.

Manually Changing env vars

You can manually set the variable values that are set via environment variables

# flip to True or False if you want to run integration tests or not
HAS_INTEGRATION_TESTS_ENABLED: bool = False

# you can manually set these variables to make testing easier and quicker
# WARNING: be sure to remove ALL sensitive tokens/data from script before pushing/committing anything to the repo
host: str = "mycriptapp.org"
api_token: str = "my secret token"
storage_token: str = "my cloud secret token"

with cript.API(host=host, api_token=api_token, storage_token=storage_token) as api:

Getting Tokens

Please refer to CRIPT Python SDK user documentation on getting CRIPT Tokens for local testing.

Note: You must have a CRIPT account to get a CRIPT Token.

Warning: Please be sure to guard your tokens as they are sensitive and should never be pushed to any GitHub repository where it could create a security incident.