1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 23:59:45 +02:00

improve developer tooling (backend) (#1051)

* add basic pre-commit file

* add flake8

* add isort

* add pep585-upgrade (typing upgrades)

* use namespace for import

* add mypy

* update ci for backend

* flake8 scope

* fix version format

* update makefile

* disable strict option (temporary)

* fix mypy issues

* upgrade type hints (pre-commit)

* add vscode typing check

* add types to dev deps

* remote container draft

* update setup script

* update compose version

* run setup on create

* dev containers update

* remove unused pages

* update setup tips

* expose ports

* Update pre-commit to include flask8-print (#1053)

* Add in flake8-print to pre-commit

* pin version of flake8-print

* formatting

* update getting strated docs

* add mypy to pre-commit

* purge .mypy_cache on clean

* drop mypy

Co-authored-by: zackbcom <zackbcom@users.noreply.github.com>
This commit is contained in:
Hayden 2022-03-15 15:01:56 -08:00 committed by GitHub
parent e109391e9a
commit 3c2744a3da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 723 additions and 437 deletions

View file

@ -1,7 +0,0 @@
# Guidelines
## Python
## Vue
[See The Style Guide](../developers-guide/style-guide.md)

View file

@ -1,26 +1,30 @@
# Development: Getting Started
!!! warning
Be sure to use the [Nightly version](https://nightly.mealie.io/) of the docs to ensure you're up to date with
Be sure to use the [Nightly version](https://nightly.mealie.io/) of the docs to ensure you're up to date with
the latest changes.
After reading through the [Code Contributions Guide](../developers-guide/code-contributions.md) and forking the repo you can start working. This project is developed with :whale: docker and as such you will be greatly aided by using docker for development. It's not necessary but it is helpful.
## With Docker
!!! error "Broken"
Developing with Docker is currently broken. Please use the "Without Docker" instructions until this is resolved, or better yet help us fix it!
- [PR #756 - add frontend developer dockerfile](https://github.com/hay-kot/mealie/pull/756)
## With VS Code Dev Containers
Prerequisites
- Docker
- docker-compose
- Visual Studio Code
You can easily start the development stack by running `make docker-dev` in the root of the project directory. This will run and build the docker-compose.dev.yml file.
First ensure that docker is running. Then when you clone the repo and open with VS Code you should see a popup asking you to reopen the project inside a development container. Click yes and it will build the development container and run the setup required to run both the backend API and the frontend webserver. This also pre-configures pre-commit hooks to ensure that the code is up to date before committing.
## Without Docker
Checkout the makefile for all of the available commands.
!!! tip
For slow terminal checkout the solution in this [GitHub Issue](https://github.com/microsoft/vscode/issues/133215)
```bash
git config oh-my-zsh.hide-info 1
```
## Without Dev Containers
### Prerequisites
- [Python 3.10](https://www.python.org/downloads/)
@ -30,7 +34,7 @@ You can easily start the development stack by running `make docker-dev` in the r
### Installing Dependencies
Once the prerequisites are installed you can cd into the project base directory and run `make setup` to install the python and node dependencies.
Once the prerequisites are installed you can cd into the project base directory and run `make setup` to install the python and node dependencies.
=== "Linux / MacOs"
@ -65,8 +69,8 @@ Once that is complete you're ready to start the servers. You'll need two shells
=== "Linux / MacOs"
```bash
# Terminal #1
make backend
# Terminal #1
make backend
# Terminal #2
make frontend
@ -84,35 +88,29 @@ Once that is complete you're ready to start the servers. You'll need two shells
yarn run dev
```
## Make File Reference
## Make File Reference
Run `make help` for reference. If you're on a system that doesn't support makefiles in most cases you can use the commands directly in your terminal by copy/pasting them from the Makefile.
```
purge ⚠️ Removes All Developer Data for a fresh server start
clean 🧹 Remove all build, test, coverage and Python artifacts
clean-pyc 🧹 Remove Python file artifacts
clean-test 🧹 Remove test and coverage artifacts
test-all 🧪 Check Lint Format and Testing
test 🧪 Run tests quickly with the default Python
lint 🧺 Format, Check and Flake8
coverage ☂️ Check code coverage quickly with the default Python
docs 📄 Start Mkdocs Development Server
code-gen 🤖 Run Code-Gen Scripts
setup 🏗 Setup Development Instance
setup-model 🤖 Get the latest NLP CRF++ Model
clean-data ⚠️ Removes All Developer Data for a fresh server start
clean-pyc 🧹 Remove Python file artifacts
clean-test 🧹 Remove test and coverage artifacts
backend-clean 🧹 Remove all build, test, coverage and Python artifacts
backend-test 🧪 Run tests quickly with the default Python
backend-format 🧺 Format, Check and Flake8
backend-all 🧪 Runs all the backend checks and tests
backend-coverage ☂️ Check code coverage quickly with the default Python
backend 🎬 Start Mealie Backend Development Server
frontend 🎬 Start Mealie Frontend Development Server
frontend-build 🏗 Build Frontend in frontend/dist
frontend-generate 🏗 Generate Code for Frontend
frontend-lint 🧺 Run yarn lint
docs 📄 Start Mkdocs Development Server
docker-dev 🐳 Build and Start Docker Development Stack
docker-prod 🐳 Build and Start Docker Production Stack
code-gen 🤖 Run Code-Gen Scripts
```
## Before you Commit!
Before you commit any changes on the backend/python side you'll want to run `make format` to format all the code with black. `make lint` to check with flake8, and `make test` to run pytests. You can also use `make test-all` to run both `lint` and `test`.
Run into another issue? [Ask for help on discord](https://discord.gg/QuStdQGSGK)

View file

@ -1,33 +0,0 @@
# Style Guide
!!! note
Unifying styles across the application is an ongoing process, we are working on making the site more consistent.
## Button Guidelines
1. Buttons should follow the general color/icon scheme as outlined.
2. All buttons should have an icon on the left side of the button and text on the right.
3. Primary action buttons should be the default Vuetify styling.
4. Primary action buttons should be right aligned
5. Secondary buttons should be `text` or `outlined`. Text is preferred
6. Other buttons should generally be "info" or "primary" color and can take any style type depending on context
### Button Colors and Icons
| Type | Color | Icon |
| ----------- | :------------------ | :------------------------------------------------- |
| Default | `info` or `primary` | None |
| Create/New | `success` | `mdi-plus` or `$globals.icons.create` |
| Update/Save | `success` | `mdi-save-content` or `$globals.icons.save` |
| Edit | `info` | `mdi-square-edit-outline` or `$globals.icons.edit` |
### Example
```html
<v-btn color="primary">
<v-icon left> mdi-plus </v-icon>
Primary Button
</v-btn>
```

File diff suppressed because one or more lines are too long

View file

@ -82,8 +82,6 @@ nav:
- Developers Guide:
- Code Contributions: "contributors/developers-guide/code-contributions.md"
- Dev Getting Started: "contributors/developers-guide/starting-dev-server.md"
- Guidelines: "contributors/developers-guide/general-guidelines.md"
- Style Guide: "contributors/developers-guide/style-guide.md"
- Guides:
- Improving Ingredient Parser: "contributors/guides/ingredient-parser.md"