cihai-cli 0.24.0__tar.gz → 0.25.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cihai-cli
3
- Version: 0.24.0
3
+ Version: 0.25.0
4
4
  Summary: Command line frontend for the cihai CJK language library
5
5
  Home-page: https://cihai-cli.git-pull.com
6
6
  License: MIT
@@ -25,7 +25,7 @@ Classifier: Topic :: Software Development :: Localization
25
25
  Classifier: Topic :: System :: Shells
26
26
  Classifier: Topic :: Utilities
27
27
  Requires-Dist: PyYAML
28
- Requires-Dist: cihai (>=0.29.0,<0.30.0)
28
+ Requires-Dist: cihai (>=0.30.0,<0.31.0)
29
29
  Project-URL: Bug Tracker, https://github.com/cihai/cihai-cli/issues
30
30
  Project-URL: Documentation, https://cihai-cli.git-pull.com
31
31
  Project-URL: Q & A, https://github.com/cihai/cihai-cli/discussions
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cihai-cli"
3
- version = "0.24.0"
3
+ version = "0.25.0"
4
4
  description = "Command line frontend for the cihai CJK language library"
5
5
  license = "MIT"
6
6
  authors = ["Tony Narlock <tony@git-pull.com>"]
@@ -58,14 +58,14 @@ Repository = "https://github.com/cihai/cihai-cli"
58
58
 
59
59
  [tool.poetry.dependencies]
60
60
  python = "^3.8"
61
- cihai = "~0.29.0"
61
+ cihai = "~0.30.0"
62
62
  PyYAML = "*"
63
63
 
64
64
  [tool.poetry.group.docs.dependencies]
65
65
  ### Docs ###
66
66
  sphinx = "*"
67
- gp-libs = "*"
68
67
  furo = "*"
68
+ gp-libs = "*"
69
69
  sphinx-autobuild = "*"
70
70
  sphinx-autodoc-typehints = "*"
71
71
  sphinx-argparse = "*"
@@ -81,6 +81,7 @@ docutils = "*"
81
81
  pytest = "*"
82
82
  pytest-rerunfailures = "*"
83
83
  pytest-watcher = "*"
84
+ gp-libs = "*"
84
85
 
85
86
  [tool.poetry.group.coverage.dependencies]
86
87
  ### Coverage ###
@@ -128,12 +129,16 @@ select = [
128
129
  "TRY", # Trycertatops
129
130
  "PERF", # Perflint
130
131
  "RUF", # Ruff-specific rules
132
+ "D", # pydocstyle
131
133
  ]
132
134
 
133
135
  [tool.ruff.isort]
134
136
  known-first-party = ["unihan_etl", "cihai"]
135
137
  combine-as-imports = true
136
138
 
139
+ [tool.ruff.pydocstyle]
140
+ convention = "numpy"
141
+
137
142
  [tool.ruff.per-file-ignores]
138
143
  "*/__init__.py" = ["F401"]
139
144
 
@@ -1,6 +1,7 @@
1
+ """Metadata for cihai_cli package."""
1
2
  __title__ = "cihai-cli"
2
3
  __package_name__ = "cihai_cli"
3
- __version__ = "0.24.0"
4
+ __version__ = "0.25.0"
4
5
  __description__ = "Command line frontend for the cihai CJK language library"
5
6
  __author__ = "Tony Narlock"
6
7
  __email__ = "tony@git-pull.com"
@@ -0,0 +1 @@
1
+ """Package for Cihai's CLI frontend."""
@@ -1,3 +1,4 @@
1
+ """CLI functionality for cihai-cli."""
1
2
  import argparse
2
3
  import logging
3
4
  import sys
@@ -30,6 +31,7 @@ INFO_SHORT_HELP = 'Get details on a CJK character, e.g. "好"'
30
31
 
31
32
 
32
33
  def create_parser() -> argparse.ArgumentParser:
34
+ """Create argparse for cihai-cli."""
33
35
  parser = argparse.ArgumentParser(prog="cihai")
