Addresses PR #1555 review (Igor) — two bugs that block this PR from merging cleanly: 1. ``mempalace[extract]`` extras did not pull MarkItDown's per-format sub-dependencies. A real PDF after ``pip install mempalace[extract]`` would raise ``MissingDependencyException`` asking for ``markitdown[pdf]`` — the code then routed that exception through the generic ``except Exception`` and surfaced it as ``SKIP_EXTRACTION_ERROR``, stripping the actionable signal from the user. 2. ``test_fringe_broken_symlink`` and ``test_scan_formats_skips_symlinks`` called ``Path.symlink_to()`` unguarded, which raises ``OSError`` (``WinError 1314``) on Windows test environments without ``SeCreateSymbolicLinkPrivilege`` — surfacing as hard test failures before any product code ran. ## What this commit does 1. ``mempalace/format_miner.py`` — adds a new ``ExtractionStatus.SKIP_MISSING_FORMAT_DEPS`` enum member and a matching catch in ``extract_text`` that fires BEFORE the generic ``except Exception`` block. The catch matches by exception type name (``type(exc).__name__ == "MissingDependencyException"``) so the static import surface doesn't change — MarkItDown stays an optional dependency. 2. ``pyproject.toml`` — changes ``[extract]`` to include MarkItDown's per-format sub-extras: "markitdown[docx,pdf,pptx,xlsx]>=0.1.5; python_version >= '3.10'" These pull ``pdfminer-six``, ``pdfplumber``, ``mammoth``, ``lxml``, ``python-pptx``, ``openpyxl``, ``pandas`` — the deps each per-format converter actually needs at runtime. Verified against MarkItDown 0.1.5's PyPI metadata (Provides-Extra includes ``pdf``, ``docx``, ``pptx``, ``xlsx`` among others). ``.epub`` is handled by base markitdown (``EpubConverter`` uses ``beautifulsoup4``, a base requirement, so no ``[epub]`` extra is needed — and none exists in 0.1.5). ``.rtf`` is covered by the existing ``striprtf`` entry. ``markitdown[all]`` was NOT used because it pulls audio (``pydub``, ``speechrecognition``), YouTube, and Azure deps that mempalace does not claim support for and that would bloat the install for users. 3. ``tests/test_format_miner.py`` — adds a ``_make_symlink_or_skip`` helper near the top of the file that wraps ``Path.symlink_to()`` in try/except ``OSError`` and calls ``pytest.skip(...)`` on failure. Refactors both existing symlink tests (``test_fringe_broken_symlink``, ``test_scan_formats_skips_symlinks``) to use the helper. Behavior is unchanged on macOS/Linux; on Windows without symlink privileges the tests skip cleanly instead of spuriously failing. ## Tests (RED-first) Two new RED-first tests: test_extract_text_missing_format_dep_returns_distinct_status Patches ``_extract_via_markitdown`` to raise a fake exception with ``__name__ == "MissingDependencyException"``. Asserts the dispatcher returns ``SKIP_MISSING_FORMAT_DEPS``, not ``SKIP_EXTRACTION_ERROR``. test_pyproject_extract_extra_pulls_markitdown_format_subdeps Parses ``pyproject.toml`` (via ``tomllib`` 3.11+ or ``tomli`` on 3.9/3.10 — the latter is already a base dependency under the ``python_version < '3.11'`` marker). Asserts ``[extract]`` includes ``pdf``, ``docx``, ``pptx``, ``xlsx`` inside SOME ``markitdown[...]`` bracketed group. Both RED before this commit. Both GREEN after. Also updates ``test_extraction_status_enum_has_all_documented_codes`` to include the new ``SKIP_MISSING_FORMAT_DEPS`` code in the documented set, so the enum-completeness doc-test stays honest. ## Verification pytest tests/test_format_miner.py::test_extract_text_missing_format_dep_returns_distinct_status tests/test_format_miner.py::test_pyproject_extract_extra_pulls_markitdown_format_subdeps → 2 passed (RED before, GREEN after) pytest tests/test_format_miner.py::test_fringe_broken_symlink tests/test_format_miner.py::test_scan_formats_skips_symlinks → 2 passed on macOS (Windows behaviour validated by CI test-windows) pytest tests/test_format_miner.py → 64 passed, 2 skipped, 0 regressions pytest -q (full mempalace suite) → 2002 passed, 3 skipped, 0 regressions ruff check mempalace/format_miner.py tests/test_format_miner.py → All checks passed! ruff format --check ... → 2 files already formatted (pinned 0.15.9) ## Why no OrbStack run this time OrbStack runs Linux containers, which have unprivileged symlinks. It cannot reproduce the Windows ``WinError 1314`` failure mode this amendment fixes. The only authoritative gate for the symlink fix is GitHub CI's ``test-windows`` job. For the enum + extras changes, both are pure-Python / install-time concerns the CI test-linux matrix covers identically to OrbStack. The ``tomli`` fallback in the new pyproject test was verified against the base dependency declaration in ``pyproject.toml:32``.
125 lines
4.1 KiB
TOML
125 lines
4.1 KiB
TOML
[project]
|
|
name = "mempalace"
|
|
version = "3.3.5"
|
|
description = "Give your AI a memory — mine projects and conversations into a searchable palace. No API key required."
|
|
readme = "README.md"
|
|
requires-python = ">=3.9"
|
|
license = "MIT"
|
|
authors = [
|
|
{name = "milla-jovovich"},
|
|
]
|
|
keywords = [
|
|
"ai", "memory", "llm", "rag", "chromadb", "mcp",
|
|
"vector-database", "claude", "chatgpt", "embeddings",
|
|
]
|
|
classifiers = [
|
|
"Development Status :: 4 - Beta",
|
|
"Environment :: Console",
|
|
"Intended Audience :: Developers",
|
|
"Programming Language :: Python :: 3",
|
|
"Programming Language :: Python :: 3.9",
|
|
"Programming Language :: Python :: 3.10",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
"Programming Language :: Python :: 3.13",
|
|
"Programming Language :: Python :: 3.14",
|
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
"Topic :: Utilities",
|
|
]
|
|
dependencies = [
|
|
"chromadb>=1.5.4,<2",
|
|
"pyyaml>=6.0,<7",
|
|
"tomli>=2.0.0; python_version < '3.11'",
|
|
]
|
|
|
|
[project.urls]
|
|
Homepage = "https://github.com/MemPalace/mempalace"
|
|
Repository = "https://github.com/MemPalace/mempalace"
|
|
"Bug Tracker" = "https://github.com/MemPalace/mempalace/issues"
|
|
|
|
[project.scripts]
|
|
mempalace = "mempalace.cli:main"
|
|
mempalace-mcp = "mempalace.mcp_server:main"
|
|
|
|
[project.entry-points."mempalace.backends"]
|
|
chroma = "mempalace.backends.chroma:ChromaBackend"
|
|
|
|
# RFC 002 source-adapter entry-point group. Core publishes no first-party
|
|
# adapters under this group yet; ``miner.py`` and ``convo_miner.py`` migrate
|
|
# onto ``BaseSourceAdapter`` in a follow-up PR. Third-party adapter packages
|
|
# (``mempalace-source-cursor``, ``mempalace-source-git``, …) register here.
|
|
[project.entry-points."mempalace.sources"]
|
|
|
|
[project.optional-dependencies]
|
|
dev = ["pytest>=7.0", "pytest-cov>=4.0", "ruff==0.15.9", "psutil>=5.9"]
|
|
spellcheck = ["autocorrect>=2.0"]
|
|
# Hardware acceleration for the ONNX embedding model. Install exactly one:
|
|
# pip install mempalace[gpu] — NVIDIA CUDA
|
|
# pip install mempalace[dml] — DirectML (Windows AMD/Intel/NVIDIA)
|
|
# pip install mempalace[coreml] — macOS Neural Engine
|
|
# After install, set MEMPALACE_EMBEDDING_DEVICE=cuda|dml|coreml (or "auto").
|
|
gpu = ["onnxruntime-gpu>=1.16"]
|
|
dml = ["onnxruntime-directml>=1.16"]
|
|
coreml = ["onnxruntime>=1.16"]
|
|
# Binary-format extraction for `mempalace mine --mode extract`. Per-format
|
|
# transformer routing: striprtf for .rtf, MarkItDown for .pdf/.docx/.pptx/
|
|
# .xlsx/.epub. MarkItDown requires Python ≥ 3.10 (env marker ensures it
|
|
# only installs where supported; Python 3.9 users still get RTF coverage).
|
|
extract = [
|
|
"striprtf>=0.0.27",
|
|
# Per PR #1555 review (Igor): bare ``markitdown`` is enough to import
|
|
# but not enough to convert — actual PDF/DOCX/PPTX/XLSX extraction
|
|
# needs MarkItDown's per-format sub-extras, which pull pdfminer-six,
|
|
# mammoth, python-pptx, openpyxl, etc. EPUB is handled by base
|
|
# markitdown (EpubConverter uses beautifulsoup4, a base requirement),
|
|
# so no [epub] sub-extra is needed (and none exists in 0.1.5). RTF is
|
|
# covered by striprtf above.
|
|
"markitdown[docx,pdf,pptx,xlsx]>=0.1.5; python_version >= '3.10'",
|
|
]
|
|
|
|
[dependency-groups]
|
|
dev = ["pytest>=7.0", "pytest-cov>=4.0", "ruff==0.15.9", "psutil>=5.9"]
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["mempalace"]
|
|
|
|
[tool.ruff]
|
|
line-length = 100
|
|
target-version = "py39"
|
|
extend-exclude = ["benchmarks"]
|
|
|
|
[tool.ruff.lint]
|
|
select = ["E", "F", "W", "C901"]
|
|
ignore = ["E501"]
|
|
|
|
[tool.ruff.lint.mccabe]
|
|
max-complexity = 25
|
|
|
|
[tool.ruff.format]
|
|
quote-style = "double"
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
pythonpath = ["."]
|
|
addopts = "-m 'not benchmark and not slow and not stress'"
|
|
markers = [
|
|
"benchmark: scale/performance benchmark tests",
|
|
"slow: tests that take more than 30 seconds",
|
|
"stress: destructive scale tests (100K+ drawers)",
|
|
]
|
|
|
|
[tool.coverage.run]
|
|
source = ["mempalace"]
|
|
|
|
[tool.coverage.report]
|
|
fail_under = 85
|
|
show_missing = true
|
|
exclude_lines = [
|
|
"if __name__",
|
|
"pragma: no cover",
|
|
]
|