What problem does it solve?
Bridging Clojure's functional power with Python's extensive machine learning ecosystem can be challenging. This Skill provides a comprehensive guide to set up libpython-clj for seamless interoperability, enabling direct use of Python libraries like NumPy, Pandas, and HuggingFace Transformers from Clojure, complete with automatic data conversion and performance optimizations.
Core Features & Use Cases
- Python Environment Setup: Configure
libpython-clj for auto-detection, manual paths, or virtual environments, ensuring correct Python integration.
- Module Importing & Function Calls: Import Python modules as Clojure namespaces and call Python functions with idiomatic Clojure syntax.
- Automatic Data Conversion: Effortlessly convert data types between Clojure and Python, including complex structures like vectors, maps, NumPy arrays, and Pandas DataFrames.
- Use Case: A Clojure agent needs to perform complex data analysis using Pandas and then apply a machine learning model from scikit-learn. This Skill guides the setup, data transfer, and function calls to execute these Python operations directly within the Clojure application.
Quick Start
Add libpython-clj to your deps.edn.
Call (py/initialize!) at application startup.
Import 'numpy' as 'np' using (require-python '[numpy :as np]).