Skip to content

Commit

Permalink
Merge branch 'mealie-recipes:mealie-next' into mealie-next
Browse files Browse the repository at this point in the history
  • Loading branch information
catduckgnaf authored Jan 29, 2024
2 parents 64736ce + 84e981f commit 6ceb4d3
Show file tree
Hide file tree
Showing 121 changed files with 914 additions and 694 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN echo "export PROMPT_COMMAND='history -a'" >> /home/vscode/.bashrc \
&& echo "export HISTFILE=~/commandhistory/.bash_history" >> /home/vscode/.bashrc \
&& chown vscode:vscode -R /home/vscode/

RUN npm install -g @go-task/cli

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
Expand All @@ -37,4 +38,3 @@ RUN apt-get update \
libwebp-dev \
libsasl2-dev libldap2-dev libssl-dev \
gnupg gnupg2 gnupg1
# && pip install -U --no-cache-dir pip
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
],
// Use 'onCreateCommand' to run commands at the end of container creation.
// Use 'postCreateCommand' to run commands after the container is created.
"onCreateCommand": "sudo chown -R vscode:vscode /workspaces/mealie/frontend/node_modules && make setup",
"onCreateCommand": "sudo chown -R vscode:vscode /workspaces/mealie/frontend/node_modules && task setup",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
// "features": {
Expand Down
2 changes: 1 addition & 1 deletion .github/DISCUSSION_TEMPLATE/feature-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body:
options:
- label: I used the GitHub search to find a similar requests and didn't find it.
required: true
- label: Checked the [tasks tagged](https://github.com/hay-kot/mealie/issues?q=is%3Aissue+is%3Aopen+label%3Atask+) issues and verified my feature is not covered
- label: Checked the [tasks tagged](https://github.com/mealie-recipes/mealie/issues?q=is%3Aissue+is%3Aopen+label%3Atask+) issues and verified my feature is not covered
required: true
- type: textarea
id: problem
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/partial-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ jobs:

# Steps
steps:
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Check out repository
uses: actions/checkout@v4

Expand Down Expand Up @@ -69,7 +75,7 @@ jobs:
sudo apt-get update
sudo apt-get install libsasl2-dev libldap2-dev libssl-dev
poetry install
poetry add "psycopg2-binary==2.8.6"
poetry add "psycopg2-binary==2.9.9"
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' || steps.cache-validate.outputs.cache-hit-success != 'true'

- name: Formatting (Black)
Expand All @@ -78,11 +84,11 @@ jobs:
- name: Lint (Ruff)
run: |
make backend-lint
task py:lint
- name: Mypy Typecheck
run: |
make backend-typecheck
task py:mypy
- name: Pytest
env:
Expand All @@ -101,4 +107,4 @@ jobs:
LDAP_NAME_ATTRIBUTE: cn
LDAP_MAIL_ATTRIBUTE: mail
run: |
make backend-test
task py:test
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: "🚀 Version {{ EVENT_PAYLOAD.release.tag_name }} of Mealie has been released. See the release notes https://github.com/hay-kot/mealie/releases/tag/{{ EVENT_PAYLOAD.release.tag_name }}"
args: "🚀 Version {{ EVENT_PAYLOAD.release.tag_name }} of Mealie has been released. See the release notes https://github.com/mealie-recipes/mealie/releases/tag/{{ EVENT_PAYLOAD.release.tag_name }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,4 @@ lcov.info
dev/code-generation/openapi.json

.run/
.task/*
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ repos:
- id: trailing-whitespace
exclude: ^tests/data/
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.1.0
hooks:
- id: black
23 changes: 5 additions & 18 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "DEV: Build and Start Docker Compose",
"command": "make docker-dev",
"type": "shell",
"args": [],
"problemMatcher": [
"$tsc"
],
"presentation": {
"reveal": "always"
},
"group": "test"
},
{
"label": "Production: Build and Start Docker Compose",
"command": "make docker-prod",
"command": "task docker:prod",
"type": "shell",
"args": [],
"problemMatcher": [
Expand All @@ -29,7 +16,7 @@
},
{
"label": "Dev: Start Backend",
"command": "make backend",
"command": "task py",
"type": "shell",
"presentation": {
"reveal": "always",
Expand All @@ -49,7 +36,7 @@
},
{
"label": "Dev: Start Frontend",
"command": "make frontend",
"command": "task ui",
"type": "shell",
"presentation": {
"reveal": "always",
Expand All @@ -59,7 +46,7 @@
},
{
"label": "Dev: Start Docs Server",
"command": "make docs",
"command": "task docs",
"type": "shell",
"presentation": {
"reveal": "always",
Expand All @@ -69,7 +56,7 @@
},
{
"label": "Run python tests",
"command": "make test",
"command": "task py:test",
"type": "shell",
"presentation": {
"reveal": "always"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Thanks to Linode for providing Hosting for the Demo, Beta, and Documentation sit
[stars-url]: https://github.com/mealie-recipes/mealie/stargazers
[issues-shield]: https://img.shields.io/github/issues/mealie-recipes/mealie.svg?style=flat-square
[issues-url]: https://github.com/mealie-recipes/mealie/issues
[latest-release-shield]: https://img.shields.io/github/v/release/mealie-recipes/mealie.svg?style=flat-square
[latest-release-shield]: https://img.shields.io/github/v/release/mealie-recipes/mealie?style=flat-square&label=latest%20release
[latest-release-url]: https://img.shields.io/github/v/release/mealie-recipes/mealie
[license-shield]: https://img.shields.io/github/license/mealie-recipes/mealie.svg?style=flat-square
[license-url]: https://github.com/mealie-recipes/mealie/blob/mealie-next/LICENSE
Expand Down
183 changes: 183 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# https://taskfile.dev

version: "3"
vars:
GREETING: Hello, World!
env:
DEFAULT_GROUP: Home
PRODUCTION: false
API_PORT: 9000
API_DOCS: True
TOKEN_TIME: 256 # hours
# mailplit SMTP config
# start dev:services to use mailpit
SMTP_HOST: localhost
SMTP_PORT: 1025
SMTP_FROM_NAME: MealieDev
SMTP_AUTH_STRATEGY: NONE
LANG: en-US

# loads .env file if it exists
dotenv:
- .env
- .dev.env
tasks:
docs:gen:
desc: runs the API documentation generator
cmds:
- poetry run python dev/code-generation/gen_docs_api.py

docs:
desc: runs the documentation server
dir: docs
deps:
- docs:gen
cmds:
- poetry run python -m mkdocs serve

setup:ui:
desc: setup frontend dependencies
dir: frontend
cmds:
- yarn install

setup:py:
desc: setup python dependencies
cmds:
- poetry install --with main,dev,postgres
- poetry run pre-commit install

setup:model:
desc: setup nlp model
vars:
MODEL_URL: https://github.com/mealie-recipes/nlp-model/releases/download/v1.0.0/model.crfmodel
OUTPUT: ./mealie/services/parser_services/crfpp/model.crfmodel
sources:
# using pyproject.toml as the dependency since this should only ever need to run once
# during setup. There is perhaps a better way to do this.
- ./pyproject.toml
generates:
- ./mealie/services/parser_services/crfpp/model.crfmodel
cmds:
- curl -L0 {{ .MODEL_URL }} --output {{ .OUTPUT }}

setup:
desc: setup all dependencies
deps:
- setup:ui
- setup:py
- setup:model

dev:generate:
desc: run code generators
cmds:
- poetry run python dev/code-generation/main.py

dev:services:
desc: starts postgres and mailpit containers
dir: docker
cmds:
- docker compose -f docker-compose.dev.yml up

dev:clean:
desc: cleans up dev environment !! removes all data files !!
vars:
DEV_DATA: ""
cmds:
- rm -r ./dev/data/recipes/
- rm -r ./dev/data/users/
- rm -f ./dev/data/mealie*.db
- rm -f ./dev/data/mealie.log
- rm -f ./dev/data/.secret

py:mypy:
desc: runs python type checking
cmds:
- poetry run mypy mealie

py:test:
desc: runs python tests (support args after '--')
cmds:
- poetry run pytest {{ .CLI_ARGS }}

py:format:
desc: runs python code formatter
cmds:
- poetry run black mealie

py:lint:
desc: runs python linter
cmds:
- poetry run ruff mealie

py:check:
desc: runs all linters, type checkers, and formatters
deps:
- py:format
- py:lint
- py:mypy
- py:test

py:coverage:
desc: runs python coverage and generates html report
cmds:
- poetry run pytest
- poetry run coverage report -m
- poetry run coveragepy-lcov
- poetry run coverage html
- open htmlcov/index.html

py:
desc: runs the backend server
cmds:
- poetry run python mealie/db/init_db.py
- poetry run python mealie/app.py

py:postgres:
desc: runs the backend server configured for containerized postgres
env:
DB_ENGINE: postgres
POSTGRES_USER: mealie
POSTGRES_PASSWORD: mealie
POSTGRES_SERVER: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: mealie
cmds:
- poetry run python mealie/db/init_db.py
- poetry run python mealie/app.py

ui:build:
desc: builds the frontend in frontend/dist
dir: frontend
cmds:
- yarn build

ui:lint:
desc: runs the frontend linter
dir: frontend
cmds:
- yarn lint

ui:test:
desc: runs the frontend tests
dir: frontend
cmds:
- yarn test

ui:check:
desc: runs all frontend checks
deps:
- ui:lint
- ui:test

ui:
desc: runs the frontend server
dir: frontend
cmds:
- yarn run dev

docker:prod:
desc: builds and runs the production docker image locally
dir: docker
cmds:
- docker compose -f docker-compose.yml -p mealie up -d --build
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Initial tables
Revision ID: 6b0f5f32d602
Revises:
Revises:
Create Date: 2022-02-21 19:56:24.351115
"""

import sqlalchemy as sa
from sqlalchemy import engine_from_config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-03-23 17:43:34.727829
"""

import sqlalchemy as sa

from alembic import op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-03-27 19:30:28.545846
"""

import sqlalchemy as sa

from alembic import op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-03-31 19:19:55.428965
"""

import sqlalchemy as sa

import mealie.db.migration_types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-03 10:48:51.379968
"""

import sqlalchemy as sa

import mealie.db.migration_types # noqa: F401
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-06-01 11:12:06.748383
"""

import sqlalchemy as sa

from alembic import op
Expand Down
Loading

0 comments on commit 6ceb4d3

Please sign in to comment.