Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pinecone

A bundler for multi-file PineScript development. Write modular PineScript code across multiple files and bundle them into a single TradingView-compatible script.

Docs located here.

Features

  • Multi-file support - Split your PineScript code into multiple files
  • Import/Export system - Use // @import and // @export directives
  • Automatic namespacing - Prevents variable/function collisions between modules
  • External import deduplication - TradingView library imports are deduplicated automatically
  • Watch mode - Rebuild automatically when files change
  • Clipboard support - Copy bundled output directly to clipboard

Installation

Clone the repository and install in development mode:

git clone https://github.com/claudianadalin/pinecone.git
cd pinecone
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e .

Quick Start

1. Create a project structure

my-indicator/
├── pine.config.json
└── src/
    ├── main.pine
    └── utils.pine

2. Configure your project

Create pine.config.json in your project root:

{
  "entry": "src/main.pine",
  "output": "dist/bundle.pine"
}

3. Create your modules

src/utils.pine - Export functions you want to share:

//@version=5
// @export double, triple

double(x) =>
    x * 2

triple(x) =>
    x * 3

src/main.pine - Import and use them:

//@version=5
// @import { double, triple } from "./utils.pine"

indicator("My Indicator", overlay=true)

result = double(close)
plot(result)

4. Bundle your project

pinecone build

This creates dist/bundle.pine with all modules combined and properly namespaced.

CLI Commands

# Basic build
pinecone build

# Build with custom config path
pinecone build --config path/to/pine.config.json

# Watch mode - rebuild on file changes
pinecone build --watch

# Copy output to clipboard after build
pinecone build --copy

How It Works

  1. Parses your entry file and discovers all imports
  2. Resolves the dependency graph (with circular dependency detection)
  3. Renames all top-level identifiers in dependency modules to prevent collisions
  4. Merges all modules in topological order
  5. Outputs a single TradingView-compatible PineScript file

Namespacing Example

If utils.pine defines myFunc, it becomes __utils__myFunc in the bundle. Your imports are automatically updated to reference the renamed version.

Requirements

  • Python 3.10+

Documentation

Full documentation is available at claudianadalin.github.io/pinecone

Preview docs locally

source .venv/bin/activate
mkdocs serve

Then open http://localhost:8000

Deploy docs to GitHub Pages

mkdocs gh-deploy

Development

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov

Support

If you find Pinecone useful, consider buying me a coffee!

Buy Me A Coffee

License

MIT

About

A bundler for multi-file PineScript development. Write modular PineScript code across multiple files and bundle them into a single TradingView-compatible script.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.