Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "python-design-patterns"
version = "0.1.0"
version = "1.0.0"
description = "Design patterns in Python: naive, pythonic, and real-world examples, with an MCP server for agents."
readme = "README.md"
license = { file = "LICENSE" }
Expand Down Expand Up @@ -44,7 +44,7 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/design_patterns", "src/design_patterns_mcp"]
packages = ["src/design_patterns", "src/design_patterns_mcp", "patterns"]

[tool.ruff]
line-length = 100
Expand Down
2 changes: 1 addition & 1 deletion src/design_patterns/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Design patterns in Python: catalog loader and shared utilities."""

__version__ = "0.1.0"
__version__ = "1.0.0"
12 changes: 10 additions & 2 deletions src/design_patterns/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from __future__ import annotations

import importlib.util
import json
from dataclasses import asdict, dataclass, field
from pathlib import Path
Expand Down Expand Up @@ -150,13 +151,20 @@ def to_json(self) -> str:


def find_patterns_root(start: Path | None = None) -> Path:
"""Locate the ``patterns/`` directory from a file inside the repo."""
"""Locate the ``patterns/`` directory.

Works both from a repo checkout (walk upward from this file) and from an
installed wheel (the ``patterns`` package ships inside the distribution).
"""
here = (start or Path(__file__)).resolve()
for parent in [here, *here.parents]:
candidate = parent / "patterns"
if candidate.is_dir():
return candidate
raise CatalogError(f"no patterns/ directory above {here}")
spec = importlib.util.find_spec("patterns")
if spec is not None and spec.origin is not None:
return Path(spec.origin).parent
raise CatalogError(f"no patterns/ directory above {here} and no installed patterns package")


def load_catalog(root: Path | None = None) -> Catalog:
Expand Down
Loading