From 75e1d5c13e61cb6a795496863c1a65c0a38947b0 Mon Sep 17 00:00:00 2001 From: moscap Date: Wed, 2 Jun 2021 14:11:10 +0300 Subject: [PATCH 1/3] add deployment configs and tools --- .gitignore | 5 +++++ dodo.py | 11 +++++++++++ frontend/__init__.py | 0 frontend/__main__.py | 8 ++++++++ frontend/api_demo.py | 2 +- frontend/login.py | 4 ++-- frontend/todo_tk.py | 6 +++--- frontend/user.py | 2 +- pyproject.toml | 12 ++++++++++++ setup.cfg | 11 +++++++++++ 10 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 dodo.py create mode 100644 frontend/__init__.py create mode 100644 frontend/__main__.py create mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index 27cc7f2..5ddc419 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,8 @@ target/ tmp* .env* venv* + +# Doit +*.bak +*.dat +*.dir diff --git a/dodo.py b/dodo.py new file mode 100644 index 0000000..e9bcd75 --- /dev/null +++ b/dodo.py @@ -0,0 +1,11 @@ +#!usr/bin/env python3 +''' +''' + +import glob + +def task_wheel(): + """Create bynary wheel distribution""" + return { + 'actions': ['python3 -m build -w'] + } \ No newline at end of file diff --git a/frontend/__init__.py b/frontend/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/frontend/__main__.py b/frontend/__main__.py new file mode 100644 index 0000000..26fb6c4 --- /dev/null +++ b/frontend/__main__.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 +"""django-todo application launcher""" + +from .todo_tk import Application + +if __name__ == "__main__": + app = Application() + app.main(app.login()) \ No newline at end of file diff --git a/frontend/api_demo.py b/frontend/api_demo.py index 329297c..f252b1b 100644 --- a/frontend/api_demo.py +++ b/frontend/api_demo.py @@ -1,5 +1,5 @@ import random -from user import User +from .user import User def print_lists(lists): diff --git a/frontend/login.py b/frontend/login.py index 0efd7f9..5b03aeb 100644 --- a/frontend/login.py +++ b/frontend/login.py @@ -1,6 +1,6 @@ import tkinter as tk -from user import User -import message +from .user import User +from . import message class LoginFrame(tk.Frame): diff --git a/frontend/todo_tk.py b/frontend/todo_tk.py index 50a43e5..c7123e9 100644 --- a/frontend/todo_tk.py +++ b/frontend/todo_tk.py @@ -2,9 +2,9 @@ import sys import tkinter as tk -from login import LoginFrame -from workspace import WorkSpaceFrame -from user import User +from .login import LoginFrame +from .workspace import WorkSpaceFrame +from .user import User if "win" in sys.platform.lower(): DEFAULT_URL = "http://localhost:8000" diff --git a/frontend/user.py b/frontend/user.py index 588dac8..d0185cf 100644 --- a/frontend/user.py +++ b/frontend/user.py @@ -7,7 +7,7 @@ from pathlib import Path import json -from api import UserApi +from .api import UserApi LIST_UPDATEBLE = ["title"] TODO_ITEM_UPDATEBLE = ["text", "finished"] diff --git a/pyproject.toml b/pyproject.toml index 18a59d9..174846d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,3 +21,15 @@ exclude = ''' | profiling )/ ''' + +[build-system] +requires = [ + "setuptools", + "wheel", + "requests", + "build", + "coverage", + "doit" +] +build-backend = "setuptools.build_meta" + diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..38b80cd --- /dev/null +++ b/setup.cfg @@ -0,0 +1,11 @@ +[metadata] +name = django-todo +version = 0.0.1 + +[options] +packages = frontend +install_requires = + requests; python_version >= "3.6" + +[options.package_data] +frontend = */*/django-todo.mo \ No newline at end of file From 4fdd63b234a6727bc31aa8af88cae03f0211e6bc Mon Sep 17 00:00:00 2001 From: moscap Date: Wed, 2 Jun 2021 14:16:35 +0300 Subject: [PATCH 2/3] lint improvements --- dodo.py | 2 +- frontend/__main__.py | 2 +- setup.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dodo.py b/dodo.py index e9bcd75..a05402f 100644 --- a/dodo.py +++ b/dodo.py @@ -8,4 +8,4 @@ def task_wheel(): """Create bynary wheel distribution""" return { 'actions': ['python3 -m build -w'] - } \ No newline at end of file + } diff --git a/frontend/__main__.py b/frontend/__main__.py index 26fb6c4..ae13128 100644 --- a/frontend/__main__.py +++ b/frontend/__main__.py @@ -5,4 +5,4 @@ from .todo_tk import Application if __name__ == "__main__": app = Application() - app.main(app.login()) \ No newline at end of file + app.main(app.login()) diff --git a/setup.cfg b/setup.cfg index 38b80cd..6cf0cba 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,4 +8,4 @@ install_requires = requests; python_version >= "3.6" [options.package_data] -frontend = */*/django-todo.mo \ No newline at end of file +frontend = */*/django-todo.mo From f8bebe81151e1ca9042fe4a8d8fc01827386183e Mon Sep 17 00:00:00 2001 From: moscap Date: Tue, 8 Jun 2021 07:55:11 +0300 Subject: [PATCH 3/3] add some automatization and localizatipon into wheels --- .gitignore | 1 + dodo.py | 27 +++++++++- frontend/po/eng/LC_MESSAGES/todo.po | 83 ----------------------------- setup.cfg | 2 +- 4 files changed, 28 insertions(+), 85 deletions(-) delete mode 100644 frontend/po/eng/LC_MESSAGES/todo.po diff --git a/.gitignore b/.gitignore index 5ddc419..852f6e5 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ coverage.xml # Translations *.mo *.pot +*.po # Django stuff: *.log diff --git a/dodo.py b/dodo.py index a05402f..be824bd 100644 --- a/dodo.py +++ b/dodo.py @@ -4,8 +4,33 @@ import glob +def task_pot(): + """Create bynary wheel distribution""" + return { + 'actions': ["""pybabel extract -o todo.pot frontend"""], + 'file_dep': glob.glob('frontend/*.py'), + 'targets': ['todo.pot'] + } + +def task_po(): + """Create bynary wheel distribution""" + return { + 'actions': ["""pybabel update -D todo -d frontend/po -i todo.pot"""], + 'file_dep': ['todo.pot'], + 'targets': ['frontend/po/eng/LC_MESSAGES/todo.po'] + } + +def task_mo(): + """Create bynary wheel distribution""" + return { + 'actions': ["""pybabel compile -D todo -i frontend/po/eng/LC_MESSAGES/todo.po -o frontend/po/eng/LC_MESSAGES/todo.mo"""], + 'file_dep': ['frontend/po/eng/LC_MESSAGES/todo.po'], + 'targets': ['frontend/po/eng/LC_MESSAGES/todo.mo'] + } + def task_wheel(): """Create bynary wheel distribution""" return { - 'actions': ['python3 -m build -w'] + 'actions': ['python3 -m build -w'], + 'task_dep': ['mo'] } diff --git a/frontend/po/eng/LC_MESSAGES/todo.po b/frontend/po/eng/LC_MESSAGES/todo.po deleted file mode 100644 index 427bd92..0000000 --- a/frontend/po/eng/LC_MESSAGES/todo.po +++ /dev/null @@ -1,83 +0,0 @@ -# English (United States) translations for PROJECT. -# Copyright (C) 2021 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2021. -# -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-06-06 23:42+0300\n" -"PO-Revision-Date: 2021-06-07 00:24+0300\n" -"Last-Translator: FULL NAME \n" -"Language: en_US\n" -"Language-Team: en_US \n" -"Plural-Forms: nplurals=2; plural=(n != 1)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.8.1\n" - -#: todo_tk.py:20 -msgid "Приложение для планирования" -msgstr "ToDo Application" - -#: message.py:6 -msgid "Сообщение!" -msgstr "Message!" - -#: message.py:7 -msgid "Неправильный логин или пароль" -msgstr "Wrong login or password" - -#: message.py:8 -msgid "Сдесь могло быть ваше сообщение" -msgstr "This could have been your message" - -#: login.py:63 -msgid "Введите логин" -msgstr "Enter your username" - -#: login.py:71 -msgid "Введите пароль" -msgstr "Enter your password" - -#: login.py:78 -msgid "Войти" -msgstr "Enter" - -#: workspace.py:17 -msgid "Не реализовано" -msgstr "Not implemented" - -#: workspace.py:25 -msgid "Текст" -msgstr "Text" - -#: workspace.py:28 -msgid "Выполнено" -msgstr "Done" - -#: workspace.py:31 -msgid "Создано" -msgstr "Created" - -#: workspace.py:60 -msgid "Удалить" -msgstr "Delete" - -#: workspace.py:88 -msgid "Добавить заметку" -msgstr "Add note" - -#: workspace.py:91 -msgid "Удалить лист" -msgstr "Delete list" - -#: workspace.py:149 -msgid "Запомнить меня" -msgstr "Remember me" - -#: workspace.py:158 -msgid "Добавить лист" -msgstr "Add list" diff --git a/setup.cfg b/setup.cfg index 6cf0cba..b61decd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,4 +8,4 @@ install_requires = requests; python_version >= "3.6" [options.package_data] -frontend = */*/django-todo.mo +frontend = */*/*/todo.mo