Rosepy is the SimpleRose Python SDK for integrating Python scripts with the remote, distributed Rose solver to solve optimization problems.
Rosepy is an alternative to using the API directly, which allows you to
- Easily build models in pyomo and submit them to the Rose solver
- Submit preexisting models built in another tool
- Cancel any solves
Installation
To install the latest version of the rosepy package, use the following command.
pip install https://simplerose-packages-public.s3.us-east-1.amazonaws.com/rosepy/release/rosepy-0.20.1-py3-none-any.whl
Python versions up to 3.12 are currently supported.
Some newer Debian/Ubuntu builds mark the system Python as "externally managed," so you may get a PEP 668 error when you run pip install. If you hit an error like error: externally-managed-environment you can use on of the three options below.
- Use a virtual environment
- Use a Conda environment
- Install just for your user
pip install --user https://simplerose-packages-public...
Environment Variables
In order to authenticate you need to create an API key and secret. Follow the steps in the Creating an API key and secret article if you have not yet created an API key and secret.
- ROSEPY_API_KEY_ID - This is the ID of your API key
- ROSEPY_API_KEY_SECRET - This is the secret of your API key
For quick prototyping, you may temporarily set environment variables directly in your Python file, for example:
import os
os.environ["ROSEPY_API_KEY_ID"] = "<Your key ID here>"
os.environ["ROSEPY_API_KEY_SECRET"] = "<Your key secret here>"However, this is not recommended for production. Before sharing or deploying your code, remove these lines and use a secure method (e.g., .env files, secret managers, or system environment variables).
For other tips and information on using API keys, see our API key best practices.
Uses for rosepy
Now that you have rosepy configured, you can:
Comments
0 comments
Please sign in to leave a comment.