jrnl.__version__ magic works! (#1296)

* `jrnl.__version__` magic works!

Adjust version imports
Update version on GitHub release flow
Fix version imports & black issue

* escape strings in workflow

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
This commit is contained in:
MinchinWeb 2021-07-17 14:19:48 -06:00 committed by Jonathan Wren
parent 6b1d6ccd56
commit 79c37401c4
19 changed files with 37 additions and 30 deletions

View file

@ -80,7 +80,17 @@ jobs:
if: ${{ github.event.inputs.include_repo_version == 'true' }}
run: |
poetry version "$JRNL_VERSION"
echo __version__ = \"$JRNL_VERSION\" > jrnl/__version__.py
{
echo "# This file is managed automatically by the GitHub release flow"
echo
echo "import sys"
echo
echo "__version__ = \"$JRNL_VERSION\""
echo
echo '# this makes the version available at `jrnl.__version__` without requiring a'
echo '# `__init__.py` file in the *jrnl* root directory!'
echo 'sys.modules["jrnl.__version__"] = __version__'
} > jrnl/__version__.py
- name: Commit updated files
if: ${{ github.event.inputs.include_repo_version == 'true' && github.repository == env.HOME_REPO }}

View file

@ -18,7 +18,7 @@ import yaml
from yaml.loader import SafeLoader
from jrnl import Journal
from jrnl.__version__ import __version__
from jrnl import __version__
from jrnl import plugins
from jrnl.args import parse_args
from jrnl.behave_testing import _mock_getpass

View file

@ -15,7 +15,7 @@ import tzlocal
from . import Entry
from . import Journal
from jrnl.__version__ import __version__
from . import __version__
class DayOne(Journal.Journal):

View file

@ -1 +1,9 @@
# This file is managed automatically by the GitHub release flow
import sys
__version__ = "v2.8.1"
# this makes the version available at `jrnl.__version__` without requiring a
# `__init__.py` file in the *jrnl* root directory
sys.modules["jrnl.__version__"] = __version__

View file

@ -4,9 +4,9 @@
import logging
import sys
from .jrnl import run
from .args import parse_args
from .exception import JrnlError
from .jrnl import run
def configure_logger(debug=False):

View file

@ -16,7 +16,7 @@ import sys
def preconfig_diagnostic(_):
from jrnl.__version__ import __version__
from jrnl import __version__
print(
f"jrnl: {__version__}\n"
@ -26,7 +26,7 @@ def preconfig_diagnostic(_):
def preconfig_version(_):
from jrnl.__version__ import __version__
from jrnl import __version__
from jrnl.plugins.collector import (
IMPORT_FORMATS,
EXPORT_FORMATS,

View file

@ -6,7 +6,7 @@ import colorama
import yaml
import xdg.BaseDirectory
from jrnl.__version__ import __version__
from . import __version__
from .exception import JrnlError
from .color import ERROR_COLOR
from .color import RESET_COLOR

View file

@ -4,10 +4,9 @@
from collections import Counter
from jrnl import __version__
from jrnl.plugins.base import BaseExporter
from jrnl.__version__ import __version__
class Exporter(BaseExporter):
"""This Exporter lists dates and their respective counts, for heatingmapping etc."""

View file

@ -5,11 +5,10 @@
from textwrap import TextWrapper
from jrnl import __version__
from jrnl.plugins.base import BaseExporter
from jrnl.plugins.util import check_provided_linewrap_viability
from jrnl.__version__ import __version__
class Exporter(BaseExporter):
"""This Exporter can convert entries and journals into text with unicode box drawing characters."""

View file

@ -4,11 +4,10 @@
import json
from jrnl import __version__
from jrnl.plugins.base import BaseExporter
from jrnl.plugins.util import get_tags_count
from jrnl.__version__ import __version__
class Exporter(BaseExporter):
"""This Exporter can convert entries and journals into json."""

View file

@ -6,12 +6,11 @@ import os
import re
import sys
from jrnl import __version__
from jrnl.color import RESET_COLOR
from jrnl.color import WARNING_COLOR
from jrnl.plugins.base import BaseExporter
from jrnl.__version__ import __version__
class Exporter(BaseExporter):
"""This Exporter can convert entries and journals into Markdown."""

View file

@ -3,10 +3,9 @@
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from jrnl import __version__
from jrnl.plugins.base import BaseExporter
from jrnl.__version__ import __version__
class Exporter(BaseExporter):
"""Pretty print journal"""

View file

@ -3,10 +3,9 @@
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from jrnl import __version__
from jrnl.plugins.base import BaseExporter
from jrnl.__version__ import __version__
class Exporter(BaseExporter):
"""Short export -- i.e. single line date and title"""

View file

@ -3,11 +3,10 @@
# License: https://www.gnu.org/licenses/gpl-3.0.html
from jrnl import __version__
from jrnl.plugins.base import BaseExporter
from jrnl.plugins.util import get_tags_count
from jrnl.__version__ import __version__
class Exporter(BaseExporter):
"""This Exporter can lists the tags for entries and journals, exported as a plain text file."""

View file

@ -3,10 +3,9 @@
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from jrnl import __version__
from jrnl.plugins.base import BaseExporter
from jrnl.__version__ import __version__
class Exporter(BaseExporter):
"""This Exporter can convert entries and journals into text files."""

View file

@ -4,11 +4,10 @@
from xml.dom import minidom
from jrnl import __version__
from jrnl.plugins.base import BaseExporter
from jrnl.plugins.util import get_tags_count
from jrnl.__version__ import __version__
class Exporter(BaseExporter):
"""This Exporter can convert entries and journals into XML."""

View file

@ -6,13 +6,12 @@ import os
import re
import sys
from jrnl import __version__
from jrnl.color import ERROR_COLOR
from jrnl.color import RESET_COLOR
from jrnl.color import WARNING_COLOR
from jrnl.plugins.base import BaseExporter
from jrnl.__version__ import __version__
class Exporter(BaseExporter):
"""This Exporter can convert entries and journals into Markdown formatted text with YAML front matter."""

View file

@ -4,10 +4,9 @@
import sys
from jrnl import __version__
from jrnl.plugins.base import BaseImporter
from jrnl.__version__ import __version__
class Importer(BaseImporter):
"""This plugin imports entries from other jrnl files."""

View file

@ -5,7 +5,7 @@ import os
import sys
from . import Journal
from jrnl.__version__ import __version__
from . import __version__
from .EncryptedJournal import EncryptedJournal
from .config import is_config_json
from .config import load_config