Skip to content

Commit

Permalink
πŸ“ Release: 0.15.1 (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomy0000000 authored Jan 1, 2023
2 parents c5dbdd6 + 0ba3988 commit df9767c
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ jobs:
docker compose down
rm docker-compose.yml
wget "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/docker-compose.yml"
docker compose pull
docker compose pull --quiet
docker compose up --detach
docker network connect nginx_default tubee_beta_app
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ci:
autoupdate_branch: "develop"
autoupdate_commit_msg: "πŸ—„ chore: pre-commit autoupdate"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.4.0"
Expand Down
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"bungcip.better-toml",
"ryanluker.vscode-coverage-gutters",
"whatwedo.twig",
"donjayamanne.jquerysnippets",
"cschleiden.vscode-github-actions"
]
}
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
define USAGE
Tubee, the YouTube subscription dashboard

Commands:
install Install dependencies for local development
build Build docker images
start Start the application for development
test Run coverage unit tests
shell Enter interactive shell for debug
db_migrate Create a new database migration (Run with make db_migrate MESSAGE="message")
db_upgrade Upgrade the database to the latest migration
uninstall Uninstall environment
reinstall Reinstall environment (when Python version is bumped)

endef

export USAGE

help:
@echo "$$USAGE"

install:
pyenv install -s $(shell cat .python-version)
poetry env use $(shell echo $(shell pyenv shell $(shell cat .python-version); pyenv which python))
poetry install

build:
docker compose --file docker-compose.dev.yml build

start:
docker compose --file docker-compose.dev.yml up

test:
poetry run flask test --coverage

shell:
poetry run flask shell

db_migrate:
docker compose --file docker-compose.dev.yml exec tubee flask db migrate -m $(MESSAGE)

db_upgrade:
docker compose --file docker-compose.dev.yml exec tubee flask db upgrade

uninstall:
poetry env remove --all

reinstall: uninstall install build
6 changes: 0 additions & 6 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ services:
celery:
build: .
command:
- "watchmedo"
- "auto-restart"
- "--directory=./"
- "--pattern=*.py"
- "--recursive"
- "--"
- "celery"
- "--app=celery_worker.celery"
- "worker"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name = "tubee"
version = "0.15.0"
description = "A Web Application for Monitoring New YouTube Videos"
license = "MIT License"
authors = ["Tomy Hsieh <tomy0000000@gmail.com>"]
authors = ["Tomy Hsieh <pypi@tomy.me>"]
readme = "README.md"
homepage = "https://github.com/tomy0000000/Tubee"
repository = "https://github.com/tomy0000000/Tubee"
Expand Down
10 changes: 7 additions & 3 deletions tubee/models/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ class Action(db.Model): # type: ignore
),
{},
)
channel = db.relationship("Channel", back_populates="actions")
subscription = db.relationship("Subscription", back_populates="_actions")
channel = db.relationship(
"Channel", back_populates="actions", overlaps="subscription"
)
subscription = db.relationship(
"Subscription", back_populates="_actions", overlaps="channel"
)
tag = db.relationship("Tag", back_populates="actions")
user = db.relationship("User", back_populates="actions")
user = db.relationship("User", back_populates="actions", overlaps="subscription")

def __init__(self, username: str, params: Union[dict[str, str], None] = None):
from .subscription import Subscription
Expand Down
4 changes: 3 additions & 1 deletion tubee/models/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class Channel(db.Model): # type: ignore
hub_infos = db.Column(db.JSON, nullable=False, default={})
subscribe_timestamp = db.Column(db.DateTime, default=datetime.utcnow)
unsubscribe_timestamp = db.Column(db.DateTime)
actions = db.relationship("Action", back_populates="channel")
actions = db.relationship(
"Action", back_populates="channel", overlaps="subscription"
)
videos = db.relationship(
"Video", back_populates="channel", lazy="dynamic", cascade="all, delete-orphan"
)
Expand Down
1 change: 1 addition & 0 deletions tubee/models/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Subscription(db.Model): # type: ignore
back_populates="subscription",
lazy="dynamic",
cascade="all, delete-orphan",
overlaps="actions,channel,user",
)
_subscription_tags = db.relationship(
"SubscriptionTag",
Expand Down
7 changes: 6 additions & 1 deletion tubee/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ class User(UserMixin, db.Model): # type: ignore
tags = db.relationship(
"Tag", back_populates="user", lazy="dynamic", cascade="all, delete-orphan"
)
actions = db.relationship("Action", back_populates="user", lazy="dynamic")
actions = db.relationship(
"Action",
back_populates="user",
lazy="dynamic",
overlaps="_actions,subscription",
)

def __init__(self, username, password, admin=False, **kwargs):
self.username = username
Expand Down

0 comments on commit df9767c

Please sign in to comment.