diff --git a/.cookiecutter.json b/.cookiecutter.json index fd87fa73..e12990f5 100644 --- a/.cookiecutter.json +++ b/.cookiecutter.json @@ -23,7 +23,7 @@ "pull_request_strategy": "update-or-create", "post_actions": [], "draft": false, - "baked_commit_ref": "b23a9ed5a4714810d83670ad47cc182764c6d464", + "baked_commit_ref": "46f70d30baa1e0c5af3da3fdcf1c77b31157d3f9", "drift_managed_branch": "develop" } } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6cd1872..b8d962ee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ --- name: "Release" -on: # yamllint disable-line rule:truthy rule:comments +on: # yamllint disable-line rule:truthy rule:comments release: types: ["published"] @@ -48,7 +48,7 @@ jobs: - name: "Upload binaries to release" run: "gh release upload ${{ github.ref_name }} dist/*.{tar.gz,whl}" env: - GH_TOKEN: "${{ secrets.NTC_GITHUB_TOKEN }}" + GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" publish-pypi: name: "Push Package to PyPI" diff --git a/LICENSE b/LICENSE index 6ce362fa..9e40eee1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ Apache Software License 2.0 -Copyright (c) 2021-2025, Network to Code, LLC +Copyright (c) 2021-2026, Network to Code, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/changes/+main.housekeeping b/changes/+main.housekeeping new file mode 100644 index 00000000..3433adf6 --- /dev/null +++ b/changes/+main.housekeeping @@ -0,0 +1 @@ +Rebaked from the cookie `main`. diff --git a/example.invoke.yml b/example.invoke.yml index 199f8277..6206b5f9 100644 --- a/example.invoke.yml +++ b/example.invoke.yml @@ -1,6 +1,6 @@ --- "netutils": - python_ver: "3.9" + python_ver: "3.10" local: false # image_name: "netutils" # image_ver: "latest" diff --git a/tasks.py b/tasks.py index 84805a24..91599e9f 100644 --- a/tasks.py +++ b/tasks.py @@ -39,7 +39,7 @@ def is_truthy(arg): "python_ver": "3.10", "local": is_truthy(os.getenv("INVOKE_NETUTILS_LOCAL", "false")), "image_name": "netutils", - "image_ver": os.getenv("INVOKE_PARSER_IMAGE_VER", "latest"), + "image_ver": os.getenv("INVOKE_NETUTILS_IMAGE_VER", "latest"), "pwd": Path(__file__).parent, } } @@ -66,13 +66,14 @@ def task_wrapper(function=None): return task_wrapper -def run_command(context, exec_cmd, port=None): +def run_command(context, exec_cmd, port=None, rm=True): """Wrapper to run the invoke task commands. Args: context ([invoke.task]): Invoke task object. exec_cmd ([str]): Command to run. port (int): Used to serve local docs. + rm (bool): Whether to remove the container after running the command. Returns: result (obj): Contains Invoke result from running task. @@ -86,12 +87,12 @@ def run_command(context, exec_cmd, port=None): ) if port: result = context.run( - f"docker run -it -p {port} -v {context.netutils.pwd}:/local {context.netutils.image_name}:{context.netutils.image_ver} sh -c '{exec_cmd}'", + f"docker run -it {'--rm' if rm else ''} -p {port} -v {context.netutils.pwd}:/local {context.netutils.image_name}:{context.netutils.image_ver} sh -c '{exec_cmd}'", pty=True, ) else: result = context.run( - f"docker run -it -v {context.netutils.pwd}:/local {context.netutils.image_name}:{context.netutils.image_ver} sh -c '{exec_cmd}'", + f"docker run -it {'--rm' if rm else ''} -v {context.netutils.pwd}:/local {context.netutils.image_name}:{context.netutils.image_ver} sh -c '{exec_cmd}'", pty=True, ) @@ -188,6 +189,26 @@ def pytest(context, pattern=None, label=None): exec_cmd = " && ".join([doc_test_cmd, pytest_cmd, coverage_cmd]) run_command(context, exec_cmd) + doc_test_cmd = "pytest -vv --doctest-modules netutils/" + pytest_cmd = "coverage run --source=netutils -m pytest" + if pattern: + pytest_cmd += "".join([f" -k {_pattern}" for _pattern in pattern]) + if label: + pytest_cmd += "".join([f" {_label}" for _label in label]) + coverage_cmd = "coverage report" + exec_cmd = " && ".join([doc_test_cmd, pytest_cmd, coverage_cmd]) + run_command(context, exec_cmd) + + doc_test_cmd = "pytest -vv --doctest-modules netutils/" + pytest_cmd = "coverage run --source=netutils -m pytest" + if pattern: + pytest_cmd += "".join([f" -k {_pattern}" for _pattern in pattern]) + if label: + pytest_cmd += "".join([f" {_label}" for _label in label]) + coverage_cmd = "coverage report" + exec_cmd = " && ".join([doc_test_cmd, pytest_cmd, coverage_cmd]) + run_command(context, exec_cmd) + @task(aliases=("a",)) def autoformat(context):