An open API service indexing awesome lists of open source software.

https://github.com/flexcompute/flow360


https://github.com/flexcompute/flow360

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# Flow360

![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/flexcompute/Flow360/pypi-publish.yml)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/flexcompute/flow360/test.yml?label=tests)
[![PyPI version shields.io](https://img.shields.io/pypi/v/Flow360)](https://pypi.python.org/pypi/flow360/)

![](https://raw.githubusercontent.com/flexcompute/Flow360/main/img/Flow360-logo.svg)

# 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](https://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
0. clone repo
1. Install poetry ``pip install poetry``
2. ``poetry env activate`` gives you the command to activate the virtual environment, copy paste and run the command to enter the virtual environment. Or you can just prepend `poetry run` on all the python related commands.
3. 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. ``black .`` - performs auto-formatting
2. ``isort .`` - sorts imports
3. ``poetry run pylint $(git ls-files "flow360/*.py") --rcfile .pylintrc`` - checks code style
4. ``poetry run pytest -rA tests/simulation`` - run V2 related tests
5. ``poetry run pytest -rA --ignore tests/simulation`` - run V1 related tests (cannot be run altogether)
6. ``pytest -rA tests/simulation --cov-report=html --cov=flow360/component/simulation`` - see test coverage report for V2 client
7. ``pytest -rA --ignore tests/simulation --cov-report=html --cov=flow360 && open htmlcov/index.html`` - see test coverage report for V1+V2 client

## Documentation Requirements

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

```bash
poetry install -E docs
```

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

```bash
pip install -e .[docs]
```