Utilities for interacting with Sermos.
To deploy your application to Sermos, there are a few prerequisites:
- Deployment environment created and configured
access keyhas been issued for that deployment
- Your app is a valid Python package with a standard structure (see below)
- You have a
sermos.yamlfile written with your defined API endpoints, workers, etc.
- Your application has
sermos-utilsas a dependency and it's installed.
You can initiate a Sermos deployment in two ways: programmatically or using the CLI tool.
It is recommended to keep your access key in the environment and to set the client package directory in the environment as well, for convenience.
Invoking a pipeline programmatically (e.g. as part of a build pipeline) can be done similar to below (assumes access key/client package directory are available in the environment per note above).
from sermos_utils.deploy import SermosDeploy sd = SermosDeploy() status = sd.invoke_deployment() print(status)
For a cli-based deployment, there is a
sermos_deploy command installed
as part of the sermos-utils package.
honcho run -e .env sermos_deploy
Assuming your environment is set up per notes in the
Deployment section above:
Programmatic Status Checks
from sermos_utils.deploy import SermosDeploy sd = SermosDeploy() status = sd.get_deployment_status() print(status)
CLI Status Checks
honcho run -e .env sermos_status
Proper Python Package Structure
Assuming your package is called "my_sermos_client":
/path/to/codebase/ my-sermos-client/ setup.py my_sermos_client/ __init__.py sermos.yaml
my_sermos_client/__init__.py has only one requirement, to contain your
application's version assigned as a variable
__version__ = '0.1.0'
Common practice is to use that value in your
setup.py file, e.g.
_version_re = re.compile(r'__version__\s+=\s+(.*)') with open('my_sermos_client/__init__.py', 'rb') as f: __version__ = str(ast.literal_eval(_version_re.search( f.read().decode('utf-8')).group(1)))
Sermos provides a local development environment in two ways:
- Local 'sandbox' environment
- Cloud-connected environment that proxies into your deployment's databases
sermos-utils/dev/README.md for more information.
To run the tests you need to have
pyenv running on your system and
Refer to RhoAI documentation for instructions on installing
pyenv is intalled, then install
$ pip install tox
Then install the different python versions in
$ pyenv install 3.7.4
Now, run the tests:
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size sermos-utils-0.22.1.tar.gz (19.1 kB)||File type Source||Python version None||Upload date||Hashes View|