@datalayer/core

中文文档
1.2.28发布于 2026/11/04TypeScriptES Module构建来源已验证近 30 天下载 8377

Datalayer

原始使用文档
文档目录22 节
  1. Overview
  2. Key Features
  3. Installation
  4. Python Client
  5. TypeScript/React Client
  6. Development Installation
  7. Quick Start with Python
  8. 1. Authentication
  9. 2. Runtime, Snapshots, and Evals
  10. Examples
  11. Platform Integration
  12. Documentation
  13. Development
  14. Building the Library
  15. Setup
  16. Code Quality
  17. Running Tests
  18. Contributing
  19. Architecture
  20. Use Cases
  21. License
  22. Support

Datalayer

Become a Sponsor

☰ 🌀 Datalayer Core

Python and Typescript libraries for Datalayer

PyPI version Python versions License Documentation Units TestsUnits Tests

Overview

Datalayer Core is the foundational package that powers the Datalayer AI Platform. It provides a TypesScript and Python packages as a Command Line Interface (CLI) for AI engineers, data scientists, and researchers to seamlessly integrate scalable compute runtimes into their workflows.

This package serves as the base foundation used by many other Datalayer packages, containing core application classes, configuration, and unified APIs for authentication, runtime management, and code execution in cloud-based environments.

Key Features

  • 🔐 Simple Authentication: Easy token-based authentication with environment variable support
  • 🔒 Secrets Management: Securely handle sensitive data and credentials in your workflows
  • 🐍 Python Client: Programmatic access to Datalayer platform with context managers and clean resource management
  • 🌐 TypeScript/React Client: React components and services for building Jupyter-based applications
  • 💻 Command Line Interface: CLI tools for account and platform operations
  • 🔧 Base Classes: Core application classes and configuration inherited by other Datalayer projects
  • 📓 Jupyter Integration: ServiceManager and collaboration providers for notebook experiences
  • 🧭 Universal Navigation: Smart navigation hooks that auto-detect and work with React Router, Next.js, or native browser

Installation

Python Client

Install Datalayer Core using pip:

pip install datalayer-core

TypeScript/React Client

Install as an npm package:

npm install @datalayer/core

Development Installation

git clone https://github.com/datalayer/core.git
cd core

# Python development
pip install -e .[test]

# TypeScript development
npm install

Quick Start with Python

1. Authentication

Set your Datalayer token as an environment variable:

export DATALAYER_API_KEY="your-api-key"

Or pass it directly to the Client:

from datalayer_core import DatalayerClient

# Using environment variable
client = DatalayerClient()

# Or pass token directly
client = DatalayerClient(api_key="your-api-key-here")

if client.authenticate():
    print("Successfully authenticated!")

2. Runtime, Snapshots, and Evals

Runtime execution, snapshot workflows, and evals CLI are now documented and maintained in:

Use agent-runtimes for runtime workloads (RuntimeClient, @datalayer, snapshots, and evals), and use datalayer-core for account/platform operations (authentication, secrets, API keys, usage, profile).

Examples

The examples show the Datalayer Client at work:

For agents, chats and sandboxes built on the client, see the Agent Runtimes examples.

Platform Integration

Datalayer adds AI capabilities and scalable compute runtimes to your development workflows. The platform is designed to seamlessly integrate into your existing processes and supercharge your computations with the processing power you need.

Key platform features accessible through this Client and CLI:

  • Remote Runtimes: Execute code on powerful remote machines with CPU, RAM, and GPU resources
  • Multiple Interfaces: Access and consume runtimes through Python Client, CLI, or other integrated tools
  • Scalable Compute: Dynamically scale your computational resources based on workload requirements

Documentation

Development

Building the Library

# Build TypeScript library
npm run build:lib

# Build Python package
python -m build

Setup

# Install Python dependencies
pip install -e .[test]

# Install TypeScript dependencies
npm install

Code Quality

This project maintains high code quality standards with automated linting, formatting, and type checking:

# Run all checks (format, lint, type-check)
npm run check

# Auto-fix all issues
npm run check:fix

# Individual commands
npm run lint          # ESLint with React/TypeScript rules
npm run lint:fix      # Auto-fix linting issues
npm run format        # Prettier formatting
npm run format:check  # Check formatting without changes
npm run type-check    # TypeScript compilation check

Pre-commit hooks automatically run formatting and linting on staged files via Husky and lint-staged.

Running Tests

# Python tests
pip install -e .[test]
pytest datalayer_core/tests/

# TypeScript tests
npm run test

# TypeScript type checking
npm run type-check
npm run test:watch    # Watch mode
npm run test:coverage # With coverage

Contributing

This Client is designed to be simple and extensible. We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

For issues and enhancement requests, please use the GitHub issue tracker.

Architecture

Datalayer Core serves as the foundation for the entire Datalayer ecosystem:

  • Base Classes: Core application classes inherited by other Datalayer packages
  • Configuration Management: Centralized configuration system for all Datalayer components
  • Authentication Layer: Unified authentication across all Datalayer services
  • Runtime Abstraction: Common interface for different types of compute runtimes
  • Resource Management: Automatic cleanup and lifecycle management

Use Cases

  • AI/ML Development: Scale your machine learning workflows with cloud compute using Client or CLI
  • Data Analysis: Process large datasets with powerful remote runtimes
  • Research: Collaborate on computational research with reproducible environments
  • Automation: Integrate Datalayer into CI/CD pipelines and automated workflows using CLI tools
  • Prototyping: Quickly test ideas without local hardware limitations

License

This project is licensed under the BSD 3-Clause License.

Support


Datalayer Logo

🚀 AI Agents for Data Analysis

Get started with Datalayer today!

版本与发布记录

@datalayer/core 共发布 78 个版本,首次发布于 2025/07/03;过去 12 个月发布了 57 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.2.28latest2026/11/047 天前
1.2.272026/10/2814 天前
1.2.262026/10/2715 天前
1.2.252026/10/2319 天前
1.2.242026/10/2319 天前
1.2.232026/10/2220 天前

关于 @datalayer/core 的常见问题

如何安装 @datalayer/core?

在项目目录运行 npm install @datalayer/core,或使用 pnpm add / yarn add / bun add。

@datalayer/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@datalayer/core 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@datalayer/core 可以商用吗?

@datalayer/core 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@datalayer/core 的下载量有多少?

根据 npm 官方下载统计,@datalayer/core 在 2026/10/12 – 2026/11/10 这 30 天内被下载 8,377 次,日均约 279 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@datalayer/core 还在维护吗?

最新版本 1.2.28 发布于 2026/11/04(7 天前);至今共发布 78 个版本,其中过去 12 个月发布了 57 个;首次发布于 2025/07/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。