nihonshufyi 0.1.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.
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ dist/
5
+ *.egg-info/
6
+ .mypy_cache/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .venv/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FYIPedia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.4
2
+ Name: nihonshufyi
3
+ Version: 0.1.0
4
+ Summary: Sake knowledge API client — search sake grades, breweries, and terms from NihonshuFYI.
5
+ Project-URL: Homepage, https://nihonshufyi.com
6
+ Project-URL: Documentation, https://nihonshufyi.com/developers/
7
+ Project-URL: Repository, https://github.com/fyipedia/nihonshufyi
8
+ Project-URL: Issues, https://github.com/fyipedia/nihonshufyi/issues
9
+ Project-URL: Changelog, https://github.com/fyipedia/nihonshufyi/releases
10
+ Author: FYIPedia
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: brewery,daiginjo,japanese-rice-wine,junmai,koji,nihonshu,prefecture,rice,sake,umami
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.10
27
+ Provides-Extra: all
28
+ Requires-Dist: httpx>=0.27; extra == 'all'
29
+ Requires-Dist: mcp>=1.0; extra == 'all'
30
+ Requires-Dist: rich>=13.0; extra == 'all'
31
+ Requires-Dist: typer>=0.15; extra == 'all'
32
+ Provides-Extra: api
33
+ Requires-Dist: httpx>=0.27; extra == 'api'
34
+ Provides-Extra: cli
35
+ Requires-Dist: rich>=13.0; extra == 'cli'
36
+ Requires-Dist: typer>=0.15; extra == 'cli'
37
+ Provides-Extra: mcp
38
+ Requires-Dist: mcp>=1.0; extra == 'mcp'
39
+ Description-Content-Type: text/markdown
40
+
41
+ # nihonshufyi
42
+
43
+ Sake knowledge API client for developers — search sake grades, breweries, and terminology from [NihonshuFYI](https://nihonshufyi.com).
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ pip install nihonshufyi[api] # API client (httpx)
49
+ pip install nihonshufyi[cli] # + CLI (typer, rich)
50
+ pip install nihonshufyi[mcp] # + MCP server
51
+ pip install nihonshufyi[all] # Everything
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ ```python
57
+ from nihonshufyi.api import NihonshuFYI
58
+
59
+ with NihonshuFYI() as api:
60
+ results = api.search("junmai daiginjo")
61
+ print(results)
62
+ ```
63
+
64
+ ## CLI
65
+
66
+ ```bash
67
+ nihonshufyi search "junmai daiginjo"
68
+ nihonshufyi search "niigata"
69
+ nihonshufyi search "yamada nishiki"
70
+ ```
71
+
72
+ ## MCP Server
73
+
74
+ ```bash
75
+ # Add to Claude Desktop config
76
+ python -m nihonshufyi.mcp_server
77
+ ```
78
+
79
+ Tools: `sake_search`
80
+
81
+ ## API Client
82
+
83
+ ```python
84
+ from nihonshufyi.api import NihonshuFYI
85
+
86
+ with NihonshuFYI() as api:
87
+ # Search sakes, breweries, glossary terms
88
+ results = api.search("junmai daiginjo")
89
+ ```
90
+
91
+ ## Links
92
+
93
+ - [NihonshuFYI](https://nihonshufyi.com) — Sake encyclopedia with grades, breweries, and terminology
94
+ - [PyPI](https://pypi.org/project/nihonshufyi/)
95
+ - [GitHub](https://github.com/fyipedia/nihonshufyi)
96
+ - [FYIPedia](https://fyipedia.com) — Open-source developer tools ecosystem
@@ -0,0 +1,56 @@
1
+ # nihonshufyi
2
+
3
+ Sake knowledge API client for developers — search sake grades, breweries, and terminology from [NihonshuFYI](https://nihonshufyi.com).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install nihonshufyi[api] # API client (httpx)
9
+ pip install nihonshufyi[cli] # + CLI (typer, rich)
10
+ pip install nihonshufyi[mcp] # + MCP server
11
+ pip install nihonshufyi[all] # Everything
12
+ ```
13
+
14
+ ## Quick Start
15
+
16
+ ```python
17
+ from nihonshufyi.api import NihonshuFYI
18
+
19
+ with NihonshuFYI() as api:
20
+ results = api.search("junmai daiginjo")
21
+ print(results)
22
+ ```
23
+
24
+ ## CLI
25
+
26
+ ```bash
27
+ nihonshufyi search "junmai daiginjo"
28
+ nihonshufyi search "niigata"
29
+ nihonshufyi search "yamada nishiki"
30
+ ```
31
+
32
+ ## MCP Server
33
+
34
+ ```bash
35
+ # Add to Claude Desktop config
36
+ python -m nihonshufyi.mcp_server
37
+ ```
38
+
39
+ Tools: `sake_search`
40
+
41
+ ## API Client
42
+
43
+ ```python
44
+ from nihonshufyi.api import NihonshuFYI
45
+
46
+ with NihonshuFYI() as api:
47
+ # Search sakes, breweries, glossary terms
48
+ results = api.search("junmai daiginjo")
49
+ ```
50
+
51
+ ## Links
52
+
53
+ - [NihonshuFYI](https://nihonshufyi.com) — Sake encyclopedia with grades, breweries, and terminology
54
+ - [PyPI](https://pypi.org/project/nihonshufyi/)
55
+ - [GitHub](https://github.com/fyipedia/nihonshufyi)
56
+ - [FYIPedia](https://fyipedia.com) — Open-source developer tools ecosystem
@@ -0,0 +1,88 @@
1
+ [project]
2
+ name = "nihonshufyi"
3
+ version = "0.1.0"
4
+ description = "Sake knowledge API client — search sake grades, breweries, and terms from NihonshuFYI."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ requires-python = ">=3.10"
8
+ authors = [{ name = "FYIPedia" }]
9
+ keywords = [
10
+ "sake",
11
+ "nihonshu",
12
+ "japanese-rice-wine",
13
+ "junmai",
14
+ "daiginjo",
15
+ "brewery",
16
+ "koji",
17
+ "umami",
18
+ "prefecture",
19
+ "rice",
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 4 - Beta",
23
+ "Intended Audience :: Developers",
24
+ "License :: OSI Approved :: MIT License",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Programming Language :: Python :: 3.13",
30
+ "Programming Language :: Python :: 3.14",
31
+ "Topic :: Software Development :: Libraries :: Python Modules",
32
+ "Typing :: Typed",
33
+ "Environment :: Console",
34
+ ]
35
+ dependencies = []
36
+
37
+ [project.optional-dependencies]
38
+ api = ["httpx>=0.27"]
39
+ cli = ["typer>=0.15", "rich>=13.0"]
40
+ mcp = ["mcp>=1.0"]
41
+ all = ["nihonshufyi[api,cli,mcp]"]
42
+
43
+ [project.scripts]
44
+ nihonshufyi = "nihonshufyi.cli:app"
45
+
46
+ [project.entry-points."mcp.servers"]
47
+ nihonshufyi = "nihonshufyi.mcp_server:mcp"
48
+
49
+ [project.urls]
50
+ Homepage = "https://nihonshufyi.com"
51
+ Documentation = "https://nihonshufyi.com/developers/"
52
+ Repository = "https://github.com/fyipedia/nihonshufyi"
53
+ Issues = "https://github.com/fyipedia/nihonshufyi/issues"
54
+ Changelog = "https://github.com/fyipedia/nihonshufyi/releases"
55
+
56
+ [build-system]
57
+ requires = ["hatchling"]
58
+ build-backend = "hatchling.build"
59
+
60
+ [tool.hatch.build.targets.wheel]
61
+ packages = ["src/nihonshufyi"]
62
+
63
+ [tool.pytest.ini_options]
64
+ testpaths = ["tests"]
65
+ addopts = "-v --tb=short"
66
+
67
+ [tool.ruff]
68
+ target-version = "py310"
69
+ line-length = 100
70
+
71
+ [tool.ruff.lint]
72
+ select = ["E", "F", "I", "UP", "B", "SIM", "RUF"]
73
+ ignore = ["RUF022"]
74
+
75
+ [tool.mypy]
76
+ python_version = "3.10"
77
+ strict = true
78
+
79
+ [dependency-groups]
80
+ dev = [
81
+ "httpx>=0.27",
82
+ "mcp>=1.0",
83
+ "mypy>=1.19.1",
84
+ "pytest>=9.0.2",
85
+ "rich>=13.0",
86
+ "ruff>=0.15.4",
87
+ "typer>=0.15",
88
+ ]
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: sake-tools
3
+ description: Search sake grades, breweries, rice varieties, and yeast strains with polishing ratios and parallel fermentation science data.
4
+ ---
5
+
6
+ # Sake Tools
7
+
8
+ Sake search and reference powered by [nihonshufyi](https://nihonshufyi.com/) -- a comprehensive sake knowledge platform covering grades, breweries, rice varieties, and the unique heiko fukuhakko (parallel fermentation) process.
9
+
10
+ ## Setup
11
+
12
+ Install the MCP server:
13
+
14
+ ```bash
15
+ pip install "nihonshufyi[mcp]"
16
+ ```
17
+
18
+ Add to your `claude_desktop_config.json`:
19
+
20
+ ```json
21
+ {
22
+ "mcpServers": {
23
+ "nihonshufyi": {
24
+ "command": "python",
25
+ "args": ["-m", "nihonshufyi.mcp_server"]
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ ## Available Tools
32
+
33
+ | Tool | Description |
34
+ |------|-------------|
35
+ | `sake_search` | Search sake grades, breweries, rice varieties, yeast strains, and terminology |
36
+
37
+ ## When to Use
38
+
39
+ - Looking up sake grades and their polishing ratios (Junmai Daiginjo ≤50%, Ginjo ≤60%, etc.)
40
+ - Researching sake rice varieties (Yamada Nishiki, Gohyakumangoku, Omachi, etc.)
41
+ - Exploring regional brewery (kura) characteristics across Japan's 47 prefectures
42
+ - Understanding fermentation science (koji, moromi, heiko fukuhakko)
43
+ - Finding serving temperature recommendations (reishu, hiya, nurukan, atsukan)
44
+
45
+ ## Links
46
+
47
+ - [Sake Grades](https://nihonshufyi.com/grades/)
48
+ - [Breweries](https://nihonshufyi.com/breweries/)
49
+ - [Rice Varieties](https://nihonshufyi.com/rice/)
50
+ - [API Documentation](https://nihonshufyi.com/developers/)
51
+ - [PyPI Package](https://pypi.org/project/nihonshufyi/)
@@ -0,0 +1,14 @@
1
+ """nihonshufyi — Sake knowledge API client for developers.
2
+
3
+ Search sake grades, breweries, and terminology from NihonshuFYI.
4
+
5
+ Usage::
6
+
7
+ from nihonshufyi.api import NihonshuFYI
8
+
9
+ with NihonshuFYI() as api:
10
+ results = api.search("junmai daiginjo")
11
+ print(results)
12
+ """
13
+
14
+ __version__ = "0.1.0"
@@ -0,0 +1,64 @@
1
+ """HTTP API client for nihonshufyi.com REST endpoints.
2
+
3
+ Requires the ``api`` extra: ``pip install nihonshufyi[api]``
4
+
5
+ Usage::
6
+
7
+ from nihonshufyi.api import NihonshuFYI
8
+
9
+ with NihonshuFYI() as api:
10
+ results = api.search("junmai daiginjo")
11
+ print(results)
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ from typing import Any
17
+
18
+ import httpx
19
+
20
+
21
+ class NihonshuFYI:
22
+ """API client for the nihonshufyi.com REST API.
23
+
24
+ Args:
25
+ base_url: API base URL. Defaults to ``https://nihonshufyi.com``.
26
+ timeout: Request timeout in seconds. Defaults to ``10.0``.
27
+ """
28
+
29
+ def __init__(
30
+ self,
31
+ base_url: str = "https://nihonshufyi.com",
32
+ timeout: float = 10.0,
33
+ ) -> None:
34
+ self._client = httpx.Client(base_url=base_url, timeout=timeout)
35
+
36
+ # -- HTTP helpers ----------------------------------------------------------
37
+
38
+ def _get(self, path: str, **params: Any) -> dict[str, Any]:
39
+ resp = self._client.get(path, params={k: v for k, v in params.items() if v is not None})
40
+ resp.raise_for_status()
41
+ result: dict[str, Any] = resp.json()
42
+ return result
43
+
44
+ # -- Endpoints -------------------------------------------------------------
45
+
46
+ def search(self, query: str) -> dict[str, Any]:
47
+ """Search sakes, breweries, and glossary terms.
48
+
49
+ Args:
50
+ query: Search term (e.g. ``"junmai daiginjo"``, ``"niigata"``).
51
+ """
52
+ return self._get("/api/search/", q=query)
53
+
54
+ # -- Context manager -------------------------------------------------------
55
+
56
+ def close(self) -> None:
57
+ """Close the underlying HTTP connection."""
58
+ self._client.close()
59
+
60
+ def __enter__(self) -> NihonshuFYI:
61
+ return self
62
+
63
+ def __exit__(self, *_: object) -> None:
64
+ self.close()
@@ -0,0 +1,54 @@
1
+ """Command-line interface for nihonshufyi.
2
+
3
+ Requires the ``cli`` extra: ``pip install nihonshufyi[cli]``
4
+
5
+ Usage::
6
+
7
+ nihonshufyi search "junmai daiginjo"
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import typer
13
+ from rich.console import Console
14
+ from rich.table import Table
15
+
16
+ app = typer.Typer(
17
+ name="nihonshufyi",
18
+ help="Sake knowledge API client — search sake grades, breweries, and terms from NihonshuFYI.",
19
+ no_args_is_help=True,
20
+ )
21
+ console = Console()
22
+
23
+
24
+ @app.command()
25
+ def search(
26
+ query: str = typer.Argument(help="Search term (e.g. 'junmai daiginjo', 'niigata')"),
27
+ ) -> None:
28
+ """Search sakes, breweries, and glossary terms."""
29
+ from nihonshufyi.api import NihonshuFYI
30
+
31
+ with NihonshuFYI() as api:
32
+ results = api.search(query)
33
+
34
+ table = Table(title=f"Search: {query}")
35
+ table.add_column("Type", style="cyan", no_wrap=True)
36
+ table.add_column("Name")
37
+ table.add_column("Detail")
38
+
39
+ items = results.get("results", [])
40
+ if not items:
41
+ console.print(f"[yellow]No results found for '{query}'[/yellow]")
42
+ return
43
+
44
+ for item in items:
45
+ item_type = item.get("type", "unknown")
46
+ name = item.get("name", item.get("title", ""))
47
+ detail = item.get("description", item.get("slug", ""))
48
+ table.add_row(item_type, str(name), str(detail))
49
+
50
+ console.print(table)
51
+
52
+
53
+ if __name__ == "__main__":
54
+ app()
@@ -0,0 +1,67 @@
1
+ """MCP server for nihonshufyi — sake knowledge tools for AI assistants.
2
+
3
+ Requires the ``mcp`` extra: ``pip install nihonshufyi[mcp]``
4
+
5
+ Run as a standalone server::
6
+
7
+ python -m nihonshufyi.mcp_server
8
+
9
+ Or configure in ``claude_desktop_config.json``::
10
+
11
+ {
12
+ "mcpServers": {
13
+ "nihonshufyi": {
14
+ "command": "python",
15
+ "args": ["-m", "nihonshufyi.mcp_server"]
16
+ }
17
+ }
18
+ }
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ from mcp.server.fastmcp import FastMCP
24
+
25
+ mcp = FastMCP("nihonshufyi")
26
+
27
+
28
+ @mcp.tool()
29
+ def sake_search(query: str) -> str:
30
+ """Search for sakes, breweries, and terminology on NihonshuFYI.
31
+
32
+ Search across sake grades (junmai, daiginjo, honjozo), breweries,
33
+ prefectures, rice varieties, yeast strains, serving temperatures,
34
+ and glossary terms.
35
+
36
+ Args:
37
+ query: Search term (e.g. "junmai daiginjo", "niigata", "yamada nishiki").
38
+ """
39
+ from nihonshufyi.api import NihonshuFYI
40
+
41
+ with NihonshuFYI() as api:
42
+ results = api.search(query)
43
+
44
+ items = results.get("results", [])
45
+ if not items:
46
+ return f"No results found for '{query}'."
47
+
48
+ lines = [
49
+ f"## Sake Search: {query}",
50
+ "",
51
+ f"Found {len(items)} result(s):",
52
+ "",
53
+ "| Type | Name | Detail |",
54
+ "|------|------|--------|",
55
+ ]
56
+
57
+ for item in items:
58
+ item_type = item.get("type", "unknown")
59
+ name = item.get("name", item.get("title", ""))
60
+ detail = item.get("description", item.get("slug", ""))
61
+ lines.append(f"| {item_type} | {name} | {detail} |")
62
+
63
+ return "\n".join(lines)
64
+
65
+
66
+ if __name__ == "__main__":
67
+ mcp.run()
File without changes
File without changes
@@ -0,0 +1,38 @@
1
+ """Tests for nihonshufyi.api — client initialization and URL construction."""
2
+
3
+ from nihonshufyi.api import NihonshuFYI
4
+
5
+
6
+ class TestNihonshuFYIInit:
7
+ def test_default_base_url(self) -> None:
8
+ client = NihonshuFYI()
9
+ assert str(client._client.base_url) == "https://nihonshufyi.com"
10
+ client.close()
11
+
12
+ def test_custom_base_url(self) -> None:
13
+ client = NihonshuFYI(base_url="https://example.com")
14
+ assert str(client._client.base_url) == "https://example.com"
15
+ client.close()
16
+
17
+ def test_default_timeout(self) -> None:
18
+ client = NihonshuFYI()
19
+ assert client._client.timeout.connect == 10.0
20
+ client.close()
21
+
22
+ def test_custom_timeout(self) -> None:
23
+ client = NihonshuFYI(timeout=30.0)
24
+ assert client._client.timeout.connect == 30.0
25
+ client.close()
26
+
27
+ def test_context_manager(self) -> None:
28
+ with NihonshuFYI() as api:
29
+ assert str(api._client.base_url) == "https://nihonshufyi.com"
30
+
31
+
32
+ class TestURLConstruction:
33
+ def test_search_url(self) -> None:
34
+ client = NihonshuFYI()
35
+ request = client._client.build_request("GET", "/api/search/", params={"q": "junmai"})
36
+ assert "/api/search/" in str(request.url)
37
+ assert "q=junmai" in str(request.url)
38
+ client.close()