Merge branch 'develop' into encryption-rework

Conflicts:
  jrnl/Journal.py
  jrnl/commands.py
This commit is contained in:
Jonathan Wren 2022-10-29 14:41:10 -07:00
commit dda61296e5
No known key found for this signature in database
21 changed files with 164 additions and 96 deletions

View file

@ -32,7 +32,7 @@ jobs:
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
python-version: [ 3.9 ] python-version: [ '3.11' ]
os: [ ubuntu-latest ] os: [ ubuntu-latest ]
steps: steps:

View file

@ -68,7 +68,7 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: 3.9 python-version: '3.11'
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3

View file

@ -37,7 +37,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: [ 3.9, '3.10', 3.11-dev ] python-version: [ '3.10', '3.11' ]
os: [ ubuntu-latest, macos-latest, windows-latest ] os: [ ubuntu-latest, macos-latest, windows-latest ]
steps: steps:
- run: git config --global core.autocrlf false - run: git config --global core.autocrlf false

View file

@ -17,7 +17,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: [ 3.9, '3.10', 3.11-dev ] python-version: [ '3.10', '3.11' ]
os: [ ubuntu-latest, macos-latest, windows-latest ] os: [ ubuntu-latest, macos-latest, windows-latest ]
steps: steps:
- run: git config --global core.autocrlf false - run: git config --global core.autocrlf false

View file

