Skip to content

Commit

Permalink
Update README with new tools
Browse files Browse the repository at this point in the history
  • Loading branch information
lucabenvenuto committed Jul 30, 2024
1 parent f155a30 commit 19e5fa3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Binary file modified .docs/images/format.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .docs/images/pre-commit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ You only need to install [Docker](https://docs.docker.com/engine/install/) and [
To start the containers, just run `docker-compose up` (or `docker-compose up -d` if you want to run the containers in background); or `docker-compose create` and `docker-compose start` if you don't want to see the logs.
Once the containers are running, you can go to `http://localhost:8000/docs` to see the automatic interactive API documentation.

For making code changes, installing `pre-commit` is necessary (see section [Code tools: pre-commit](#pre-commit))

## Migrations
We use Alembic as database migration tool. To run its commands you can open an interactive shell inside the backend container (you can use `./exec.sh bash` shortcut), or use the following shortcuts under the `/scripts` directory:
- `./exec.sh migrate` -> runs all the migrations
Expand All @@ -39,14 +41,10 @@ Ensure everything was set up correctly by running the hooks:

You can add new `pre-commit` hooks by editing `.pre-commit-config.yaml`. Whenever new hooks are added, you must run `pre-commit install` to ensure new hooks are run on commit.

### Linting, formatting and type checking

Linters, formatters, etc.

- **Pycln**: Formatter for finding and removing unused import statements.
- **isort**: Tool to sort imports alphabetically and automatically separate into sections by type.
- **flake8**: Linting tool
- **ruff**: Linter and formatter
- **mypy**: Static type checker
- **black**: PEP 8 compliant opinionated formatter

There is a shortcut under the `/scripts` directory that runs all this tools for you (`./exec.sh format`).

Expand Down
6 changes: 6 additions & 0 deletions scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@

printf "\nRunning mypy...\n"
mypy src

printf "\nRunning ruff check...\n"
ruff check --fix

printf "\nRunning ruff format...\n"
ruff format

0 comments on commit 19e5fa3

Please sign in to comment.