Skip to content

Commit

Permalink
✨ move spec to ozi-spec package
Browse files Browse the repository at this point in the history
Signed-off-by: rjdbcm <[email protected]>
  • Loading branch information
rjdbcm committed Jul 2, 2024
1 parent 004cba1 commit 80c6709
Show file tree
Hide file tree
Showing 28 changed files with 38 additions and 1,214 deletions.
21 changes: 20 additions & 1 deletion ozi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,26 @@
The ozi_templates module was moved out of blastpipe.
"""
from .spec import current_version
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version

from setuptools_scm import get_version # type: ignore


def current_version() -> str:
"""Returns the currently installed version of OZI.
.. versionchanged:: 1.14
Previously was part of the ozi.spec submodule.
"""
try:
version_ = version('OZI')
except PackageNotFoundError: # pragma: no cover
version_ = str(get_version(root='..', relative_to=__file__))
return version_


__version__ = current_version()
__author__ = 'Eden Ross Duff MSc'
Expand Down
2 changes: 1 addition & 1 deletion ozi/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from spdx_license_list import LICENSES

from ozi.spdx import spdx_license_expression
from ozi.spec import METADATA
from ozi_spec import METADATA
from ozi.tap import TAP
from ozi.trove import Prefix
from ozi.trove import from_prefix
Expand Down
6 changes: 3 additions & 3 deletions ozi/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from typing import Generator
from typing import Sequence

from ozi.spec import METADATA
from ozi_spec import METADATA
from ozi.tap import TAP

if TYPE_CHECKING:
Expand Down Expand Up @@ -92,7 +92,7 @@ def calculate_score(lines: int, t1: int, t2: int, t3: int) -> float: # pragma:
def pattern_cache(key: str) -> re.Pattern[str]: # pragma: no cover
"""Cached OZI specification linter comment pattern lookup.
:param key: key in :py:class:`ozi.spec.CommentPatterns`
:param key: key in :py:class:`ozi_spec.CommentPatterns`
:type key: str
:return: compiled regular expression pattern
:rtype: re.Pattern[str]
Expand All @@ -109,7 +109,7 @@ def pattern_search(
:param line: line text verbatim
:type line: str
:yield: key, match for key in :py:class:`ozi.spec.CommentPatterns` excluding ``help``
:yield: key, match for key in :py:class:`ozi_spec.CommentPatterns` excluding ``help``
:rtype: Generator[tuple[str, str], None, None]
"""
for key in METADATA.spec.python.src.comments.asdict().keys():
Expand Down
2 changes: 1 addition & 1 deletion ozi/fix/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from ozi.fix.missing import report
from ozi.fix.parser import parser
from ozi.fix.rewrite_command import Rewriter
from ozi.spec import METADATA
from ozi_spec import METADATA
from ozi.tap import TAP


Expand Down
2 changes: 1 addition & 1 deletion ozi/fix/build_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ozi import comment
from ozi.meson import get_items_by_suffix
from ozi.meson import query_build_value
from ozi.spec import METADATA
from ozi_spec import METADATA
from ozi.tap import TAP

IGNORE_MISSING = {
Expand Down
2 changes: 1 addition & 1 deletion ozi/fix/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from ozi.meson import load_ast
from ozi.meson import project_metadata
from ozi.pkg_extra import parse_extra_pkg_info
from ozi.spec import METADATA
from ozi_spec import METADATA
from ozi.tap import TAP

if sys.version_info >= (3, 11): # pragma: no cover
Expand Down
2 changes: 1 addition & 1 deletion ozi/fix/rewrite_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ozi.render import build_child
from ozi.render import build_file
from ozi.render import find_user_template
from ozi.spec import METADATA
from ozi_spec import METADATA

if TYPE_CHECKING:
import sys
Expand Down
1 change: 0 additions & 1 deletion ozi/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ source_children = [
'lint',
'new',
'scripts',
'spec',
'test',
'vendor',
]
Expand Down
2 changes: 1 addition & 1 deletion ozi/new/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from ozi.new.validate import valid_summary
from ozi.render import render_ci_files_set_user
from ozi.render import render_project_files
from ozi.spec import METADATA
from ozi_spec import METADATA
from ozi.tap import TAP

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion ozi/new/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from prompt_toolkit.widgets import Label
from prompt_toolkit.widgets import RadioList

from ozi.spec import METADATA
from ozi_spec import METADATA
from ozi.tap import TAP
from ozi.trove import Prefix
from ozi.trove import from_prefix
Expand Down
2 changes: 1 addition & 1 deletion ozi/new/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import sys

from ozi.actions import CloseMatch
from ozi.spec import METADATA
from ozi_spec import METADATA

parser = argparse.ArgumentParser(
prog='ozi-new',
Expand Down
2 changes: 1 addition & 1 deletion ozi/new/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from trove_classifiers import classifiers

from ozi.spdx import spdx_license_expression
from ozi.spec import METADATA
from ozi_spec import METADATA
from ozi.tap import TAP
from ozi.vendor.email_validator import EmailNotValidError
from ozi.vendor.email_validator import EmailSyntaxError
Expand Down
2 changes: 1 addition & 1 deletion ozi/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from git import Repo
from ozi_templates.filter import underscorify # type: ignore

from ozi.spec import METADATA
from ozi_spec import METADATA
from ozi.tap import TAP

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion ozi/spdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pyparsing import oneOf
from spdx_license_list import LICENSES

from ozi.spec import METADATA
from ozi_spec import METADATA

spdx_license_expression = Forward()
spdx_license_expression <<= oneOf(
Expand Down
23 changes: 0 additions & 23 deletions ozi/spec/__init__.py

This file was deleted.

Loading

0 comments on commit 80c6709

Please sign in to comment.