mirror of
https://github.com/dtomlinson91/tembo.git
synced 2025-12-22 06:15:45 +00:00
adding latest duties
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
Priority:
|
||||
☐ Version duty
|
||||
✔ Version duty @done(21-11-09 23:54)
|
||||
☐ Duty to `poetry build` and extract + copy `setup.py` to root
|
||||
☐ Duty to run tests in isolation
|
||||
☐ Docstrings
|
||||
☐ Update trilium with latest docstrings (documenting __init__ at class level etc)
|
||||
Make sure the gist is updated for prospector with the right ignores
|
||||
@@ -25,7 +27,7 @@ Functionality:
|
||||
☐ Update poetry
|
||||
☐ Build docs
|
||||
☐ Document using Duty
|
||||
☐ Duty for auto insert version from `poetry version`.
|
||||
✔ Duty for auto insert version from `poetry version`. @done(21-11-09 23:53)
|
||||
Need to decide what file to place `__version__` in.
|
||||
|
||||
VSCode:
|
||||
|
||||
42
duties.py
42
duties.py
@@ -1,14 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from duty import duty
|
||||
import pathlib
|
||||
import re
|
||||
|
||||
|
||||
@duty
|
||||
def test(ctx):
|
||||
ctx.run(["echo", "test"], title="test command")
|
||||
PACKAGE_NAME = "tembo"
|
||||
|
||||
|
||||
@duty
|
||||
def update_deps(ctx, dry: bool = False):
|
||||
"""Update the dependencies using Poetry.
|
||||
"""
|
||||
Update the dependencies using Poetry.
|
||||
|
||||
Example:
|
||||
`duty update_deps dry=False`
|
||||
@@ -22,10 +25,37 @@ def update_deps(ctx, dry: bool = False):
|
||||
|
||||
@duty
|
||||
def coverage(ctx):
|
||||
"""Generate a coverage HTML report.
|
||||
"""
|
||||
Generate a coverage HTML report.
|
||||
|
||||
Example:
|
||||
`duty coverage`
|
||||
"""
|
||||
ctx.run(["coverage", "run", "--source", "tembo", "-m", "pytest"])
|
||||
ctx.run(["coverage", "run", "--source", PACKAGE_NAME, "-m", "pytest"])
|
||||
ctx.run(["coverage", "html"])
|
||||
|
||||
|
||||
@duty
|
||||
def version(ctx, bump: str = "patch"):
|
||||
"""
|
||||
Bump the version using Poetry and update _version.py.
|
||||
|
||||
Args:
|
||||
bump (str, optional) = poetry version flag. Available options are:
|
||||
patch, minor, major, prepatch, preminor, premajor, prerelease.
|
||||
Defaults to patch.
|
||||
|
||||
Example:
|
||||
`duty version bump=major`
|
||||
"""
|
||||
|
||||
# bump with poetry
|
||||
result = ctx.run(["poetry", "version", bump])
|
||||
new_version = re.search(r"(?:.*)(?:\s)(\d+\.\d+\.\d+)$", result)
|
||||
print(new_version.group(0))
|
||||
|
||||
# update _version.py
|
||||
version_file = pathlib.Path(PACKAGE_NAME) / "_version.py"
|
||||
with version_file.open("w", encoding="utf-8") as version_file:
|
||||
version_file.write(f'__version__ = "{new_version.group(1)}"\n')
|
||||
print(f"Bumped _version.py to {new_version.group(1)}")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "tembo"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
description = ""
|
||||
authors = ["dtomlinson <dtomlinson@panaetius.co.uk>"]
|
||||
|
||||
|
||||
1
tembo/_version.py
Normal file
1
tembo/_version.py
Normal file
@@ -0,0 +1 @@
|
||||
__version__ = "0.0.1"
|
||||
Reference in New Issue
Block a user