Skip to content

flexcompute/Flow360

Repository files navigation

Flow360

GitHub Workflow Status GitHub Workflow Status PyPI version shields.io

How to use Flow360 python client

install

Using pip (recommended)

pip install flow360

install pre-release version

pip install -U flow360 --pre

client config api-key

Get your api-key from flow360.simulation.cloud

You can set your api-key by ONE of the following methods:

  1. Set globaly for your acount: flow360 configure will store api-key in ~/.flow360
  2. In shell:
    • Bash/Zsh shell (Linux or Mac): export FLOW360_APIKEY="my api-key"
    • Powershell (Windows): $Env:FLOW360_APIKEY="my api-key"
  3. In python script: os.environ["FLOW360_APIKEY"] = "my api-key" before or after import flow360

NOTE

Environment FLOW360_APIKEY variable takes precedence before Flow360 configure file generated by flow360 configure


run examples:

  1. Get examples from this repository:
    1. git clone https://github.com/flexcompute/Flow360.git
    2. cd Flow360/examples
  2. run python case_results.py

Development

setup

  1. clone repo
  2. Install poetry pip install poetry
  3. Activate poetry shell poetry shell
  4. Install dependencies: poetry install

run examples

  • python examples/case_results.py
  • You can also run examples without activating shell:
    poetry run python examples/case_results.py

check in

  1. poetry run pytest -rA
  2. black . - performs auto-formatting
  3. isort . - sorts imports
  4. pylint flow360 --rcfile .pylintrc - checks code style
  5. pytest tests --cov-report=html --cov=flow360 && open htmlcov/index.html - see test coverage report

Documentation Requirements

If you want to install the requirements to locally build the documentation you can run:

poetry install -E docs

Alternatively, you can also install the extra in any pip-controlled venv:

pip install -e .[docs]