Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Task runner #19

Merged
merged 3 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dev-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
bandit
black
flake8
invoke
isort
mypy
pip-tools
Expand Down
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ idna==3.3
# via requests
iniconfig==1.1.1
# via pytest
invoke==1.6.0
# via -r .\dev-requirements.in
isort==5.10.1
# via -r .\dev-requirements.in
mccabe==0.6.1
Expand Down
46 changes: 46 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from pathlib import Path

from invoke import task

from app.utils import get_asset

PROJECT_DIR = Path()
UI_FILES = tuple(get_asset('ui').glob("**/*.ui"))


@task(
help={
'file': '`.ui` file to be converted to `.py`. If not supplied, all files will be converted. Available files: '
f'{", ".join(p.stem for p in UI_FILES)}'
}
)
def ui(c, file=None):
"""
Convert QT `.ui` files into `.py`. `.ui` extension not required in the parameter.
"""
if file:
file_stems = [file[:-3] if file.lower().endswith('.ui') else file]
else:
file_stems = [p.stem for p in UI_FILES]

for file_stem in file_stems:
ui_file_path = next(p for p in UI_FILES if p.stem == file_stem)
py_file_path = PROJECT_DIR / 'app/ui/forms' / f'{file_stem}_ui.py'

c.run(f'pyside6-uic {ui_file_path} -o {py_file_path}')


@task
def docs_serve(c):
"""
Start documentation local server.
"""
c.run('mkdocs serve')


@task
def docs_deploy(c):
"""
Deploy documentation to GitHub.
"""
c.run('mkdocs gh-deploy')