Skip to content

Commit

Permalink
jrnl.__version__ magic works! (#1296)
Browse files Browse the repository at this point in the history
* `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>
  • Loading branch information
MinchinWeb and wren committed Jul 17, 2021
1 parent 183795d commit 29235a9
Show file tree
Hide file tree
Showing 19 changed files with 37 additions and 30 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/release.yaml
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion features/steps/core.py
Expand Up @@ -18,7 +18,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion jrnl/DayOneJournal.py
Expand Up @@ -15,7 +15,7 @@

from . import Entry
from . import Journal
from jrnl.__version__ import __version__
from . import __version__


class DayOne(Journal.Journal):
Expand Down
8 changes: 8 additions & 0 deletions jrnl/__version__.py
@@ -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__
2 changes: 1 addition & 1 deletion jrnl/cli.py
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions jrnl/commands.py
Expand Up @@ -16,7 +16,7 @@


def preconfig_diagnostic(_):
from jrnl.__version__ import __version__
from jrnl import __version__

print(
f"jrnl: {__version__}\n"
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion jrnl/config.py
Expand Up @@ -6,7 +6,7 @@
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
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/exporter/dates.py
Expand Up @@ -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."""
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/exporter/fancy.py
Expand Up @@ -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."""
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/exporter/json.py
Expand Up @@ -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."""
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/exporter/markdown.py
Expand Up @@ -6,12 +6,11 @@
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."""
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/exporter/pretty.py
Expand Up @@ -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"""
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/exporter/short.py
Expand Up @@ -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"""
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/exporter/tag.py
Expand Up @@ -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."""
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/exporter/text.py
Expand Up @@ -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."""
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/exporter/xml.py
Expand Up @@ -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."""
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/exporter/yaml.py
Expand Up @@ -6,13 +6,12 @@
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."""
Expand Down
3 changes: 1 addition & 2 deletions jrnl/plugins/importer/jrnl.py
Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion jrnl/upgrade.py
Expand Up @@ -5,7 +5,7 @@
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
Expand Down

0 comments on commit 29235a9

Please sign in to comment.