@ -1,25 +1,21 @@
# Changelog # Changelog
## [v3.3-beta](https://pypi.org/project/jrnl/v3.3-beta/) (2022-10-08) ## [v3.3](https://pypi.org/project/jrnl/v3.3/) (2022-10-29)
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.2...v3.3-beta) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.3-beta2...v3.3)
**Implemented enhancements:** **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)) - 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)) - Add machine readable --list output [\#1592](https://github.com/jrnl-org/jrnl/pull/1592) ([apainintheneck](https://github.com/apainintheneck))
**Fixed bugs:** **Fixed bugs:**
- Bug Report - Sometimes jrnl crashes and truncates journal file [\#1599](https://github.com/jrnl-org/jrnl/issues/1599) - 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))
- 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)
- 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)) - 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:** **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)) - 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)) - 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)) - Update to use renamed flag for `brew bump-formula-pr` [\#1587](https://github.com/jrnl-org/jrnl/pull/1587) ([wren](https://github.com/wren))
@ -31,8 +27,9 @@
**Documentation:** **Documentation:**
- \[Documentation\] Edit on Github link broken [\#1601](https://github.com/jrnl-org/jrnl/issues/1601) - Add documentation about how the editor must be a blocking process [\#1456](https://github.com/jrnl-org/jrnl/issues/1456)
- Update `--format yaml` example in docs [\#1525](https://github.com/jrnl-org/jrnl/issues/1525) - 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 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 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)) - Update dependency typed.js to v2.0.12 [\#1578](https://github.com/jrnl-org/jrnl/pull/1578) ([renovate[bot]](https://github.com/apps/renovate))
@ -98,6 +95,8 @@
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.0-beta2...v3.0) [Full Changelog](https://github.com/jrnl-org/jrnl/compare/v3.0-beta2...v3.0)
🚨 **BREAKING CHANGES** 🚨
**Implemented enhancements:** **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)) - Show name of journal when creating a password/encrypting [\#1478](https://github.com/jrnl-org/jrnl/pull/1478) ([jonakeys](https://github.com/jonakeys))

View file

@ -140,7 +140,6 @@ import argparse
from Crypto.Cipher import AES from Crypto.Cipher import AES
import getpass import getpass
import hashlib import hashlib
import sys
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("filepath", help="journal file to decrypt") parser.add_argument("filepath", help="journal file to decrypt")

View file

@ -8,11 +8,13 @@ License: https://www.gnu.org/licenses/gpl-3.0.html
Configure your preferred external editor by updating the `editor` option Configure your preferred external editor by updating the `editor` option
in your [configuration file](./reference-config-file.md#editor) 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 !!! note
To save and log any entry edits, save and close the file. 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, 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.
then you will have to enter in the full path of your editor.
## Sublime Text ## Sublime Text

View file

@ -14,7 +14,7 @@ On Mac and Linux, the easiest way to install `jrnl` is using
brew install jrnl 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 ``` sh
pipx install jrnl pipx install jrnl

View file

@ -39,7 +39,7 @@ read them or edit them.
`jrnl` plays nicely with your favorite text editor. You may prefer to write `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 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 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 ## Encryption

View file

@ -47,10 +47,11 @@ key will be used instead.
If set, executes this command to launch an external editor for If set, executes this command to launch an external editor for
writing and editing your entries. The path to a temporary file writing and editing your entries. The path to a temporary file
is passed after it, and `jrnl` processes the file once 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 Some editors require special options to work properly, since they must be
[External Editors](external-editors.md) for details. blocking processes to work with `jrnl`. See [External Editors](external-editors.md)
for details.
### encrypt ### encrypt
If `true`, encrypts your journal using AES. Do not change this If `true`, encrypts your journal using AES. Do not change this
@ -90,9 +91,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 Do not change this for an existing journal, since that might lead
to data loss. to data loss.
If you would just like to change how `jrnl` displays dates,
use display_format instead.
!!! note !!! note
`jrnl` doesn't support the `%z` or `%Z` time zone identifiers. `jrnl` doesn't support the `%z` or `%Z` time zone identifiers.

View file

@ -8,6 +8,7 @@ import re
from jrnl import Entry from jrnl import Entry
from jrnl import time from jrnl import time
from jrnl.config import validate_journal_name
from jrnl.encryption import determine_encryption_method from jrnl.encryption import determine_encryption_method
from jrnl.messages import Message from jrnl.messages import Message
from jrnl.messages import MsgStyle from jrnl.messages import MsgStyle
@ -437,6 +438,7 @@ def open_journal(journal_name, config, legacy=False):
If legacy is True, it will open Journals with legacy classes build for If legacy is True, it will open Journals with legacy classes build for
backwards compatibility with jrnl 1.x backwards compatibility with jrnl 1.x
""" """
validate_journal_name(journal_name, config)
config = config.copy() config = config.copy()
config["journal"] = expand_path(config["journal"]) config["journal"] = expand_path(config["journal"])

View file

@ -1 +1 @@
__version__ = "v3.3-beta" __version__ = "v3.3"

View file

@ -14,10 +14,12 @@ run.
Also, please note that all (non-builtin) imports should be scoped to each function to Also, please note that all (non-builtin) imports should be scoped to each function to
avoid any possible overhead for these standalone commands. avoid any possible overhead for these standalone commands.
""" """
import argparse
import logging import logging
import platform import platform
import sys import sys
from jrnl.config import cmd_requires_valid_journal_name
from jrnl.exception import JrnlException from jrnl.exception import JrnlException
from jrnl.messages import Message from jrnl.messages import Message
from jrnl.messages import MsgStyle from jrnl.messages import MsgStyle
@ -56,13 +58,16 @@ def preconfig_version(_):
print(output) print(output)
def postconfig_list(args, config, **kwargs): def postconfig_list(args: argparse.Namespace, config: dict, **_) -> int:
from jrnl.output import list_journals from jrnl.output import list_journals
print(list_journals(config, args.export)) 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.Journal import open_journal
from jrnl.plugins import get_importer from jrnl.plugins import get_importer
@ -72,8 +77,13 @@ def postconfig_import(args, config, **kwargs):
format = args.export if args.export else "jrnl" format = args.export if args.export else "jrnl"
get_importer(format).import_(journal, args.filename) 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 Encrypt a journal in place, or optionally to a new file
""" """
@ -121,8 +131,13 @@ def postconfig_encrypt(args, config, original_config, **kwargs):
) )
save_config(original_config) 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.""" """Decrypts into new file. If filename is not set, we encrypt the journal file itself."""
from jrnl.config import update_config from jrnl.config import update_config
from jrnl.install import save_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 original_config, {"encrypt": False}, args.journal_name, force_local=True
) )
save_config(original_config) save_config(original_config)
return 0

View file

@ -1,8 +1,10 @@
# Copyright © 2012-2022 jrnl contributors # Copyright © 2012-2022 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
import argparse
import logging import logging
import os import os
from typing import Callable
import colorama import colorama
import xdg.BaseDirectory import xdg.BaseDirectory
@ -213,14 +215,27 @@ def get_journal_name(args, config):
args.journal_name = potential_journal_name args.journal_name = potential_journal_name
args.text = args.text[1:] 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) logging.debug("Using journal name: %s", args.journal_name)
return args 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),
},
),
)

View file

@ -103,7 +103,7 @@ class MsgText(Enum):
{template} {template}
""" """
NoDefaultJournal = "No default journal configured\n{journals}" NoNamedJournal = "No '{journal_name}' journal configured\n{journals}"
DoesNotExist = "{name} does not exist" DoesNotExist = "{name} does not exist"

90
poetry.lock generated
View file

@ -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"] 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"] 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 = ["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]] [[package]]
name = "backcall" name = "backcall"
@ -75,7 +75,6 @@ mypy-extensions = ">=0.4.3"
pathspec = ">=0.9.0" pathspec = ">=0.9.0"
platformdirs = ">=2" platformdirs = ">=2"
tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} 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] [package.extras]
colorama = ["colorama (>=0.4.3)"] colorama = ["colorama (>=0.4.3)"]
@ -111,7 +110,7 @@ optional = false
python-versions = ">=3.6.0" python-versions = ">=3.6.0"
[package.extras] [package.extras]
unicode_backport = ["unicodedata2"] unicode-backport = ["unicodedata2"]
[[package]] [[package]]
name = "click" name = "click"
@ -178,6 +177,14 @@ category = "dev"
optional = false optional = false
python-versions = "*" 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]] [[package]]
name = "execnet" name = "execnet"
version = "1.9.0" version = "1.9.0"
@ -222,6 +229,25 @@ mccabe = ">=0.6.0,<0.7.0"
pycodestyle = ">=2.8.0,<2.9.0" pycodestyle = ">=2.8.0,<2.9.0"
pyflakes = ">=2.4.0,<2.5.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]] [[package]]
name = "ghp-import" name = "ghp-import"
version = "2.1.0" version = "2.1.0"
@ -256,7 +282,7 @@ python-versions = ">=3.5"
name = "importlib-metadata" name = "importlib-metadata"
version = "4.12.0" version = "4.12.0"
description = "Read metadata from Python packages" description = "Read metadata from Python packages"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
@ -324,7 +350,7 @@ notebook = ["ipywidgets", "notebook"]
parallel = ["ipyparallel"] parallel = ["ipyparallel"]
qtconsole = ["qtconsole"] qtconsole = ["qtconsole"]
test = ["pytest (<7.1)", "pytest-asyncio", "testpath"] 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]] [[package]]
name = "isort" name = "isort"
@ -336,9 +362,9 @@ python-versions = ">=3.6.1,<4.0"
[package.extras] [package.extras]
colors = ["colorama (>=0.4.3,<0.5.0)"] colors = ["colorama (>=0.4.3,<0.5.0)"]
pipfile_deprecated_finder = ["pipreqs", "requirementslib"] pipfile-deprecated-finder = ["pipreqs", "requirementslib"]
plugins = ["setuptools"] plugins = ["setuptools"]
requirements_deprecated_finder = ["pip-api", "pipreqs"] requirements-deprecated-finder = ["pip-api", "pipreqs"]
[[package]] [[package]]
name = "jedi" name = "jedi"
@ -390,7 +416,6 @@ optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
[package.dependencies] [package.dependencies]
importlib-metadata = {version = ">=3.6", markers = "python_version < \"3.10\""}
jeepney = {version = ">=0.4.2", markers = "sys_platform == \"linux\""} 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\""} 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\""} SecretStorage = {version = ">=3.2", markers = "sys_platform == \"linux\""}
@ -423,9 +448,6 @@ category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
[package.dependencies]
importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""}
[package.extras] [package.extras]
testing = ["coverage", "pyyaml"] testing = ["coverage", "pyyaml"]
@ -622,7 +644,7 @@ pastel = ">=0.2.1,<0.3.0"
tomli = ">=1.2.2" tomli = ">=1.2.2"
[package.extras] [package.extras]
poetry_plugin = ["poetry (>=1.0,<2.0)"] poetry-plugin = ["poetry (>=1.0,<2.0)"]
[[package]] [[package]]
name = "pprintpp" name = "pprintpp"
@ -713,18 +735,6 @@ python-versions = ">=3.6.8"
[package.extras] [package.extras]
diagrams = ["jinja2", "railroad-diagrams"] 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]] [[package]]
name = "pytest" name = "pytest"
version = "7.1.2" version = "7.1.2"
@ -878,7 +888,7 @@ urllib3 = ">=1.21.1,<1.27"
[package.extras] [package.extras]
socks = ["PySocks (>=1.5.6,!=1.5.7)"] 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]] [[package]]
name = "rich" name = "rich"
@ -1024,14 +1034,6 @@ python-versions = ">=3.7"
[package.extras] [package.extras]
test = ["pre-commit", "pytest"] 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]] [[package]]
name = "tzdata" name = "tzdata"
version = "2022.1" version = "2022.1"
@ -1117,7 +1119,7 @@ python-versions = ">=3.4"
name = "zipp" name = "zipp"
version = "3.8.1" version = "3.8.1"
description = "Backport of pathlib-compatible object wrapper for zip files" description = "Backport of pathlib-compatible object wrapper for zip files"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
@ -1127,8 +1129,8 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = ">=3.9.0, <3.12" python-versions = ">=3.10.0, <3.13"
content-hash = "c9bebe280520ae31feec25f734a8404eee0e0f3b3691e9e7e75af0c54a1b02db" content-hash = "e2a31438b3c6fbf90093531b3f877818d8dbf85e2c4f95e879888a3aa66a4ee3"
[metadata.files] [metadata.files]
ansiwrap = [ ansiwrap = [
@ -1297,6 +1299,10 @@ distlib = [
{file = "distlib-0.3.5-py2.py3-none-any.whl", hash = "sha256:b710088c59f06338ca514800ad795a132da19fda270e3ce4affc74abf955a26c"}, {file = "distlib-0.3.5-py2.py3-none-any.whl", hash = "sha256:b710088c59f06338ca514800ad795a132da19fda270e3ce4affc74abf955a26c"},
{file = "distlib-0.3.5.tar.gz", hash = "sha256:a7f75737c70be3b25e2bee06288cec4e4c221de18455b2dd037fe2a795cab2fe"}, {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 = [ execnet = [
{file = "execnet-1.9.0-py2.py3-none-any.whl", hash = "sha256:a295f7cc774947aac58dde7fdc85f4aa00c42adf5d8f5468fc630c1acf30a142"}, {file = "execnet-1.9.0-py2.py3-none-any.whl", hash = "sha256:a295f7cc774947aac58dde7fdc85f4aa00c42adf5d8f5468fc630c1acf30a142"},
{file = "execnet-1.9.0.tar.gz", hash = "sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5"}, {file = "execnet-1.9.0.tar.gz", hash = "sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5"},
@ -1313,6 +1319,10 @@ flake8 = [
{file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"}, {file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"},
{file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"}, {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 = [ ghp-import = [
{file = "ghp-import-2.1.0.tar.gz", hash = "sha256:9c535c4c61193c2df8871222567d7fd7e5014d835f97dc7b7439069e2413d343"}, {file = "ghp-import-2.1.0.tar.gz", hash = "sha256:9c535c4c61193c2df8871222567d7fd7e5014d835f97dc7b7439069e2413d343"},
{file = "ghp_import-2.1.0-py3-none-any.whl", hash = "sha256:8337dd7b50877f163d4c0289bc1f1c7f127550241988d568c1db512c4324a619"}, {file = "ghp_import-2.1.0-py3-none-any.whl", hash = "sha256:8337dd7b50877f163d4c0289bc1f1c7f127550241988d568c1db512c4324a619"},
@ -1516,10 +1526,6 @@ pyparsing = [
{file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"},
{file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"}, {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 = [ pytest = [
{file = "pytest-7.1.2-py3-none-any.whl", hash = "sha256:13d0e3ccfc2b6e26be000cb6568c832ba67ba32e719443bfe725814d3c42433c"}, {file = "pytest-7.1.2-py3-none-any.whl", hash = "sha256:13d0e3ccfc2b6e26be000cb6568c832ba67ba32e719443bfe725814d3c42433c"},
{file = "pytest-7.1.2.tar.gz", hash = "sha256:a06a0425453864a270bc45e71f783330a7428defb4230fb5e6a731fde06ecd45"}, {file = "pytest-7.1.2.tar.gz", hash = "sha256:a06a0425453864a270bc45e71f783330a7428defb4230fb5e6a731fde06ecd45"},
@ -1681,10 +1687,6 @@ traitlets = [
{file = "traitlets-5.3.0-py3-none-any.whl", hash = "sha256:65fa18961659635933100db8ca120ef6220555286949774b9cfc106f941d1c7a"}, {file = "traitlets-5.3.0-py3-none-any.whl", hash = "sha256:65fa18961659635933100db8ca120ef6220555286949774b9cfc106f941d1c7a"},
{file = "traitlets-5.3.0.tar.gz", hash = "sha256:0bb9f1f9f017aa8ec187d8b1b2a7a6626a2a1d877116baba52a129bfa124f8e2"}, {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 = [ tzdata = [
{file = "tzdata-2022.1-py2.py3-none-any.whl", hash = "sha256:238e70234214138ed7b4e8a0fab0e5e13872edab3be586ab8198c407620e2ab9"}, {file = "tzdata-2022.1-py2.py3-none-any.whl", hash = "sha256:238e70234214138ed7b4e8a0fab0e5e13872edab3be586ab8198c407620e2ab9"},
{file = "tzdata-2022.1.tar.gz", hash = "sha256:8b536a8ec63dc0751342b3984193a3118f8fca2afe25752bb9b7fffd398552d3"}, {file = "tzdata-2022.1.tar.gz", hash = "sha256:8b536a8ec63dc0751342b3984193a3118f8fca2afe25752bb9b7fffd398552d3"},

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "jrnl" name = "jrnl"
version = "v3.3-beta" version = "v3.3"
description = "Collect your thoughts and notes without leaving the command line." description = "Collect your thoughts and notes without leaving the command line."
authors = [ authors = [
"jrnl contributors <maintainers@jrnl.sh>", "jrnl contributors <maintainers@jrnl.sh>",
@ -27,7 +27,7 @@ classifiers = [
"Funding" = "https://opencollective.com/jrnl" "Funding" = "https://opencollective.com/jrnl"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = ">=3.9.0, <3.12" python = ">=3.10.0, <3.13"
ansiwrap = "^0.8.4" ansiwrap = "^0.8.4"
colorama = ">=0.4" # https://github.com/tartley/colorama/blob/master/CHANGELOG.rst colorama = ">=0.4" # https://github.com/tartley/colorama/blob/master/CHANGELOG.rst
@ -44,11 +44,11 @@ tzlocal = ">=4.0" # https://github.com/regebro/tzlocal/blob/master/CHANGES.txt
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
black = { version = ">=21.5b2", allow-prereleases = true } black = { version = ">=21.5b2", allow-prereleases = true }
flakeheaven = ">=3.0"
ipdb = "*" ipdb = "*"
isort = ">=5.10" isort = ">=5.10"
mkdocs = ">=1.0,<1.3" mkdocs = ">=1.0,<1.3"
poethepoet = "*" poethepoet = "*"
pyproject-flake8 = "*"
pytest = ">=6.2" pytest = ">=6.2"
pytest-bdd = ">=4.0.1,<6.0" pytest-bdd = ">=4.0.1,<6.0"
pytest-clarity = "*" pytest-clarity = "*"
@ -70,8 +70,9 @@ format-check = [
{cmd = "black --check --diff ."}, {cmd = "black --check --diff ."},
] ]
style-check = [ style-check = [
{cmd = "pflake8 --version"}, {cmd = "flakeheaven --version"},
{cmd = "pflake8 jrnl tests tasks.py"}, {cmd = "flakeheaven plugins"},
{cmd = "flakeheaven lint"},
] ]
sort-run = [ sort-run = [
{cmd = "isort ."}, {cmd = "isort ."},
@ -150,9 +151,25 @@ filterwarnings = [
"ignore:[WinError 5].*" "ignore:[WinError 5].*"
] ]
[tool.flake8] [tool.flakeheaven]
# ignore formatting warnings and errors because we use Black to autoformat max_line_length = 88
extend-ignore = "E101,E111,E114,E115,E116,E117,E12,E13,E2,E3,E401,E5,E70,W1,W2,W3,W5" 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] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.0.0"]

View file

@ -64,10 +64,10 @@ Feature: Multiple journals
Then the output should contain "sell my junk on ebay and make lots of money" 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 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" And we use the config "basic_onefile.yaml"
When we run "jrnl --cf bug343.yaml a long day in the office" When we run "jrnl --cf no_default_journal.yaml 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 using an alternate config Scenario: Don't crash if no file exists for a configured encrypted journal using an alternate config
Given the config "multiple.yaml" exists Given the config "multiple.yaml" exists

View file

@ -612,3 +612,20 @@ Feature: Custom formats
config_path: .+basic_onefile\.yaml config_path: .+basic_onefile\.yaml
journals: journals:
default: features/journals/basic_onefile\.journal 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

View file

@ -80,9 +80,9 @@ Feature: Multiple journals
2012-07-23 09:00 sell my junk on ebay and make lots of money 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 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" 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 Scenario: Don't crash if no file exists for a configured encrypted journal
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"