@@ -0,0 +1,1883 @@
+import os%0Afrom pathlib import Path%0Afrom shutil import which%0A%0Afrom invoke import task%0A%0APKG_NAME = %22pelican%22%0APKG_PATH = Path(%22pelican%22)%0AACTIVE_VENV = os.environ.get(%22VIRTUAL_ENV%22, None)%0AVENV_HOME = Path(os.environ.get(%22WORKON_HOME%22, %22~/virtualenvs%22))%0AVENV_PATH = Path(ACTIVE_VENV) if ACTIVE_VENV else (VENV_HOME / PKG_NAME)%0AVENV = str(VENV_PATH.expanduser())%0A%0ATOOLS = %5B%22poetry%22, %22pre-commit%22%5D%0APOETRY = which(%22poetry%22) if which(%22poetry%22) else (VENV / Path(%22bin%22) / %22poetry%22)%0APRECOMMIT = (%0A    which(%22pre-commit%22) if which(%22pre-commit%22) else (VENV / Path(%22bin%22) / %22pre-commit%22)%0A)%0A%0A%0A@task%0Adef tests(c):%0A    %22%22%22Run the test suite%22%22%22%0A    c.run(f%22%7BVENV%7D/bin/python -Wd -m unittest discover%22, pty=True)%0A%0A%0A@task%0Adef black(c, check=False, diff=False):%0A    %22%22%22Run Black auto-formatter, optionally with --check or --diff%22%22%22%0A    check_flag, diff_flag = %22%22, %22%22%0A    if check:%0A        check_flag = %22--check%22%0A    if diff:%0A        diff_flag = %22--diff%22%0A    c.run(f%22%7BVENV%7D/bin/black %7Bcheck_flag%7D %7Bdiff_flag%7D %7BPKG_PATH%7D tasks.py%22)%0A%0A%0A@task%0Adef isort(c, check=False, diff=False):%0A    check_flag, diff_flag = %22%22, %22%22%0A    if check:%0A        check_flag = %22-c%22%0A    if diff:%0A        diff_flag = %22--diff%22%0A    c.run(%0A        f%22%7BVENV%7D/bin/isort %7Bcheck_flag%7D %7Bdiff_flag%7D --recursive %7BPKG_PATH%7D/* tasks.py%22%0A    )%0A%0A%0A@task%0Adef flake8(c):%0A    c.run(f%22%7BVENV%7D/bin/flake8 %7BPKG_PATH%7D tasks.py%22)%0A%0A%0A@task%0Adef lint(c):%0A    isort(c, check=True)%0A    black(c, check=True)%0A    flake8(c)%0A%0A%0A@task%0Adef tools(c):%0A    %22%22%22Install tools in the virtual environment if not already on PATH%22%22%22%0A    for tool in TOOLS:%0A        if not which(tool):%0A            c.run(f%22%7BVENV%7D/bin/pip install %7Btool%7D%22)%0A%0A%0A@task%0Adef precommit(c):%0A    %22%22%22Install pre-commit hooks to .git/hooks/pre-commit%22%22%22%0A    c.run(f%22%7BPRECOMMIT%7D install%22)%0A%0A%0A@task%0Adef setup(c):%0A    c.run(f%22%7BVENV%7D/bin/pip install -U pip%22)%0A    tools(c)%0A    c.run(f%22%7BPOETRY%7D install%22)%0A    precommit(c)%0A

Add initial Invoke tasks.py file