xiaohongshu
xiaohongshu
dependency-deprecation
Pattern for deprecating external dependencies while maintaining backward compatibility. Trigger: removing Java/FIJI/MATLAB, deprecating optional deps
Full skill instructions
| Item | Details |
|---|---|
| Date | 2025-12-11 |
| Goal | Remove Java/Maven/FIJI/CLIJ2 dependencies from KINTSUGI while maintaining backward compatibility |
| Environment | Python 3.10+, cross-platform (Windows/Linux/macOS) |
| Status | Success |
KINTSUGI originally depended on Java/Maven for PyImageJ and CLIJ2 GPU processing. This created installation friction and cross-platform issues. The goal was to replace these with pure Python implementations (CuPy/NumPy) while allowing legacy users to continue using Java if needed.
Search for all references to the dependency:
# Search code
grep -r "java\|Java\|FIJI\|fiji\|clij\|CLIJ\|maven\|Maven\|ImageJ\|imagej" src/ notebooks/
# Check configuration files
grep -r "java\|openjdk\|maven" envs/ pyproject.toml
Files typically affected:
pyproject.toml - optional dependenciesenvs/*.yml - conda environment filessrc/*/deps.py - dependency checkerdocs/*.md - documentation# Example: edf.py - deprecating CLIJ2 backend
import warnings
from typing import Literal
BackendType = Literal["auto", "cupy", "numpy", "clij2"]
def _detect_backend(self, requested: BackendType) -> str:
"""Detect best available backend."""
if requested == "clij2":
warnings.warn(
"CLIJ2 backend is deprecated and will be removed in v2.0. "
"Use 'cupy' or 'numpy' instead.",
DeprecationWarning,
stacklevel=2
)
# Still allow it to work for now
if self._check_clij2_available():
return "clij2"
else:
warnings.warn("CLIJ2 not available, falling back to cupy")
requested = "auto"
if requested == "auto":
# NEW priority order: CuPy > NumPy (CLIJ2 excluded from auto)
if self._check_cupy_available():
return "cupy"
return "numpy"
return requested
# deps.py - mark as deprecated but keep functional
def _check_java(self, verbose: bool):
"""Check Java installation.
.. deprecated::
Java/Maven dependencies are no longer required for core functionality.
Kept for backward compatibility with legacy CLIJ2 workflows.
"""
if verbose:
print("\n[Java/Maven] (DEPRECATED - no longer required)")
# Still check and report, but don't fail
try:
# ... existing check code ...
if verbose:
print(f" [OK] java v{version} (optional)")
except Exception as e:
if verbose:
print(f" [SKIP] java (optional, not required)")
[project.optional-dependencies]
# Keep the optional group but exclude from [full]
java = [
"JPype1>=1.5.0",
"scyjava>=1.0.0",
"pyimagej>=1.4.0",
]
# Remove java from full install
full = [
"kintsugi[gpu,viz,dl,analysis,bio]", # Note: java excluded
]
# envs/env-*.yml - comment out with deprecation note
# Java/ImageJ Integration (DEPRECATED - no longer required)
# Uncomment if you need legacy CLIJ2 support:
# - openjdk=11
# - maven
# - jpype1
Add deprecation notices to all relevant docs:
> **Note:** Java, Maven, and FIJI are no longer required. KINTSUGI now uses
> pure Python implementations (CuPy/NumPy) for all processing including EDF.
For historical documents, add a header:
> **DEPRECATION NOTICE (2025):** This document is historical. Java/Maven/FIJI
> dependencies have been removed. See `src/kintsugi/edf.py` for current implementation.
| Attempt | Why it Failed | Lesson Learned |
|---|---|---|
| Removing code completely | Broke existing user workflows | Keep deprecated code functional |
| Silent removal | Users confused when code stopped working | Always emit deprecation warnings |
| Keeping in [full] install | Users still got Java install failures | Exclude from aggregate installs |
| No migration path | Users didn't know what to use instead | Document the replacement clearly |
warnings.warn() with DeprecationWarning[full]xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience