cihai-cli 0.23.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.23.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
@@ -18,17 +18,14 @@ Classifier: Programming Language :: Python :: 3.8
18
18
  Classifier: Programming Language :: Python :: 3.9
19
19
  Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
21
22
  Classifier: Programming Language :: Python :: Implementation :: PyPy
22
23
  Classifier: Topic :: Software Development :: Internationalization
23
24
  Classifier: Topic :: Software Development :: Localization
24
25
  Classifier: Topic :: System :: Shells
25
26
  Classifier: Topic :: Utilities
26
- Provides-Extra: coverage
27
- Provides-Extra: docs
28
- Provides-Extra: lint
29
- Provides-Extra: test
30
27
  Requires-Dist: PyYAML
31
- Requires-Dist: cihai (>=0.28.0,<0.29.0)
28
+ Requires-Dist: cihai (>=0.30.0,<0.31.0)
32
29
  Project-URL: Bug Tracker, https://github.com/cihai/cihai-cli/issues
33
30
  Project-URL: Documentation, https://cihai-cli.git-pull.com
34
31
  Project-URL: Q & A, https://github.com/cihai/cihai-cli/discussions
@@ -160,7 +157,7 @@ $ git clone https://github.com/cihai/cihai-cli.git
160
157
  $ cd cihai-cli
161
158
  ```
162
159
 
163
- [Bootstrap your environment and learn more about contributing](https://cihai.git-pull.com/contributing/). We use the same conventions / tools across all cihai projects: `pytest`, `sphinx`, `flake8`, `mypy`, `black`, `isort`, `tmuxp`, and file watcher helpers (e.g. `entr(1)`).
160
+ [Bootstrap your environment and learn more about contributing](https://cihai.git-pull.com/contributing/). We use the same conventions / tools across all cihai projects: `pytest`, `sphinx`, `mypy`, `ruff`, `tmuxp`, and file watcher helpers (e.g. `entr(1)`).
164
161
 
165
162
  ## Python versions
166
163
 
@@ -122,7 +122,7 @@ $ git clone https://github.com/cihai/cihai-cli.git
122
122
  $ cd cihai-cli
123
123
  ```
124
124
 
