|
| 1 | +# Contributing to WorkflowAI |
| 2 | + |
| 3 | +## Setup |
| 4 | + |
| 5 | +### Prerequisites |
| 6 | + |
| 7 | +- [Poetry](https://python-poetry.org/docs/#installation) for dependency management and publishing |
| 8 | + |
| 9 | +### Getting started |
| 10 | + |
| 11 | +```bash |
| 12 | +# We recomment configuring the virtual envs in project with poetry so that |
| 13 | +# it can easily be picked up by IDEs |
| 14 | + |
| 15 | +# poetry config virtualenvs.in-project true |
| 16 | +poetry install --all-extras |
| 17 | + |
| 18 | +# Install the pre-commit hooks |
| 19 | +poetry run pre-commit install |
| 20 | +# or `make install` to install the pre-commit hooks and the dependencies |
| 21 | + |
| 22 | +# Check the code quality |
| 23 | +# Run ruff |
| 24 | +poetry run ruff check . |
| 25 | +# Run pyright |
| 26 | +poetry run pyright |
| 27 | +# or `make lint` to run ruff and pyright |
| 28 | + |
| 29 | +# Run the unit and integration tests |
| 30 | +# They do not require any configuration |
| 31 | +poetry run pytest --ignore=tests/e2e # make test |
| 32 | + |
| 33 | +# Run the end to end tests |
| 34 | +# They require the `WORKFLOWAI_TEST_API_URL` and `WORKFLOWAI_TEST_API_KEY` environment variables to be set |
| 35 | +# If they are present in the `.env` file, they will be picked up automatically |
| 36 | +poetry run pytest tests/e2e |
| 37 | +``` |
| 38 | + |
| 39 | +#### Configuring VSCode |
| 40 | + |
| 41 | +Suggested extensions are available in the [.vscode/extensions.json](.vscode/extensions.json) file. |
| 42 | + |
| 43 | +### Dependencies |
| 44 | + |
| 45 | +#### Ruff |
| 46 | + |
| 47 | +[Ruff](https://github.com/astral-sh/ruff) is a very fast Python code linter and formatter. |
| 48 | + |
| 49 | +```sh |
| 50 | +ruff check . # check the entire project |
| 51 | +ruff check src/workflowai/core # check a specific file |
| 52 | +ruff check . --fix # fix linting errors automatically in the entire project |
| 53 | +``` |
| 54 | + |
| 55 | +#### Pyright |
| 56 | + |
| 57 | +[Pyright](https://github.com/microsoft/pyright) is a static type checker for Python. |
| 58 | + |
| 59 | +> We preferred it to `mypy` because it is faster and easier to configure. |
| 60 | +
|
| 61 | +#### Pydantic |
| 62 | + |
| 63 | +[Pydantic](https://docs.pydantic.dev/) is a data validation library for Python. |
| 64 | +It provides very convenient methods to serialize and deserialize data, introspect its structure, set validation |
| 65 | +rules, etc. |
| 66 | + |
| 67 | +#### HTTPX |
| 68 | + |
| 69 | +[HTTPX](https://www.python-httpx.org/) is a modern HTTP library for Python. |
0 commit comments