From 5a63aef81e420dcc8eb0642419a1c153ba3b6eb5 Mon Sep 17 00:00:00 2001 From: Daniel Tomlinson Date: Tue, 26 Oct 2021 00:04:04 +0100 Subject: [PATCH] adding duty --- TODO.todo | 17 +++++++++++- duties.py | 16 ++++++++++++ poetry.lock | 71 +++++++++++++++++++++++++++++++++++++++++++++++--- pyproject.toml | 1 + 4 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 duties.py diff --git a/TODO.todo b/TODO.todo index 1473de3..e3f56b2 100644 --- a/TODO.todo +++ b/TODO.todo @@ -1,12 +1,27 @@ Priority: ✔ Document the python/logging/typing in Trilium @done(21-10-25 14:33) - ☐ Update typing annotations to include generics instead + ✔ Update typing annotations to include generics instead @done(21-10-25 22:38) https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes ☐ Write the tests + ☐ test logs: + document this + ☐ ☐ Docstrings +Documentation: + ☐ Write documentation using `mkdocs` + ☐ Look at how to use github actions + Use for an example + ☐ Build the docs using a github action. + Functionality: ☐ Replace loggers with `click.echo` for command outputs. Keep logging messages for actual logging messages? + ☐ Use the python runner + + ☐ Run tests + ☐ Update poetry + ☐ Build docs + ☐ Document using Duty Tests: ☐ Write tests! @2d diff --git a/duties.py b/duties.py new file mode 100644 index 0000000..62525c7 --- /dev/null +++ b/duties.py @@ -0,0 +1,16 @@ +from duty import duty + + +@duty +def test(ctx): + ctx.run(["echo", "test"], title="test command") + + +@duty +def update_deps(ctx, dry: bool = True): + # duty update_deps dry=False + dry_run = "--dry-run" if dry else "" + ctx.run( + ["poetry", "update", dry_run], + title=f"Updating poetry deps {dry_run}", + ) diff --git a/poetry.lock b/poetry.lock index 304ec56..51968c7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,6 +1,21 @@ +[[package]] +name = "ansimarkup" +version = "1.5.0" +description = "Produce colored terminal text with an xml-like markup" +category = "dev" +optional = false +python-versions = "*" + +[package.dependencies] +colorama = "*" + +[package.extras] +devel = ["bumpversion (>=0.5.2)", "check-manifest (>=0.35)", "readme-renderer (>=16.0)", "flake8", "pep8-naming"] +tests = ["tox (>=2.6.0)", "pytest (>=3.0.3)", "pytest-cov (>=2.3.1)"] + [[package]] name = "astroid" -version = "2.8.3" +version = "2.8.4" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false @@ -75,6 +90,30 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "duty" +version = "0.7.0" +description = "A simple task runner." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +failprint = ">=0.8,<1.0" + +[[package]] +name = "failprint" +version = "0.8.0" +description = "Run a command, print its output only if it fails." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +ansimarkup = ">=1.4,<2.0" +jinja2 = ">=2.11,<4" +ptyprocess = {version = ">=0.6,<1.0", markers = "sys_platform != \"win32\""} + [[package]] name = "flake8" version = "2.3.0" @@ -333,6 +372,14 @@ with_mypy = ["mypy (>=0.600)"] with_pyroma = ["pyroma (>=2.4)"] with_vulture = ["vulture (>=1.5)"] +[[package]] +name = "ptyprocess" +version = "0.7.0" +description = "Run a subprocess in a pseudo terminal" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "py" version = "1.10.0" @@ -582,12 +629,16 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "a1db17ea6defe48d6d640c87c94f57997dd769ae5d5bdc448dee53e57cb9ffd8" +content-hash = "0a1cc3ae7d658d6838c81fd0258ad92e67340c519b3d0910835453bac0fec906" [metadata.files] +ansimarkup = [ + {file = "ansimarkup-1.5.0-py2.py3-none-any.whl", hash = "sha256:3146ca74af5f69e48a9c3d41b31085c0d6378f803edeb364856d37c11a684acf"}, + {file = "ansimarkup-1.5.0.tar.gz", hash = "sha256:96c65d75bbed07d3dcbda8dbede8c2252c984f90d0ca07434b88a6bbf345fad3"}, +] astroid = [ - {file = "astroid-2.8.3-py3-none-any.whl", hash = "sha256:f9d66e3a4a0e5b52819b2ff41ac2b179df9d180697db71c92beb33a60c661794"}, - {file = "astroid-2.8.3.tar.gz", hash = "sha256:0e361da0744d5011d4f5d57e64473ba9b7ab4da1e2d45d6631ebd67dd28c3cce"}, + {file = "astroid-2.8.4-py3-none-any.whl", hash = "sha256:0755c998e7117078dcb7d0bda621391dd2a85da48052d948c7411ab187325346"}, + {file = "astroid-2.8.4.tar.gz", hash = "sha256:1e83a69fd51b013ebf5912d26b9338d6643a55fec2f20c787792680610eed4a2"}, ] atomicwrites = [ {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, @@ -613,6 +664,14 @@ dodgy = [ {file = "dodgy-0.2.1-py3-none-any.whl", hash = "sha256:51f54c0fd886fa3854387f354b19f429d38c04f984f38bc572558b703c0542a6"}, {file = "dodgy-0.2.1.tar.gz", hash = "sha256:28323cbfc9352139fdd3d316fa17f325cc0e9ac74438cbba51d70f9b48f86c3a"}, ] +duty = [ + {file = "duty-0.7.0-py3-none-any.whl", hash = "sha256:45068baf1639f16464aa40e9d8f698f0ae09408368fe53a34e9bfe6993dfd743"}, + {file = "duty-0.7.0.tar.gz", hash = "sha256:5ebfd4640ab41e3058f1d8433f74228d60c9a808def1784e65319ef1899a9d15"}, +] +failprint = [ + {file = "failprint-0.8.0-py3-none-any.whl", hash = "sha256:a8215a7aca5ce687116b995cd3a9667180f222ab88c4328a5007d2fa0b5c0f78"}, + {file = "failprint-0.8.0.tar.gz", hash = "sha256:4633b52f9395bf042ad996c96cd7819a94b2021833030dd1eb692ebbd86b89a1"}, +] flake8 = [ {file = "flake8-2.3.0-py2.py3-none-any.whl", hash = "sha256:c99cc9716d6655d9c8bcb1e77632b8615bf0abd282d7abd9f5c2148cad7fc669"}, {file = "flake8-2.3.0.tar.gz", hash = "sha256:5ee1a43ccd0716d6061521eec6937c983efa027793013e572712c4da55c7c83e"}, @@ -821,6 +880,10 @@ prospector = [ {file = "prospector-1.5.1-py3-none-any.whl", hash = "sha256:47f8ff3fd36ae276967eb392ca20b300a7bdea66c0d0252250a4d89a6c03ab15"}, {file = "prospector-1.5.1.tar.gz", hash = "sha256:851c2892cd615cfee91fd27cfaf7a5061d14daf2853aa8f012e927b98f919578"}, ] +ptyprocess = [ + {file = "ptyprocess-0.7.0-py2.py3-none-any.whl", hash = "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35"}, + {file = "ptyprocess-0.7.0.tar.gz", hash = "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"}, +] py = [ {file = "py-1.10.0-py2.py3-none-any.whl", hash = "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"}, {file = "py-1.10.0.tar.gz", hash = "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"}, diff --git a/pyproject.toml b/pyproject.toml index b97e44f..8211cce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ panaetius = { path = "../panaetius", develop = true } [tool.poetry.dev-dependencies] pytest = "^6.2.5" prospector = { extras = ["with_bandit", "with_mypy"], version = "^1.5.1" } +duty = "^0.7.0" [build-system] requires = ["poetry-core>=1.0.0"]