From 48c528d76aa42dd3f94aa526384038e7817baa03 Mon Sep 17 00:00:00 2001 From: DSiekmeier Date: Sat, 22 Oct 2022 23:28:34 +0200 Subject: [PATCH 01/14] Remove wrong option in configuration file reference (#1618) --- docs/reference-config-file.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/reference-config-file.md b/docs/reference-config-file.md index 5239daa8..3a057cdb 100644 --- a/docs/reference-config-file.md +++ b/docs/reference-config-file.md @@ -90,9 +90,6 @@ See the [python docs](http://docs.python.org/library/time.html#time.strftime) fo Do not change this for an existing journal, since that might lead to data loss. -If you would just like to change how `jrnl` displays dates, -use display_format instead. - !!! note `jrnl` doesn't support the `%z` or `%Z` time zone identifiers. From 619de775fdf47508c4493cdcff844113e46fa757 Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Sat, 22 Oct 2022 21:30:18 +0000 Subject: [PATCH 02/14] Update changelog [ci skip] --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f51438e3..50cca6d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [Unreleased](https://github.com/jrnl-org/jrnl/) + +[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta...HEAD) + +**Documentation:** + +- Documentation of "display\_format" incorrectly states that it can be used to change date display format [\#1617](https://github.com/jrnl-org/jrnl/issues/1617) +- Remove wrong option in configuration file reference [\#1618](https://github.com/jrnl-org/jrnl/pull/1618) ([DSiekmeier](https://github.com/DSiekmeier)) + ## [v3.3-beta](https://pypi.org/project/jrnl/v3.3-beta/) (2022-10-08) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.2...v3.3-beta) From 63850a33c12da1fc623721ef4fd2e2faa598ef88 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 22 Oct 2022 15:35:16 -0700 Subject: [PATCH 03/14] Fix bug for new `--list --format` options when no default journal is specified (#1621) * rename test config * Change journal name validation Journal name validation used to happen before postconfig commands could have a chance to run, so now each command is responsible for its own error-checking of the journal name. Added a new decorator and function that makes this error-checking easier. Co-authored-by: Micah Jerome Ellison * fix wrapper function call to be more like original * change arg names to show which aren't used * add type hints Co-authored-by: Micah Jerome Ellison --- jrnl/Journal.py | 2 ++ jrnl/commands.py | 25 +++++++++++--- jrnl/config.py | 33 ++++++++++++++----- jrnl/messages/MsgText.py | 2 +- tests/bdd/features/config_file.feature | 6 ++-- tests/bdd/features/format.feature | 17 ++++++++++ tests/bdd/features/multiple_journals.feature | 4 +-- .../{bug343.yaml => no_default_journal.yaml} | 0 8 files changed, 70 insertions(+), 19 deletions(-) rename tests/data/configs/{bug343.yaml => no_default_journal.yaml} (100%) diff --git a/jrnl/Journal.py b/jrnl/Journal.py index c2c43142..2fa1d465 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -8,6 +8,7 @@ import re from jrnl import Entry from jrnl import time +from jrnl.config import validate_journal_name from jrnl.messages import Message from jrnl.messages import MsgStyle from jrnl.messages import MsgText @@ -430,6 +431,7 @@ def open_journal(journal_name, config, legacy=False): If legacy is True, it will open Journals with legacy classes build for backwards compatibility with jrnl 1.x """ + validate_journal_name(journal_name, config) config = config.copy() config["journal"] = expand_path(config["journal"]) diff --git a/jrnl/commands.py b/jrnl/commands.py index 6100422b..b1fc81e0 100644 --- a/jrnl/commands.py +++ b/jrnl/commands.py @@ -14,9 +14,11 @@ run. Also, please note that all (non-builtin) imports should be scoped to each function to avoid any possible overhead for these standalone commands. """ +import argparse import platform import sys +from jrnl.config import cmd_requires_valid_journal_name from jrnl.exception import JrnlException from jrnl.messages import Message from jrnl.messages import MsgStyle @@ -56,13 +58,16 @@ def preconfig_version(_): print(output) -def postconfig_list(args, config, **kwargs): +def postconfig_list(args: argparse.Namespace, config: dict, **_) -> int: from jrnl.output import list_journals print(list_journals(config, args.export)) + return 0 -def postconfig_import(args, config, **kwargs): + +@cmd_requires_valid_journal_name +def postconfig_import(args: argparse.Namespace, config: dict, **_) -> int: from jrnl.Journal import open_journal from jrnl.plugins import get_importer @@ -72,8 +77,13 @@ def postconfig_import(args, config, **kwargs): format = args.export if args.export else "jrnl" get_importer(format).import_(journal, args.filename) + return 0 -def postconfig_encrypt(args, config, original_config, **kwargs): + +@cmd_requires_valid_journal_name +def postconfig_encrypt( + args: argparse.Namespace, config: dict, original_config: dict +) -> int: """ Encrypt a journal in place, or optionally to a new file """ @@ -122,8 +132,13 @@ def postconfig_encrypt(args, config, original_config, **kwargs): ) save_config(original_config) + return 0 -def postconfig_decrypt(args, config, original_config, **kwargs): + +@cmd_requires_valid_journal_name +def postconfig_decrypt( + args: argparse.Namespace, config: dict, original_config: dict +) -> int: """Decrypts into new file. If filename is not set, we encrypt the journal file itself.""" from jrnl.config import update_config from jrnl.install import save_config @@ -149,3 +164,5 @@ def postconfig_decrypt(args, config, original_config, **kwargs): original_config, {"encrypt": False}, args.journal_name, force_local=True ) save_config(original_config) + + return 0 diff --git a/jrnl/config.py b/jrnl/config.py index aed17200..8e5c5a14 100644 --- a/jrnl/config.py +++ b/jrnl/config.py @@ -1,8 +1,10 @@ # Copyright © 2012-2022 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html +import argparse import logging import os +from typing import Callable import colorama import xdg.BaseDirectory @@ -213,14 +215,27 @@ def get_journal_name(args, config): args.journal_name = potential_journal_name args.text = args.text[1:] - if args.journal_name not in config["journals"]: - raise JrnlException( - Message( - MsgText.NoDefaultJournal, - MsgStyle.ERROR, - {"journals": list_journals(config)}, - ), - ) - logging.debug("Using journal name: %s", args.journal_name) return args + + +def cmd_requires_valid_journal_name(func: Callable) -> Callable: + def wrapper(args: argparse.Namespace, config: dict, original_config: dict): + validate_journal_name(args.journal_name, config) + func(args=args, config=config, original_config=original_config) + + return wrapper + + +def validate_journal_name(journal_name: str, config: dict) -> None: + if journal_name not in config["journals"]: + raise JrnlException( + Message( + MsgText.NoNamedJournal, + MsgStyle.ERROR, + { + "journal_name": journal_name, + "journals": list_journals(config), + }, + ), + ) diff --git a/jrnl/messages/MsgText.py b/jrnl/messages/MsgText.py index 0f509645..b3cc50e7 100644 --- a/jrnl/messages/MsgText.py +++ b/jrnl/messages/MsgText.py @@ -101,7 +101,7 @@ class MsgText(Enum): {template} """ - NoDefaultJournal = "No default journal configured\n{journals}" + NoNamedJournal = "No '{journal_name}' journal configured\n{journals}" DoesNotExist = "{name} does not exist" diff --git a/tests/bdd/features/config_file.feature b/tests/bdd/features/config_file.feature index 6c24f1e5..3369e666 100644 --- a/tests/bdd/features/config_file.feature +++ b/tests/bdd/features/config_file.feature @@ -64,10 +64,10 @@ Feature: Multiple journals Then the output should contain "sell my junk on ebay and make lots of money" Scenario: Don't crash if no default journal is specified using an alternate config - Given the config "bug343.yaml" exists + Given the config "no_default_journal.yaml" exists And we use the config "basic_onefile.yaml" - When we run "jrnl --cf bug343.yaml a long day in the office" - Then the output should contain "No default journal configured" + When we run "jrnl --cf no_default_journal.yaml a long day in the office" + Then the output should contain "No 'default' journal configured" Scenario: Don't crash if no file exists for a configured encrypted journal using an alternate config Given the config "multiple.yaml" exists diff --git a/tests/bdd/features/format.feature b/tests/bdd/features/format.feature index 2cc7d9a1..54715495 100644 --- a/tests/bdd/features/format.feature +++ b/tests/bdd/features/format.feature @@ -612,3 +612,20 @@ Feature: Custom formats config_path: .+basic_onefile\.yaml journals: default: features/journals/basic_onefile\.journal + + Scenario: Export journal list to formats with no default journal + Given we use the config "no_default_journal.yaml" + When we run "jrnl --list" + Then the output should match + Journals defined in config \(.+no_default_journal\.yaml\) + \* simple -> features/journals/simple\.journal + \* work -> features/journals/work\.journal + When we run "jrnl --list --format json" + Then the output should match + {"config_path": ".+no_default_journal\.yaml", "journals": {"simple": "features/journals/simple\.journal", "work": "features/journals/work\.journal"}} + When we run "jrnl --list --format yaml" + Then the output should match + config_path: .+no_default_journal\.yaml + journals: + simple: features/journals/simple\.journal + work: features/journals/work\.journal diff --git a/tests/bdd/features/multiple_journals.feature b/tests/bdd/features/multiple_journals.feature index 3c2c7b73..ee90b8a9 100644 --- a/tests/bdd/features/multiple_journals.feature +++ b/tests/bdd/features/multiple_journals.feature @@ -80,9 +80,9 @@ Feature: Multiple journals 2012-07-23 09:00 sell my junk on ebay and make lots of money Scenario: Don't crash if no default journal is specified - Given we use the config "bug343.yaml" + Given we use the config "no_default_journal.yaml" When we run "jrnl a long day in the office" - Then the output should contain "No default journal configured" + Then the output should contain "No 'default' journal configured" Scenario: Don't crash if no file exists for a configured encrypted journal Given we use the config "multiple.yaml" diff --git a/tests/data/configs/bug343.yaml b/tests/data/configs/no_default_journal.yaml similarity index 100% rename from tests/data/configs/bug343.yaml rename to tests/data/configs/no_default_journal.yaml From c32acd0123eeffcfe0398e806ed91575a5b2e7d1 Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Sat, 22 Oct 2022 22:36:58 +0000 Subject: [PATCH 04/14] Update changelog [ci skip] --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50cca6d7..7e0fb42f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta...HEAD) +**Implemented enhancements:** + +- Add machine-readable format for --list [\#1445](https://github.com/jrnl-org/jrnl/issues/1445) + +**Fixed bugs:** + +- Fix bug for new `--list --format` options when no default journal is specified [\#1621](https://github.com/jrnl-org/jrnl/pull/1621) ([wren](https://github.com/wren)) + **Documentation:** - Documentation of "display\_format" incorrectly states that it can be used to change date display format [\#1617](https://github.com/jrnl-org/jrnl/issues/1617) From ffdd4f923df108ffaf9005efc8bdacb80a51eb71 Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Sat, 22 Oct 2022 22:38:31 +0000 Subject: [PATCH 05/14] Increment version to v3.3-beta2 --- jrnl/__version__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jrnl/__version__.py b/jrnl/__version__.py index 519d4206..09700b5f 100644 --- a/jrnl/__version__.py +++ b/jrnl/__version__.py @@ -1 +1 @@ -__version__ = "v3.3-beta" +__version__ = "v3.3-beta2" diff --git a/pyproject.toml b/pyproject.toml index 79b232b7..6bc38d94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "jrnl" -version = "v3.3-beta" +version = "v3.3-beta2" description = "Collect your thoughts and notes without leaving the command line." authors = [ "jrnl contributors ", From 6cd8c35598f02022028163348472c1b99d68b7e7 Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Sat, 22 Oct 2022 22:40:26 +0000 Subject: [PATCH 06/14] Update changelog [ci skip] --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e0fb42f..c86cf268 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Changelog -## [Unreleased](https://github.com/jrnl-org/jrnl/) +## [v3.3-beta2](https://pypi.org/project/jrnl/v3.3-beta2/) (2022-10-22) -[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta...HEAD) +[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta...v3.3-beta2) **Implemented enhancements:** From c6479c70c139a6475317f58cb2dca7859867365e Mon Sep 17 00:00:00 2001 From: Micah Jerome Ellison Date: Sat, 29 Oct 2022 11:51:41 -0700 Subject: [PATCH 07/14] Add contextual link to external editors page from overview --- docs/overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/overview.md b/docs/overview.md index df09d273..5ab25c1a 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -39,7 +39,7 @@ read them or edit them. `jrnl` plays nicely with your favorite text editor. You may prefer to write journal entries in an editor. Or you may want to make changes that require a more comprehensive application. `jrnl` can filter specific entries and pass them -to the external editor of your choice. +to the [external editor](./external-editors.md) of your choice. ## Encryption From 6f9a3eb5369fe95499f27d0c08e28bb57b93fdd9 Mon Sep 17 00:00:00 2001 From: Micah Jerome Ellison Date: Sat, 29 Oct 2022 12:14:28 -0700 Subject: [PATCH 08/14] Document that editors must be blocking processes (#1624) * Describe blocking processes in External Editors page * Add documentation about how the editor must be a blocking process * Add contextual link to external editor site * Point to micro editor as an example since it's likely less intimidating than vim --- docs/external-editors.md | 6 ++++-- docs/reference-config-file.md | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/external-editors.md b/docs/external-editors.md index be321bab..4e8f70b7 100644 --- a/docs/external-editors.md +++ b/docs/external-editors.md @@ -8,11 +8,13 @@ License: https://www.gnu.org/licenses/gpl-3.0.html Configure your preferred external editor by updating the `editor` option in your [configuration file](./reference-config-file.md#editor) +If your editor is not in your operating system's `PATH` environment variable, +then you will have to enter in the full path of your editor. + !!! note To save and log any entry edits, save and close the file. -If your editor is not in your operating system's `PATH` environment variable, -then you will have to enter in the full path of your editor. +All editors must be [blocking processes](https://en.wikipedia.org/wiki/Blocking_(computing)) to work with jrnl. Some editors, such as [micro](https://micro-editor.github.io/), are blocking by default, though others can be made to block with additional arguments, such as many of those documented below. If jrnl opens your editor but finishes running immediately, then your editor is not a blocking process, and you may be able to correct that with one of the suggestions below. ## Sublime Text diff --git a/docs/reference-config-file.md b/docs/reference-config-file.md index 3a057cdb..1c58a3a2 100644 --- a/docs/reference-config-file.md +++ b/docs/reference-config-file.md @@ -47,10 +47,11 @@ key will be used instead. If set, executes this command to launch an external editor for writing and editing your entries. The path to a temporary file is passed after it, and `jrnl` processes the file once -the editor is closed. +the editor returns control to `jrnl`. -Some editors require special options to work properly. See -[External Editors](external-editors.md) for details. +Some editors require special options to work properly, since they must be +blocking processes to work with `jrnl`. See [External Editors](external-editors.md) +for details. ### encrypt If `true`, encrypts your journal using AES. Do not change this From 81771eff4fa9e78ec955ee39324a3e0837198708 Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Sat, 29 Oct 2022 19:16:11 +0000 Subject: [PATCH 09/14] Update changelog [ci skip] --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c86cf268..ae8dc0c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [Unreleased](https://github.com/jrnl-org/jrnl/) + +[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta2...HEAD) + +**Documentation:** + +- Add documentation about how the editor must be a blocking process [\#1456](https://github.com/jrnl-org/jrnl/issues/1456) + ## [v3.3-beta2](https://pypi.org/project/jrnl/v3.3-beta2/) (2022-10-22) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta...v3.3-beta2) From 415fc336ec2648a3462b4ccb29425c59f00ae7a5 Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Sat, 29 Oct 2022 19:19:53 +0000 Subject: [PATCH 10/14] Increment version to v3.3 --- jrnl/__version__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jrnl/__version__.py b/jrnl/__version__.py index 09700b5f..3d0bbe9b 100644 --- a/jrnl/__version__.py +++ b/jrnl/__version__.py @@ -1 +1 @@ -__version__ = "v3.3-beta2" +__version__ = "v3.3" diff --git a/pyproject.toml b/pyproject.toml index 6bc38d94..3ed885c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "jrnl" -version = "v3.3-beta2" +version = "v3.3" description = "Collect your thoughts and notes without leaving the command line." authors = [ "jrnl contributors ", From 60590e0c49788ea91d54144b67efee49d91f31c2 Mon Sep 17 00:00:00 2001 From: Jrnl Bot Date: Sat, 29 Oct 2022 19:27:02 +0000 Subject: [PATCH 11/14] Update changelog [ci skip] --- CHANGELOG.md | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae8dc0c3..02a19981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,50 +1,21 @@ # Changelog -## [Unreleased](https://github.com/jrnl-org/jrnl/) +## [v3.3](https://pypi.org/project/jrnl/v3.3/) (2022-10-29) -[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta2...HEAD) - -**Documentation:** - -- Add documentation about how the editor must be a blocking process [\#1456](https://github.com/jrnl-org/jrnl/issues/1456) - -## [v3.3-beta2](https://pypi.org/project/jrnl/v3.3-beta2/) (2022-10-22) - -[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta...v3.3-beta2) +[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta2...v3.3) **Implemented enhancements:** -- Add machine-readable format for --list [\#1445](https://github.com/jrnl-org/jrnl/issues/1445) - -**Fixed bugs:** - -- Fix bug for new `--list --format` options when no default journal is specified [\#1621](https://github.com/jrnl-org/jrnl/pull/1621) ([wren](https://github.com/wren)) - -**Documentation:** - -- Documentation of "display\_format" incorrectly states that it can be used to change date display format [\#1617](https://github.com/jrnl-org/jrnl/issues/1617) -- Remove wrong option in configuration file reference [\#1618](https://github.com/jrnl-org/jrnl/pull/1618) ([DSiekmeier](https://github.com/DSiekmeier)) - -## [v3.3-beta](https://pypi.org/project/jrnl/v3.3-beta/) (2022-10-08) - -[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.2...v3.3-beta) - -**Implemented enhancements:** - -- Add dependency security checks in CI [\#1488](https://github.com/jrnl-org/jrnl/issues/1488) -- Add machine-readable format for --list [\#1445](https://github.com/jrnl-org/jrnl/issues/1445) - Change default config to use journal key [\#1594](https://github.com/jrnl-org/jrnl/pull/1594) ([micahellison](https://github.com/micahellison)) - Add machine readable --list output [\#1592](https://github.com/jrnl-org/jrnl/pull/1592) ([apainintheneck](https://github.com/apainintheneck)) **Fixed bugs:** -- Bug Report - Sometimes jrnl crashes and truncates journal file [\#1599](https://github.com/jrnl-org/jrnl/issues/1599) -- Zero-length file created when attempting to export YAML to a directory that does not exist [\#1593](https://github.com/jrnl-org/jrnl/issues/1593) +- Fix bug for new `--list --format` options when no default journal is specified [\#1621](https://github.com/jrnl-org/jrnl/pull/1621) ([wren](https://github.com/wren)) - Don't create empty file when attempting a YAML export to a non-existing folder [\#1600](https://github.com/jrnl-org/jrnl/pull/1600) ([outa](https://github.com/outa)) **Build:** -- Replace Dependabot [\#1560](https://github.com/jrnl-org/jrnl/issues/1560) - Update `.gitignore` [\#1604](https://github.com/jrnl-org/jrnl/pull/1604) ([wren](https://github.com/wren)) - Fix Docs Accessibility Testing [\#1588](https://github.com/jrnl-org/jrnl/pull/1588) ([wren](https://github.com/wren)) - Update to use renamed flag for `brew bump-formula-pr` [\#1587](https://github.com/jrnl-org/jrnl/pull/1587) ([wren](https://github.com/wren)) @@ -56,8 +27,9 @@ **Documentation:** -- \[Documentation\] Edit on Github link broken [\#1601](https://github.com/jrnl-org/jrnl/issues/1601) -- Update `--format yaml` example in docs [\#1525](https://github.com/jrnl-org/jrnl/issues/1525) +- Add documentation about how the editor must be a blocking process [\#1456](https://github.com/jrnl-org/jrnl/issues/1456) +- Document that editors must be blocking processes [\#1624](https://github.com/jrnl-org/jrnl/pull/1624) ([micahellison](https://github.com/micahellison)) +- Remove wrong option in configuration file reference [\#1618](https://github.com/jrnl-org/jrnl/pull/1618) ([DSiekmeier](https://github.com/DSiekmeier)) - Update YAML export description in docs [\#1591](https://github.com/jrnl-org/jrnl/pull/1591) ([apainintheneck](https://github.com/apainintheneck)) - Update dependency jinja2 to v3.1.2 [\#1579](https://github.com/jrnl-org/jrnl/pull/1579) ([renovate[bot]](https://github.com/apps/renovate)) - Update dependency typed.js to v2.0.12 [\#1578](https://github.com/jrnl-org/jrnl/pull/1578) ([renovate[bot]](https://github.com/apps/renovate)) From 847dadac5dca7b40f0e6d428ff749edf23d6b1b5 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 29 Oct 2022 12:38:53 -0700 Subject: [PATCH 12/14] Manual change to changelog [ci skip] - Document that v3.0 had breaking changes with emoji for emphasis --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02a19981..9ec50c1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,6 +95,8 @@ [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.0-beta2...v3.0) +🚨 **BREAKING CHANGES** 🚨 + **Implemented enhancements:** - Show name of journal when creating a password/encrypting [\#1478](https://github.com/jrnl-org/jrnl/pull/1478) ([jonakeys](https://github.com/jonakeys)) From a77a3d5a56f2ac969a199763c928ec2558a22329 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 29 Oct 2022 14:21:11 -0700 Subject: [PATCH 13/14] Replace `flake8` with `flakeheaven` in linting steps (#1625) * replace flake8 with flakeheaven * update pyproject.toml for new flake tool * update lock file * change flake8 to flakeheaven in tests * undo fix for poetry * remove unused plugin marker for flakeheaven * remove unused import in markdown file * Attempt to exclude .venv from flakeheaven runs in CI * Exclude more dirs from flakeheaven Co-authored-by: Micah Jerome Ellison --- docs/encryption.md | 1 - poetry.lock | 53 +++++++++++++++++++++++++++++++--------------- pyproject.toml | 29 +++++++++++++++++++------ 3 files changed, 59 insertions(+), 24 deletions(-) diff --git a/docs/encryption.md b/docs/encryption.md index 31f64502..6dae9a48 100644 --- a/docs/encryption.md +++ b/docs/encryption.md @@ -140,7 +140,6 @@ import argparse from Crypto.Cipher import AES import getpass import hashlib -import sys parser = argparse.ArgumentParser() parser.add_argument("filepath", help="journal file to decrypt") diff --git a/poetry.lock b/poetry.lock index 9e724658..eda94884 100644 --- a/poetry.lock +++ b/poetry.lock @@ -178,6 +178,14 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "entrypoints" +version = "0.4" +description = "Discover and load entry points from installed packages." +category = "dev" +optional = false +python-versions = ">=3.6" + [[package]] name = "execnet" version = "1.9.0" @@ -222,6 +230,25 @@ mccabe = ">=0.6.0,<0.7.0" pycodestyle = ">=2.8.0,<2.9.0" pyflakes = ">=2.4.0,<2.5.0" +[[package]] +name = "flakeheaven" +version = "3.2.0" +description = "FlakeHeaven is a [Flake8](https://gitlab.com/pycqa/flake8) wrapper to make it cool." +category = "dev" +optional = false +python-versions = ">=3.7,<4.0" + +[package.dependencies] +colorama = "*" +entrypoints = "*" +flake8 = ">=4.0.1,<5.0.0" +pygments = "*" +toml = "*" +urllib3 = "*" + +[package.extras] +docs = ["alabaster", "myst-parser (>=0.18.0,<0.19.0)", "pygments-github-lexers", "sphinx"] + [[package]] name = "ghp-import" version = "2.1.0" @@ -713,18 +740,6 @@ python-versions = ">=3.6.8" [package.extras] diagrams = ["jinja2", "railroad-diagrams"] -[[package]] -name = "pyproject-flake8" -version = "0.0.1a5" -description = "pyproject-flake8 (`pflake8`), a monkey patching wrapper to connect flake8 with pyproject.toml configuration" -category = "dev" -optional = false -python-versions = "*" - -[package.dependencies] -flake8 = "<5.0.0" -tomli = {version = "*", markers = "python_version < \"3.11\""} - [[package]] name = "pytest" version = "7.1.2" @@ -1128,7 +1143,7 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "1.1" python-versions = ">=3.9.0, <3.12" -content-hash = "c9bebe280520ae31feec25f734a8404eee0e0f3b3691e9e7e75af0c54a1b02db" +content-hash = "57ed0eb87ee7fe21231b53feb5e4bfdcd154bbb91e52c38d484ab193ff582ec8" [metadata.files] ansiwrap = [ @@ -1297,6 +1312,10 @@ distlib = [ {file = "distlib-0.3.5-py2.py3-none-any.whl", hash = "sha256:b710088c59f06338ca514800ad795a132da19fda270e3ce4affc74abf955a26c"}, {file = "distlib-0.3.5.tar.gz", hash = "sha256:a7f75737c70be3b25e2bee06288cec4e4c221de18455b2dd037fe2a795cab2fe"}, ] +entrypoints = [ + {file = "entrypoints-0.4-py3-none-any.whl", hash = "sha256:f174b5ff827504fd3cd97cc3f8649f3693f51538c7e4bdf3ef002c8429d42f9f"}, + {file = "entrypoints-0.4.tar.gz", hash = "sha256:b706eddaa9218a19ebcd67b56818f05bb27589b1ca9e8d797b74affad4ccacd4"}, +] execnet = [ {file = "execnet-1.9.0-py2.py3-none-any.whl", hash = "sha256:a295f7cc774947aac58dde7fdc85f4aa00c42adf5d8f5468fc630c1acf30a142"}, {file = "execnet-1.9.0.tar.gz", hash = "sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5"}, @@ -1313,6 +1332,10 @@ flake8 = [ {file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"}, {file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"}, ] +flakeheaven = [ + {file = "flakeheaven-3.2.0-py3-none-any.whl", hash = "sha256:ec5a508c3db64d73128b65cb2a5a2c0a2d9f2e4b435e9fa2bcc03bf0df86da79"}, + {file = "flakeheaven-3.2.0.tar.gz", hash = "sha256:225333d7bf309079f19a2c5f02d427fc7558a0d0c065944de88041ca94f5525c"}, +] ghp-import = [ {file = "ghp-import-2.1.0.tar.gz", hash = "sha256:9c535c4c61193c2df8871222567d7fd7e5014d835f97dc7b7439069e2413d343"}, {file = "ghp_import-2.1.0-py3-none-any.whl", hash = "sha256:8337dd7b50877f163d4c0289bc1f1c7f127550241988d568c1db512c4324a619"}, @@ -1516,10 +1539,6 @@ pyparsing = [ {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, {file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"}, ] -pyproject-flake8 = [ - {file = "pyproject-flake8-0.0.1a5.tar.gz", hash = "sha256:22542080ba90d4bd80ee060852db15a24aeea61c9a29ed7c16f5b59b0e47a03a"}, - {file = "pyproject_flake8-0.0.1a5-py2.py3-none-any.whl", hash = "sha256:c843d760c49d7b270e9abda58a57765c031918a9d10da25aa43572f5d77cac43"}, -] pytest = [ {file = "pytest-7.1.2-py3-none-any.whl", hash = "sha256:13d0e3ccfc2b6e26be000cb6568c832ba67ba32e719443bfe725814d3c42433c"}, {file = "pytest-7.1.2.tar.gz", hash = "sha256:a06a0425453864a270bc45e71f783330a7428defb4230fb5e6a731fde06ecd45"}, diff --git a/pyproject.toml b/pyproject.toml index 3ed885c8..8828520e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,11 +44,11 @@ tzlocal = ">=4.0" # https://github.com/regebro/tzlocal/blob/master/CHANGES.txt [tool.poetry.dev-dependencies] black = { version = ">=21.5b2", allow-prereleases = true } +flakeheaven = ">=3.0" ipdb = "*" isort = ">=5.10" mkdocs = ">=1.0,<1.3" poethepoet = "*" -pyproject-flake8 = "*" pytest = ">=6.2" pytest-bdd = ">=4.0.1,<6.0" pytest-clarity = "*" @@ -70,8 +70,9 @@ format-check = [ {cmd = "black --check --diff ."}, ] style-check = [ - {cmd = "pflake8 --version"}, - {cmd = "pflake8 jrnl tests tasks.py"}, + {cmd = "flakeheaven --version"}, + {cmd = "flakeheaven plugins"}, + {cmd = "flakeheaven lint"}, ] sort-run = [ {cmd = "isort ."}, @@ -150,9 +151,25 @@ filterwarnings = [ "ignore:[WinError 5].*" ] -[tool.flake8] -# ignore formatting warnings and errors because we use Black to autoformat -extend-ignore = "E101,E111,E114,E115,E116,E117,E12,E13,E2,E3,E401,E5,E70,W1,W2,W3,W5" +[tool.flakeheaven] +max_line_length = 88 +exclude = [".git", ".tox", ".venv", "node_modules"] + +[tool.flakeheaven.plugins] +"py*" = ["+*"] +pycodestyle = [ + "-E101", + "-E111", "-E114", "-E115", "-E116", "-E117", + "-E12*", + "-E13*", + "-E2*", + "-E3*", + "-E401", + "-E5*", + "-E70", + "-W1*", "-W2*", "-W3*", "-W5*", +] + [build-system] requires = ["poetry-core>=1.0.0"] From 74b7ac834e67ce0f7049b0825b833a8dd4a6737b Mon Sep 17 00:00:00 2001 From: Micah Jerome Ellison Date: Sat, 29 Oct 2022 14:36:50 -0700 Subject: [PATCH 14/14] Drop Python 3.9 and use Python 3.11 official release (#1611) * Drop Python 3.9 and use Python 3.11 release instead of pre-release * Run poetry lock * Fix need for quoted 3.10 string * Use 3.11.0-rc.2 for Python 3.11 for now * Update minimum Python version in installation docs * Change Python 3.11 RC version to 3.11 * Run docs and release workflows on Python 3.11 * Including Python 3.12 in allowable versions * Restore poetry.lock from develop * Run poetry lock --no-update * Retrieve poetry.lock from develop and lock with --no-update * poetry lock --no-update --- .github/workflows/docs.yaml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/testing_prs.yaml | 2 +- .github/workflows/testing_schedule.yaml | 2 +- docs/installation.md | 2 +- poetry.lock | 39 +++++++------------------ pyproject.toml | 2 +- 7 files changed, 17 insertions(+), 34 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index c51693ab..988e1cfc 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: true matrix: - python-version: [ 3.9 ] + python-version: [ '3.11' ] os: [ ubuntu-latest ] steps: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 62614b2d..eff2d991 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -68,7 +68,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: '3.11' - name: Checkout repo uses: actions/checkout@v3 diff --git a/.github/workflows/testing_prs.yaml b/.github/workflows/testing_prs.yaml index f6537237..f28c72af 100644 --- a/.github/workflows/testing_prs.yaml +++ b/.github/workflows/testing_prs.yaml @@ -37,7 +37,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ 3.9, '3.10', 3.11-dev ] + python-version: [ '3.10', '3.11' ] os: [ ubuntu-latest, macos-latest, windows-latest ] steps: - run: git config --global core.autocrlf false diff --git a/.github/workflows/testing_schedule.yaml b/.github/workflows/testing_schedule.yaml index 9879bd26..ec6c7f8a 100644 --- a/.github/workflows/testing_schedule.yaml +++ b/.github/workflows/testing_schedule.yaml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ 3.9, '3.10', 3.11-dev ] + python-version: [ '3.10', '3.11' ] os: [ ubuntu-latest, macos-latest, windows-latest ] steps: - run: git config --global core.autocrlf false diff --git a/docs/installation.md b/docs/installation.md index 82b9d450..08defc34 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -14,7 +14,7 @@ On Mac and Linux, the easiest way to install `jrnl` is using brew install jrnl ``` -On other platforms, install `jrnl` using [Python](https://www.python.org/) 3.6+ and [pipx](https://pipxproject.github.io/pipx/): +On other platforms, install `jrnl` using [Python](https://www.python.org/) 3.10+ and [pipx](https://pipxproject.github.io/pipx/): ``` sh pipx install jrnl diff --git a/poetry.lock b/poetry.lock index eda94884..2dcfe584 100644 --- a/poetry.lock +++ b/poetry.lock @@ -51,7 +51,7 @@ python-versions = ">=3.5" dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy (>=0.900,!=0.940)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "sphinx", "sphinx-notfound-page", "zope.interface"] docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"] tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "zope.interface"] -tests_no_zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"] +tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"] [[package]] name = "backcall" @@ -75,7 +75,6 @@ mypy-extensions = ">=0.4.3" pathspec = ">=0.9.0" platformdirs = ">=2" tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} -typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} [package.extras] colorama = ["colorama (>=0.4.3)"] @@ -111,7 +110,7 @@ optional = false python-versions = ">=3.6.0" [package.extras] -unicode_backport = ["unicodedata2"] +unicode-backport = ["unicodedata2"] [[package]] name = "click" @@ -283,7 +282,7 @@ python-versions = ">=3.5" name = "importlib-metadata" version = "4.12.0" description = "Read metadata from Python packages" -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -351,7 +350,7 @@ notebook = ["ipywidgets", "notebook"] parallel = ["ipyparallel"] qtconsole = ["qtconsole"] test = ["pytest (<7.1)", "pytest-asyncio", "testpath"] -test_extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.19)", "pandas", "pytest (<7.1)", "pytest-asyncio", "testpath", "trio"] +test-extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.19)", "pandas", "pytest (<7.1)", "pytest-asyncio", "testpath", "trio"] [[package]] name = "isort" @@ -363,9 +362,9 @@ python-versions = ">=3.6.1,<4.0" [package.extras] colors = ["colorama (>=0.4.3,<0.5.0)"] -pipfile_deprecated_finder = ["pipreqs", "requirementslib"] +pipfile-deprecated-finder = ["pipreqs", "requirementslib"] plugins = ["setuptools"] -requirements_deprecated_finder = ["pip-api", "pipreqs"] +requirements-deprecated-finder = ["pip-api", "pipreqs"] [[package]] name = "jedi" @@ -417,7 +416,6 @@ optional = false python-versions = ">=3.7" [package.dependencies] -importlib-metadata = {version = ">=3.6", markers = "python_version < \"3.10\""} jeepney = {version = ">=0.4.2", markers = "sys_platform == \"linux\""} pywin32-ctypes = {version = "<0.1.0 || >0.1.0,<0.1.1 || >0.1.1", markers = "sys_platform == \"win32\""} SecretStorage = {version = ">=3.2", markers = "sys_platform == \"linux\""} @@ -450,9 +448,6 @@ category = "dev" optional = false python-versions = ">=3.7" -[package.dependencies] -importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""} - [package.extras] testing = ["coverage", "pyyaml"] @@ -649,7 +644,7 @@ pastel = ">=0.2.1,<0.3.0" tomli = ">=1.2.2" [package.extras] -poetry_plugin = ["poetry (>=1.0,<2.0)"] +poetry-plugin = ["poetry (>=1.0,<2.0)"] [[package]] name = "pprintpp" @@ -893,7 +888,7 @@ urllib3 = ">=1.21.1,<1.27" [package.extras] socks = ["PySocks (>=1.5.6,!=1.5.7)"] -use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"] +use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "rich" @@ -1039,14 +1034,6 @@ python-versions = ">=3.7" [package.extras] test = ["pre-commit", "pytest"] -[[package]] -name = "typing-extensions" -version = "4.3.0" -description = "Backported and Experimental Type Hints for Python 3.7+" -category = "dev" -optional = false -python-versions = ">=3.7" - [[package]] name = "tzdata" version = "2022.1" @@ -1132,7 +1119,7 @@ python-versions = ">=3.4" name = "zipp" version = "3.8.1" description = "Backport of pathlib-compatible object wrapper for zip files" -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -1142,8 +1129,8 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "1.1" -python-versions = ">=3.9.0, <3.12" -content-hash = "57ed0eb87ee7fe21231b53feb5e4bfdcd154bbb91e52c38d484ab193ff582ec8" +python-versions = ">=3.10.0, <3.13" +content-hash = "e2a31438b3c6fbf90093531b3f877818d8dbf85e2c4f95e879888a3aa66a4ee3" [metadata.files] ansiwrap = [ @@ -1700,10 +1687,6 @@ traitlets = [ {file = "traitlets-5.3.0-py3-none-any.whl", hash = "sha256:65fa18961659635933100db8ca120ef6220555286949774b9cfc106f941d1c7a"}, {file = "traitlets-5.3.0.tar.gz", hash = "sha256:0bb9f1f9f017aa8ec187d8b1b2a7a6626a2a1d877116baba52a129bfa124f8e2"}, ] -typing-extensions = [ - {file = "typing_extensions-4.3.0-py3-none-any.whl", hash = "sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02"}, - {file = "typing_extensions-4.3.0.tar.gz", hash = "sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6"}, -] tzdata = [ {file = "tzdata-2022.1-py2.py3-none-any.whl", hash = "sha256:238e70234214138ed7b4e8a0fab0e5e13872edab3be586ab8198c407620e2ab9"}, {file = "tzdata-2022.1.tar.gz", hash = "sha256:8b536a8ec63dc0751342b3984193a3118f8fca2afe25752bb9b7fffd398552d3"}, diff --git a/pyproject.toml b/pyproject.toml index 8828520e..be70a1e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ classifiers = [ "Funding" = "https://opencollective.com/jrnl" [tool.poetry.dependencies] -python = ">=3.9.0, <3.12" +python = ">=3.10.0, <3.13" ansiwrap = "^0.8.4" colorama = ">=0.4" # https://github.com/tartley/colorama/blob/master/CHANGELOG.rst