125
- [Bootstrap your environment and learn more about contributing](https://cihai.git-pull.com/contributing/). We use the same conventions / tools across all cihai projects: `pytest`, `sphinx`, `flake8`, `mypy`, `black`, `isort`, `tmuxp`, and file watcher helpers (e.g. `entr(1)`).
125
+ [Bootstrap your environment and learn more about contributing](https://cihai.git-pull.com/contributing/). We use the same conventions / tools across all cihai projects: `pytest`, `sphinx`, `mypy`, `ruff`, `tmuxp`, and file watcher helpers (e.g. `entr(1)`).
126
126
 
127
127
  ## Python versions
128
128
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cihai-cli"
3
- version = "0.23.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>"]
@@ -15,6 +15,7 @@ classifiers = [
15
15
  "Programming Language :: Python :: 3.9",
16
16
  "Programming Language :: Python :: 3.10",
17
17
  "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
18
19
  "Programming Language :: Python :: Implementation :: PyPy",
19
20
  "Topic :: Software Development :: Internationalization",
20
21
  "Topic :: Software Development :: Localization",
@@ -57,67 +58,49 @@ Repository = "https://github.com/cihai/cihai-cli"
57
58
 
58
59
  [tool.poetry.dependencies]
59
60
  python = "^3.8"
60
- cihai = "~0.28.0"
61
+ cihai = "~0.30.0"
61
62
  PyYAML = "*"
62
63
 
63
- [tool.poetry.group.dev.dependencies]
64
+ [tool.poetry.group.docs.dependencies]
64
65
  ### Docs ###
65
66
  sphinx = "*"
66
- gp-libs = "*"
67
67
  furo = "*"
68
+ gp-libs = "*"
68
69
  sphinx-autobuild = "*"
69
70
  sphinx-autodoc-typehints = "*"
70
71
  sphinx-argparse = "*"
71
72
  sphinx-inline-tabs = "*"
72
- sphinxext-opengraph = "<0.8" # https://github.com/wpilibsuite/sphinxext-opengraph/issues/100
73
+ sphinxext-opengraph = "<0.8" # https://github.com/wpilibsuite/sphinxext-opengraph/issues/100
73
74
  sphinx-copybutton = "*"
74
75
  sphinxext-rediraffe = "*"
75
76
  myst_parser = ">=0.18.1"
76
77
  docutils = "*"
77
78
 
79
+ [tool.poetry.group.test.dependencies]
78
80
  ### Testing ###
79
81
  pytest = "*"
80
82
  pytest-rerunfailures = "*"
81
83
  pytest-watcher = "*"
84
+ gp-libs = "*"
82
85
 
86
+ [tool.poetry.group.coverage.dependencies]
83
87
  ### Coverage ###
84
88
  codecov = "*"
85
89
  coverage = "*"
86
90
  pytest-cov = "*"
87
91
 
92
+ [tool.poetry.group.lint.dependencies]
88
93
  ### Lint ###
89
- black = "*"
90
94
  ruff = "*"
91
95
  mypy = "*"
96
+
97
+ [tool.poetry.group.typings.dependencies]
98
+ ### Typings ###
92
99
  types-PyYAML = "*"
93
100
 
94
101
  [tool.poetry.scripts]
95
102
  cihai = "cihai_cli.cli:cli"
96
103
 
97
- [tool.poetry.extras]
98
- docs = [
99
- "docutils",
100
- "sphinx",
101
- "sphinx-argparse",
102
- "sphinx-autodoc-typehints",
103
- "sphinx-autobuild",
104
- "sphinx-copybutton",
105
- "sphinxext-opengraph",
106
- "sphinx-inline-tabs",
107
- "sphinxext-rediraffe",
108
- "myst_parser",
109
- "furo",
110
- "gp-libs",
111
- ]
112
- test = ["pytest", "pytest-rerunfailures", "pytest-watcher"]
113
- coverage = ["codecov", "coverage", "pytest-cov"]
114
- lint = [
115
- "black",
116
- "ruff",
117
- "mypy",
118
- "types-PyYAML",
119
- ]
120
-
121
104
  [tool.mypy]
122
105
  files = [
123
106
  "src/",
@@ -137,25 +120,40 @@ select = [
137
120
  "E", # pycodestyle
138
121
  "F", # pyflakes
139
122
  "I", # isort
140
- "UP", # pyupgrade
123
+ "UP", # pyupgrade
141
124
  "B", # flake8-bugbear
142
125
  "C4", # flake8-comprehensions
143
126
  "Q", # flake8-quotes
144
127
  "PTH", # flake8-use-pathlib
145
- "ERA", # eradicate
146
- "SIM", # flake8-simplify
128
+ "SIM", # flake8-simplify
147
129
  "TRY", # Trycertatops
148
130
  "PERF", # Perflint
149
- "RUF" # Ruff-specific rules
131
+ "RUF", # Ruff-specific rules
132
+ "D", # pydocstyle
150
133
  ]
151
134
 
152
135
  [tool.ruff.isort]
153
136
  known-first-party = ["unihan_etl", "cihai"]
154
137
  combine-as-imports = true
155
138
 
139
+ [tool.ruff.pydocstyle]
140
+ convention = "numpy"
141
+
156
142
  [tool.ruff.per-file-ignores]
157
143
  "*/__init__.py" = ["F401"]
158
144
 
145
+ [tool.pytest.ini_options]
146
+ addopts = "--reruns=0 --tb=short --no-header --showlocals --doctest-modules"
147
+ doctest_optionflags = "ELLIPSIS NORMALIZE_WHITESPACE"
148
+ testpaths = [
149
+ "src/cihai_cli",
150
+ "tests",
151
+ "docs",
152
+ ]
153
+ filterwarnings = [
154
+ "ignore:The frontend.Option(Parser)? class.*:DeprecationWarning::",
155
+ ]
156
+
159
157
  [build-system]
160
158
  requires = ["poetry_core>=1.0.0"]
161
159
  build-backend = "poetry.core.masonry.api"
@@ -1,6 +1,7 @@
1
+ """Metadata for cihai_cli package."""
1
2
  __title__ = "cihai-cli"
2
3
  __package_name__ = "cihai_cli"
3
- __version__ = "0.23.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,25 +17,22 @@ 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):
22
24
  cli()
23
25
 
24
-
25
26
  with contextlib.suppress(SystemExit):
26
27
  cli(["-c", str(test_config_file)])
27
28
 
28
-
29
29
  with contextlib.suppress(SystemExit):
30
30
  cli(["info"])
31
31
 
32
-
33
32
  with contextlib.suppress(SystemExit):
34
33
  cli(["reverse"])
35
34
 
36
35
 
37
-
38
36
  def test_cli_reflects_after_bootstrap(
39
37
  tmp_path: pathlib.Path,
40
38
  capsys: pytest.CaptureFixture[str],
@@ -42,6 +40,7 @@ def test_cli_reflects_after_bootstrap(
42
40
  tmpdb_file: pathlib.Path,
43
41
  unihan_options: "UnihanOptions",
44
42
  ) -> None:
43
+ """High-level, integrative CLI-based test."""
45
44
  config = {
46
45
  "database": {"url": f"sqlite:///{tmpdb_file}s"},
47
46
  "unihan_options": {
@@ -77,6 +76,7 @@ def test_cli_version(
77
76
  monkeypatch: pytest.MonkeyPatch,
78
77
  flag: str,
79
78
  ) -> None:
79
+ """Returns cihai-cli version."""
80
80
  try:
81
81
  cli([flag])
82
82
  except SystemExit:
File without changes
File without changes
File without changes