Skip to main content

Command-line interface for Palantir Foundry APIs

Project description

pltr-cli

A comprehensive command-line interface for Palantir Foundry APIs, providing 70+ commands for data analysis, ontology operations, SQL queries, folder management, and administrative tasks.

Overview

pltr-cli provides a powerful and intuitive way to interact with Palantir Foundry from the command line. Built on top of the official foundry-platform-sdk, it offers comprehensive access to Foundry's capabilities with a focus on productivity and ease of use.

✨ Key Features

  • 🔐 Secure Authentication: Token and OAuth2 support with encrypted credential storage
  • 📊 Dataset Operations: Get dataset information and create new datasets (RID-based API)
  • 📁 Folder Management: Create, explore, and manage Foundry filesystem structure
  • 🎯 Comprehensive Ontology Access: 13 commands for objects, actions, and queries
  • 📝 Full SQL Support: Execute, submit, monitor, and export query results
  • 👥 Admin Operations: User, group, role, and organization management (16 commands)
  • 💻 Interactive Shell: REPL mode with tab completion and command history
  • Shell Completion: Auto-completion for bash, zsh, and fish
  • 🎨 Rich Output: Beautiful terminal formatting with multiple export formats (table, JSON, CSV)
  • 👤 Multi-Profile Support: Manage multiple Foundry environments seamlessly

Installation

Using pip

pip install pltr-cli

From source

# Clone the repository
git clone https://github.com/anjor/pltr-cli.git
cd pltr-cli

# Install with uv
uv sync

# Run the CLI
uv run pltr --help

🚀 Quick Start

1. Configure Authentication

Set up your Foundry credentials:

pltr configure configure

Follow the interactive prompts to enter:

  • Foundry hostname (e.g., foundry.company.com)
  • Authentication method (token or OAuth2)
  • Your credentials

2. Verify Connection

Test your setup:

pltr verify

3. Start Exploring

# Check current user
pltr admin user current

# List available ontologies
pltr ontology list

# Create a new folder
pltr folder create "My Project"

# List root folder contents
pltr folder list ri.compass.main.folder.0

# Execute a simple SQL query
pltr sql execute "SELECT 1 as test"

# Start interactive mode for exploration
pltr shell

4. Enable Shell Completion

For the best experience:

pltr completion install

📖 Need more help? See the Quick Start Guide for detailed setup instructions.

📚 Documentation

pltr-cli provides comprehensive documentation to help you get the most out of the tool:

📖 User Guides

🔧 Developer Resources

🎯 Quick Command Overview

Most Common Commands:

# Authentication & Setup
pltr configure configure        # Set up authentication
pltr verify                    # Test connection

# Data Analysis
pltr sql execute "SELECT * FROM table"  # Run SQL queries
pltr ontology list             # List ontologies
pltr dataset get <rid>         # Get dataset info

# Administrative
pltr admin user current        # Current user info
pltr admin user list          # List users

# Interactive & Tools
pltr shell                    # Interactive mode
pltr completion install       # Enable tab completion

💡 Tip: Use pltr --help or pltr <command> --help for detailed command help.

For the complete command reference with examples, see Command Reference.

⚙️ Configuration

pltr-cli stores configuration securely using industry best practices:

  • Profile Configuration: ~/.config/pltr/profiles.json
  • Credentials: Encrypted in system keyring (never stored in plain text)
  • Shell History: ~/.config/pltr/repl_history (for interactive mode)

Environment Variables

For CI/CD and automation, use environment variables:

# Token authentication
export FOUNDRY_TOKEN="your-api-token"
export FOUNDRY_HOST="foundry.company.com"

# OAuth2 authentication
export FOUNDRY_CLIENT_ID="your-client-id"
export FOUNDRY_CLIENT_SECRET="your-client-secret"
export FOUNDRY_HOST="foundry.company.com"

See Authentication Setup for complete configuration options.

🔧 Development

Prerequisites

  • Python 3.9+
  • uv for dependency management

Quick Development Setup

# Clone the repository
git clone https://github.com/anjor/pltr-cli.git
cd pltr-cli

# Install dependencies and development tools
uv sync

# Install pre-commit hooks
uv run pre-commit install

# Run tests
uv run pytest

# Run linting and formatting
uv run ruff check src/
uv run ruff format src/
uv run mypy src/

Project Architecture

pltr-cli uses a layered architecture:

  • CLI Layer (Typer): Command-line interface and argument parsing
  • Command Layer: Command implementations with validation
  • Service Layer: Business logic and foundry-platform-sdk integration
  • Auth Layer: Secure authentication and credential management
  • Utils Layer: Formatting, progress, and helper functions

See API Wrapper Documentation for detailed architecture information and extension guides.

📊 Current Status

pltr-cli is production-ready with comprehensive features:

  • 65+ Commands across 8 command groups
  • 273 Unit Tests with 67% code coverage
  • Published on PyPI with automated releases
  • Cross-Platform support (Windows, macOS, Linux)
  • Comprehensive Documentation (Quick start, guides, examples)
  • Interactive Shell with tab completion and history
  • CI/CD Ready with environment variable support

Latest Release: Available on PyPI

🤝 Contributing

Contributions are welcome! Whether you're fixing bugs, adding features, or improving documentation.

Getting Started

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes following the existing patterns
  4. Add tests for new functionality
  5. Run the test suite and linting
  6. Commit using conventional commit format (feat:, fix:, docs:, etc.)
  7. Push to your branch and create a Pull Request

Development Guidelines

  • Follow existing code patterns and architecture
  • Add tests for new functionality
  • Update documentation for user-facing changes
  • Use type hints throughout
  • Follow the existing error handling patterns

See API Wrapper Documentation for detailed development guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Built on top of the official Palantir Foundry Platform Python SDK.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pltr_cli-0.4.0.tar.gz (171.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pltr_cli-0.4.0-py3-none-any.whl (58.6 kB view details)

Uploaded Python 3

File details

Details for the file pltr_cli-0.4.0.tar.gz.

File metadata

  • Download URL: pltr_cli-0.4.0.tar.gz
  • Upload date:
  • Size: 171.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pltr_cli-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9381e474754fe2c7f92bd7218f3057a8cad6446671a11c6d7fc054153f857d01
MD5 9b3a5bab306b916932f066e444a73bcf
BLAKE2b-256 0d0fe562db13df0b5f1da2cf6b9b9be4755a659c412d3559f5bcc6c33836ae6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pltr_cli-0.4.0.tar.gz:

Publisher: publish.yml on anjor/pltr-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pltr_cli-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pltr_cli-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 58.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pltr_cli-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f1199ccc532bf36d9d15ab10bfdf505179c670fd050f31c3fc359b722cb5fda
MD5 8e3d02046766270d9792af7267241448
BLAKE2b-256 12821cc58890032427a4494c9a53839d2fbd9339772d863219a3cf1fd7ba3911

See more details on using hashes here.

Provenance

The following attestation bundles were made for pltr_cli-0.4.0-py3-none-any.whl:

Publisher: publish.yml on anjor/pltr-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page