Compare commits
3 Commits
0.1.0
...
eb1d1e1dd3
| Author | SHA1 | Date | |
|---|---|---|---|
| eb1d1e1dd3 | |||
| 21ffc736bc | |||
| e6e7c20479 |
30
.pre-commit-config.yaml
Normal file
30
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v2.7.4
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
args: [--py37-plus]
|
||||||
|
|
||||||
|
- repo: https://github.com/codespell-project/codespell
|
||||||
|
rev: v2.0.0
|
||||||
|
hooks:
|
||||||
|
- id: codespell
|
||||||
|
args:
|
||||||
|
- --ignore-words-list=sigl
|
||||||
|
- --skip="./.*,*.csv,*.json"
|
||||||
|
- --quiet-level=2
|
||||||
|
exclude_types: [csv, json]
|
||||||
|
|
||||||
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
|
rev: 3.8.4
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
additional_dependencies:
|
||||||
|
- flake8-docstrings==1.5.0
|
||||||
|
- pydocstyle==5.1.1
|
||||||
|
files: ^(sigl|tests)/.+\.py$
|
||||||
|
|
||||||
|
- repo: https://github.com/PyCQA/isort
|
||||||
|
rev: 5.5.3
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
19
README.md
19
README.md
@@ -1,3 +1,22 @@
|
|||||||
# Simple Grocery List (Sigl)
|
# Simple Grocery List (Sigl)
|
||||||
|
|
||||||
Simple Grocery List, or **Sigl** (pronounced "sigil") is a lightweight shopping list manager designed for shared grocery lists (or any other shopping list). Sigl is designed to be intuitive and flexible, emphasizing an ad-hoc approach to shopping lists rather than "recipe" based lists.
|
Simple Grocery List, or **Sigl** (pronounced "sigil") is a lightweight shopping list manager designed for shared grocery lists (or any other shopping list). Sigl is designed to be intuitive and flexible, emphasizing an ad-hoc approach to shopping lists rather than "recipe" based lists.
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
Install [Docker](https://www.docker.com/) and
|
||||||
|
[Docker Compose](https://docs.docker.com/compose/install/) for your platform.
|
||||||
|
Then run the following commands to clone the Jade Tree repository and run a
|
||||||
|
local instance of Jade Tree on your machine. Note that the database migration
|
||||||
|
only has to be done once to set up a fresh database or to upgrade a database to
|
||||||
|
the latest schema.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ git clone https://github.com/asymworks/sigl.git sigl
|
||||||
|
$ docker-compose -f sigl/docker-compose.yaml up -d
|
||||||
|
$ docker-compose -f sigl/docker-compose.yaml \
|
||||||
|
exec app /home/sigl/docker-entry.sh db upgrade
|
||||||
|
$ docker-compose -f sigl/docker-compose.yaml restart app
|
||||||
|
```
|
||||||
|
|
||||||
|
Then access the Sigl server at http://localhost:5151
|
||||||
|
|||||||
18
docker-compose.yaml
Normal file
18
docker-compose.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
#
|
||||||
|
# Docker Compose File for Sigl Server
|
||||||
|
#
|
||||||
|
|
||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: asymworks/sigl:latest
|
||||||
|
ports:
|
||||||
|
- 5151:5151
|
||||||
|
volumes:
|
||||||
|
- sigl_data:/var/lib/sigl
|
||||||
|
- ./docker/config.py:/home/sigl/config.py:ro
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
sigl_data:
|
||||||
@@ -8,15 +8,11 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
|||||||
def init_shell(): # pragma: no cover
|
def init_shell(): # pragma: no cover
|
||||||
"""Initialize the Flask Shell Context."""
|
"""Initialize the Flask Shell Context."""
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from sigl.database import db
|
from sigl.database import db
|
||||||
from sigl.domain.models import (
|
from sigl.domain.models import ListEntry, Product, ProductLocation, ShoppingList
|
||||||
ListEntry,
|
|
||||||
Product,
|
|
||||||
ProductLocation,
|
|
||||||
ShoppingList,
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
# Imports
|
# Imports
|
||||||
|
|||||||
@@ -4,27 +4,18 @@ Simple Grocery List (Sigl) | sigl.app
|
|||||||
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from sigl.domain.models import (
|
from sigl.domain.models import Product, ProductLocation
|
||||||
Product,
|
|
||||||
ProductLocation,
|
|
||||||
)
|
|
||||||
from sigl.domain.models.list import ListEntry, ShoppingList
|
from sigl.domain.models.list import ListEntry, ShoppingList
|
||||||
|
|
||||||
from .globals import db
|
from .globals import db
|
||||||
from .tables import (
|
from .tables import list_entries, lists, product_locations, products
|
||||||
list_entries,
|
|
||||||
lists,
|
|
||||||
product_locations,
|
|
||||||
products,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = ('init_orm', )
|
__all__ = ('init_orm', )
|
||||||
|
|
||||||
|
|
||||||
def init_orm():
|
def init_orm():
|
||||||
"""Initialize the Sigl ORM."""
|
"""Initialize the Sigl ORM."""
|
||||||
|
# List Entries
|
||||||
# # List Entries
|
|
||||||
db.mapper(ListEntry, list_entries, properties={
|
db.mapper(ListEntry, list_entries, properties={
|
||||||
'product': db.relationship(
|
'product': db.relationship(
|
||||||
Product,
|
Product,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import List, TYPE_CHECKING
|
from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
from .mixins import NotesMixin, TimestampMixin
|
from .mixins import NotesMixin, TimestampMixin
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from typing import List, Optional, Union
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from sigl.exc import DomainError, NotFoundError
|
from sigl.exc import DomainError, NotFoundError
|
||||||
|
|
||||||
from .models import ListEntry, Product, ProductLocation, ShoppingList
|
from .models import ListEntry, Product, ProductLocation, ShoppingList
|
||||||
|
|
||||||
|
|
||||||
@@ -140,7 +141,7 @@ def list_stores(session: Session, id: Optional[int]) -> List[str]:
|
|||||||
Product has locations are returned.
|
Product has locations are returned.
|
||||||
"""
|
"""
|
||||||
if id is None:
|
if id is None:
|
||||||
return list(set([loc.store for loc in session.query(ProductLocation).all()]))
|
return list({loc.store for loc in session.query(ProductLocation).all()})
|
||||||
|
|
||||||
sList = list_by_id(session, id)
|
sList = list_by_id(session, id)
|
||||||
if not sList:
|
if not sList:
|
||||||
|
|||||||
@@ -6,17 +6,32 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
|||||||
|
|
||||||
from flask import (
|
from flask import (
|
||||||
Blueprint,
|
Blueprint,
|
||||||
flash, jsonify, make_response, redirect, render_template, request, url_for
|
flash,
|
||||||
|
jsonify,
|
||||||
|
make_response,
|
||||||
|
redirect,
|
||||||
|
render_template,
|
||||||
|
request,
|
||||||
|
url_for,
|
||||||
)
|
)
|
||||||
|
|
||||||
from sigl.exc import DomainError, Error, NotFoundError
|
|
||||||
from sigl.database import db
|
from sigl.database import db
|
||||||
from sigl.domain.service import (
|
from sigl.domain.service import (
|
||||||
list_entry_by_id, lists_all, list_by_id, list_create, list_delete,
|
list_addItem,
|
||||||
list_update, list_addItem, list_deleteItem, list_editItem, list_stores,
|
list_by_id,
|
||||||
list_deleteCrossedOff, list_entry_set_crossedOff,
|
list_create,
|
||||||
|
list_delete,
|
||||||
|
list_deleteCrossedOff,
|
||||||
|
list_deleteItem,
|
||||||
|
list_editItem,
|
||||||
|
list_entry_by_id,
|
||||||
|
list_entry_set_crossedOff,
|
||||||
|
list_stores,
|
||||||
|
list_update,
|
||||||
|
lists_all,
|
||||||
products_all,
|
products_all,
|
||||||
)
|
)
|
||||||
|
from sigl.exc import DomainError, Error, NotFoundError
|
||||||
|
|
||||||
__all__ = ('bp', )
|
__all__ = ('bp', )
|
||||||
|
|
||||||
|
|||||||
@@ -4,23 +4,20 @@ Simple Grocery List (Sigl) | sigl.app
|
|||||||
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from flask import (
|
from flask import Blueprint, flash, redirect, render_template, request, url_for
|
||||||
Blueprint,
|
|
||||||
flash, redirect, render_template, request, url_for
|
|
||||||
)
|
|
||||||
|
|
||||||
from sigl.exc import Error, NotFoundError
|
|
||||||
from sigl.database import db
|
from sigl.database import db
|
||||||
from sigl.domain.service import (
|
from sigl.domain.service import (
|
||||||
list_stores,
|
list_stores,
|
||||||
products_all,
|
product_addLocation,
|
||||||
product_by_id,
|
product_by_id,
|
||||||
product_create,
|
product_create,
|
||||||
product_delete,
|
product_delete,
|
||||||
product_update,
|
|
||||||
product_addLocation,
|
|
||||||
product_removeLocation,
|
product_removeLocation,
|
||||||
|
product_update,
|
||||||
|
products_all,
|
||||||
)
|
)
|
||||||
|
from sigl.exc import Error, NotFoundError
|
||||||
|
|
||||||
__all__ = ('bp', )
|
__all__ = ('bp', )
|
||||||
|
|
||||||
|
|||||||
@@ -6,5 +6,4 @@ Copyright (c) 2022 Asymworks, LLC. All Rights Reserved.
|
|||||||
|
|
||||||
from .factory import create_app
|
from .factory import create_app
|
||||||
|
|
||||||
|
|
||||||
app = create_app()
|
app = create_app()
|
||||||
|
|||||||
Reference in New Issue
Block a user