diff --git a/src/sphinxnotes/snippet/cache.py b/src/sphinxnotes/snippet/cache.py index 5c5c4e3..c4acf0b 100644 --- a/src/sphinxnotes/snippet/cache.py +++ b/src/sphinxnotes/snippet/cache.py @@ -9,7 +9,7 @@ from typing import List, Tuple, Dict, Optional from dataclasses import dataclass -from . import Snippet +from .snippets import Snippet from .utils.pdict import PDict diff --git a/src/sphinxnotes/snippet/cli.py b/src/sphinxnotes/snippet/cli.py index 9e3d81f..99a69d2 100644 --- a/src/sphinxnotes/snippet/cli.py +++ b/src/sphinxnotes/snippet/cli.py @@ -14,11 +14,12 @@ from textwrap import dedent from shutil import get_terminal_size import posixpath +from importlib.metadata import version from xdg.BaseDirectory import xdg_config_home from sphinx.util.matching import patmatch -from . import __version__, Document +from .snippets import Document from .config import Config from .cache import Cache, IndexID, Index from .table import tablify, COLUMNS @@ -61,7 +62,10 @@ def main(argv: List[str] = sys.argv[1:]): * (any) wildcard for any snippet"""), ) parser.add_argument( - '-v', '--version', action='version', version='%(prog)s ' + __version__ + '-v', + '--version', + action='version', + version='%(prog)s ' + version('sphinxnotes.any'), ) parser.add_argument( '-c', '--config', default=DEFAULT_CONFIG_FILE, help='path to configuration file' diff --git a/src/sphinxnotes/snippet/ext.py b/src/sphinxnotes/snippet/ext.py index 95cd9ea..9dece86 100644 --- a/src/sphinxnotes/snippet/ext.py +++ b/src/sphinxnotes/snippet/ext.py @@ -26,7 +26,7 @@ from collections.abc import Iterator from .config import Config -from . import Snippet, WithTitle, Document, Section +from .snippets import Snippet, WithTitle, Document, Section from .picker import pick from .cache import Cache, Item from .keyword import Extractor diff --git a/src/sphinxnotes/snippet/picker.py b/src/sphinxnotes/snippet/picker.py index d7e7383..f29cb71 100644 --- a/src/sphinxnotes/snippet/picker.py +++ b/src/sphinxnotes/snippet/picker.py @@ -15,7 +15,7 @@ from sphinx.util import logging -from . import Snippet, Section, Document +from .snippets import Snippet, Section, Document if TYPE_CHECKING: from sphinx.application import Sphinx diff --git a/src/sphinxnotes/snippet/__init__.py b/src/sphinxnotes/snippet/snippets.py similarity index 94% rename from src/sphinxnotes/snippet/__init__.py rename to src/sphinxnotes/snippet/snippets.py index 0a6c945..988f076 100644 --- a/src/sphinxnotes/snippet/__init__.py +++ b/src/sphinxnotes/snippet/snippets.py @@ -1,8 +1,10 @@ """ -sphinxnotes.snippet -~~~~~~~~~~~~~~~~~~~ +sphinxnotes.snippet.snippets +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -:copyright: Copyright 2020 Shengyu Zhang +Definitions of various snippets. + +:copyright: Copyright 2024 Shengyu Zhang :license: BSD, see LICENSE for details. """ @@ -16,14 +18,13 @@ if TYPE_CHECKING: from sphinx.environment import BuildEnvironment -__version__ = '1.1.1' - class Snippet(object): """ - Snippet is base class of reStructuredText snippet. + Snippet is structured fragments extracted from a single Sphinx document + (can also be said to be a reStructuredText file). - :param nodes: Document nodes that make up this snippet + :param nodes: nodes of doctree that make up this snippet. """ #: docname where the snippet is located, can be referenced by