From e6130dbf4a7be094c09504ae723602c99c1ab7b8 Mon Sep 17 00:00:00 2001 From: Micah Jerome Ellison Date: Wed, 2 Nov 2022 19:53:32 -0700 Subject: [PATCH 1/3] Resolve failing GitHub Actions linting by replacing deprecated set-output command (#1632) * Replace deprecated set-output command * Resolve SC2086 - double quote to prevent globbing and word splitting * fix quotes in output command Co-authored-by: Jonathan Wren --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index eff2d991..4b55f253 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -111,7 +111,7 @@ jobs: id: pypi-version-getter run: | pypi_version="$(find dist/jrnl-*.tar.gz | sed -r 's!dist/jrnl-(.*)\.tar\.gz!\1!')" - echo "::set-output name=pypi_version::$pypi_version" + echo "pypi_version=$pypi_version" >> "$GITHUB_OUTPUT" release_homebrew: if: ${{ github.event.inputs.include_brew == 'true' }} From cb7e0ed2892db5e0e22adacb4c5bcfde743c437c Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Thu, 3 Nov 2022 02:55:34 +0000 Subject: [PATCH 2/3] Update changelog [ci skip] --- CHANGELOG.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1de227b..d4d86379 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,10 +16,6 @@ - Fix bug where changelog is always slightly out of date on release tags [\#1631](https://github.com/jrnl-org/jrnl/pull/1631) ([wren](https://github.com/wren)) -**Documentation:** - -- Document that editors must be blocking processes [\#1624](https://github.com/jrnl-org/jrnl/pull/1624) ([micahellison](https://github.com/micahellison)) - ## [v3.3](https://pypi.org/project/jrnl/v3.3/) (2022-10-29) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta2...v3.3) From c1eb0c54a35049b46e0f718cea6cda823852fb93 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Thu, 3 Nov 2022 07:18:35 -0700 Subject: [PATCH 3/3] Add `type-checking` plugin to linting checks (#1629) * add type-checking plugin for flakeheaven * update lock file * fix type-checking issues in current codebase * run linters --- jrnl/exception.py | 8 ++++++-- jrnl/messages/Message.py | 7 +++++-- jrnl/override.py | 7 ++++--- poetry.lock | 30 +++++++++++++++++++++++++++++- pyproject.toml | 1 + 5 files changed, 45 insertions(+), 8 deletions(-) diff --git a/jrnl/exception.py b/jrnl/exception.py index 86140cd9..b4ec2be8 100644 --- a/jrnl/exception.py +++ b/jrnl/exception.py @@ -1,14 +1,18 @@ # Copyright © 2012-2022 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html -from jrnl.messages import Message +from typing import TYPE_CHECKING + from jrnl.output import print_msg +if TYPE_CHECKING: + from jrnl.messages import Message + class JrnlException(Exception): """Common exceptions raised by jrnl.""" - def __init__(self, *messages: Message): + def __init__(self, *messages: "Message"): self.messages = messages def print(self) -> None: diff --git a/jrnl/messages/Message.py b/jrnl/messages/Message.py index e4d6176a..bb193f5f 100644 --- a/jrnl/messages/Message.py +++ b/jrnl/messages/Message.py @@ -1,14 +1,17 @@ # Copyright © 2012-2022 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html +from typing import TYPE_CHECKING from typing import Mapping from typing import NamedTuple from jrnl.messages.MsgStyle import MsgStyle -from jrnl.messages.MsgText import MsgText + +if TYPE_CHECKING: + from jrnl.messages.MsgText import MsgText class Message(NamedTuple): - text: MsgText + text: "MsgText" style: MsgStyle = MsgStyle.NORMAL params: Mapping = {} diff --git a/jrnl/override.py b/jrnl/override.py index 4b6506ee..75a400b9 100644 --- a/jrnl/override.py +++ b/jrnl/override.py @@ -1,14 +1,15 @@ # Copyright © 2012-2022 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html - -from argparse import Namespace +from typing import TYPE_CHECKING from jrnl.config import make_yaml_valid_dict from jrnl.config import update_config +if TYPE_CHECKING: + from argparse import Namespace # import logging -def apply_overrides(args: Namespace, base_config: dict) -> dict: +def apply_overrides(args: "Namespace", base_config: dict) -> dict: """Unpack CLI provided overrides into the configuration tree. :param overrides: List of configuration key-value pairs collected from the CLI diff --git a/poetry.lock b/poetry.lock index 36475675..9b4d4c65 100644 --- a/poetry.lock +++ b/poetry.lock @@ -112,6 +112,14 @@ python-versions = ">=3.6.0" [package.extras] unicode-backport = ["unicodedata2"] +[[package]] +name = "classify-imports" +version = "4.2.0" +description = "Utilities for refactoring imports in python-like syntax." +category = "dev" +optional = false +python-versions = ">=3.7" + [[package]] name = "click" version = "8.1.3" @@ -257,6 +265,18 @@ isort = ">=4.3.5,<6" [package.extras] test = ["pytest"] +[[package]] +name = "flake8-type-checking" +version = "2.2.0" +description = "A flake8 plugin for managing type-checking imports & forward references" +category = "dev" +optional = false +python-versions = ">=3.8" + +[package.dependencies] +classify-imports = "*" +flake8 = "*" + [[package]] name = "flakeheaven" version = "3.2.0" @@ -1158,7 +1178,7 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "1.1" python-versions = ">=3.10.0, <3.13" -content-hash = "13e2102b7ddeb9ac4f1f2fddcfa6275d565c3eec9fa8da1b4657a02e20f900c9" +content-hash = "63f39baa62c8641eb6329472de340a9f06d9ffea3096a4095e90f98ce2986f91" [metadata.files] ansiwrap = [ @@ -1283,6 +1303,10 @@ charset-normalizer = [ {file = "charset-normalizer-2.1.0.tar.gz", hash = "sha256:575e708016ff3a5e3681541cb9d79312c416835686d054a23accb873b254f413"}, {file = "charset_normalizer-2.1.0-py3-none-any.whl", hash = "sha256:5189b6f22b01957427f35b6a08d9a0bc45b46d3788ef5a92e978433c7a35f8a5"}, ] +classify-imports = [ + {file = "classify_imports-4.2.0-py2.py3-none-any.whl", hash = "sha256:dbbc264b70a470ed8c6c95976a11dfb8b7f63df44ed1af87328bbed2663f5161"}, + {file = "classify_imports-4.2.0.tar.gz", hash = "sha256:7abfb7ea92149b29d046bd34573d247ba6e68cc28100c801eba4af17964fc40e"}, +] click = [ {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, @@ -1355,6 +1379,10 @@ flake8-isort = [ {file = "flake8-isort-5.0.0.tar.gz", hash = "sha256:e336f928c7edc509684930ab124414194b7f4e237c712af8fcbdf49d8747b10c"}, {file = "flake8_isort-5.0.0-py3-none-any.whl", hash = "sha256:c73f9cbd1bf209887f602a27b827164ccfeba1676801b2aa23cb49051a1be79c"}, ] +flake8-type-checking = [ + {file = "flake8_type_checking-2.2.0-py3-none-any.whl", hash = "sha256:c7d9d7adc6cd635a5a1a7859e5e0140f4f8f1705982a22db45872dd9acd49753"}, + {file = "flake8_type_checking-2.2.0.tar.gz", hash = "sha256:f7972fc9102f3f632ace1f4b1c5c20b900b8b7b529f04bb6c1fe0a11801e9658"}, +] flakeheaven = [ {file = "flakeheaven-3.2.0-py3-none-any.whl", hash = "sha256:ec5a508c3db64d73128b65cb2a5a2c0a2d9f2e4b435e9fa2bcc03bf0df86da79"}, {file = "flakeheaven-3.2.0.tar.gz", hash = "sha256:225333d7bf309079f19a2c5f02d427fc7558a0d0c065944de88041ca94f5525c"}, diff --git a/pyproject.toml b/pyproject.toml index 695a1ea7..e3c5592f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ black = { version = ">=21.5b2", allow-prereleases = true } flakeheaven = ">=3.0" flake8-black = ">=0.3.3" flake8-isort = ">=5.0.0" +flake8-type-checking = ">=2.2.0" ipdb = "*" isort = ">=5.10" mkdocs = ">=1.0,<1.3"