34
36
  parser.add_argument(
35
37
  "--version",
@@ -65,6 +67,8 @@ def create_parser() -> argparse.ArgumentParser:
65
67
 
66
68
 
67
69
  class CLILoadNamespace(argparse.Namespace):
70
+ """Typing for CLI namespace."""
71
+
68
72
  config_file: t.Optional[str]
69
73
  version: bool
70
74
  log_file: t.Optional[str]
@@ -75,8 +79,8 @@ def cli(_args: t.Optional[t.List[str]] = None) -> None:
75
79
 
76
80
  For help and example usage, see documentation:
77
81
 
78
- https://cihai-cli.git-pull.com and https://cihai.git-pull.com"""
79
-
82
+ https://cihai-cli.git-pull.com and https://cihai.git-pull.com
83
+ """
80
84
  parser = create_parser()
81
85
  args = parser.parse_args(_args, namespace=CLILoadNamespace())
82
86
 
@@ -100,6 +104,7 @@ def cli(_args: t.Optional[t.List[str]] = None) -> None:
100
104
 
101
105
 
102
106
  def create_info_subparser(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
107
+ """Create ``cihai info`` subparser."""
103
108
  parser.add_argument("char", metavar="<character>", help="Lookup term / character")
104
109
  parser.add_argument(
105
110
  "--all",
@@ -132,6 +137,7 @@ def command_info(c: Cihai, char: str, show_all: bool) -> None:
132
137
  def create_reverse_subparser(
133
138
  parser: argparse.ArgumentParser,
134
139
  ) -> argparse.ArgumentParser:
140
+ """Create ``cihai reverse`` subparser."""
135
141
  parser.add_argument("char", metavar="<character>", help="Lookup term / character")
136
142
  parser.add_argument(
137
143
  "--all",
@@ -168,7 +174,7 @@ def command_reverse(c: Cihai, char: str, show_all: bool) -> None:
168
174
  def setup_logger(
169
175
  logger: t.Optional[logging.Logger] = None, level: str = "INFO"
170
176
  ) -> None:
171
- """Setup logging for CLI use.
177
+ """Configure logging for CLI use.
172
178
 
173
179
  :param logger: instance of logger
174
180
  :type logger: :py:class:`Logger`
@@ -0,0 +1 @@
1
+ """Test package for cihai-cli."""
@@ -1,3 +1,4 @@
1
+ """Pytest configuration."""
1
2
  import pathlib
2
3
  import typing as t
3
4
  import zipfile
@@ -12,26 +13,31 @@ if t.TYPE_CHECKING:
12
13
 
13
14
  @pytest.fixture
14
15
  def tests_path() -> pathlib.Path:
16
+ """Return tests/ directory."""
15
17
  return pathlib.Path(__file__).parent
16
18
 
17
19
 
18
20
  @pytest.fixture
19
21
  def fixture_path(tests_path: pathlib.Path) -> pathlib.Path:
22
+ """Return tests/fixtures/ directory."""
20
23
  return tests_path / "fixtures"
21
24
 
22
25
 
23
26
  @pytest.fixture
24
27
  def test_config_file(fixture_path: pathlib.Path) -> pathlib.Path:
28
+ """Return test_config.yml file."""
25
29
  return fixture_path / "test_config.yml"
26
30
 
27
31
 
28
32
  @pytest.fixture
29
33
  def zip_path(tmp_path: pathlib.Path) -> pathlib.Path:
34
+ """Return Unihan.zip in temporary path."""
30
35
  return tmp_path / "Unihan.zip"
31
36
 
32
37
 
33
38
  @pytest.fixture
34
39
  def zip_file(zip_path: pathlib.Path, fixture_path: pathlib.Path) -> zipfile.ZipFile:
40
+ """Create and return ZipFile."""
35
41
  _files = []
36
42
  for f in UNIHAN_FILES:
37
43
  _files += [fixture_path / f]
@@ -46,6 +52,7 @@ def zip_file(zip_path: pathlib.Path, fixture_path: pathlib.Path) -> zipfile.ZipF
46
52
  def unihan_options(
47
53
  zip_file: zipfile.ZipFile, zip_path: pathlib.Path, tmp_path: pathlib.Path
48
54
  ) -> "UnihanOptions":
55
+ """Return UnihanOptions for fixture."""
49
56
  return {
50
57
  "source": zip_path,
51
58
  "work_dir": tmp_path,
@@ -55,4 +62,5 @@ def unihan_options(
55
62
 
56
63
  @pytest.fixture(scope="function")
57
64
  def tmpdb_file(tmpdir: pathlib.Path) -> pathlib.Path:
65
+ """Return test SQLite database."""
58
66
  return tmpdir / "test.db"
@@ -1,3 +1,4 @@
1
+ """CLI tests for cihai-cli."""
1
2
  import contextlib
2
3
  import pathlib
3
4
  import typing as t
@@ -16,6 +17,7 @@ def test_cli(
16
17
  capsys: pytest.CaptureFixture[str],
17
18
  monkeypatch: pytest.MonkeyPatch,
18
19
  ) -> None:
20
+ """Test basic cihai usage."""
19
21
  monkeypatch.chdir(tmp_path)
20
22
 
21
23
  with contextlib.suppress(SystemExit):
@@ -38,6 +40,7 @@ def test_cli_reflects_after_bootstrap(
38
40
  tmpdb_file: pathlib.Path,
39
41
  unihan_options: "UnihanOptions",
40
42
  ) -> None:
43
+ """High-level, integrative CLI-based test."""
41
44
  config = {
42
45
  "database": {"url": f"sqlite:///{tmpdb_file}s"},
43
46
  "unihan_options": {
@@ -73,6 +76,7 @@ def test_cli_version(
73
76
  monkeypatch: pytest.MonkeyPatch,
74
77
  flag: str,
75
78
  ) -> None:
79
+ """Returns cihai-cli version."""
76
80
  try:
77
81
  cli([flag])
78
82
  except SystemExit:
File without changes
File without changes
File without changes
File without changes