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 65+ commands for data analysis, ontology operations, SQL queries, 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)
  • 🎯 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

# 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.3.0.tar.gz (168.9 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.3.0-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pltr_cli-0.3.0.tar.gz
  • Upload date:
  • Size: 168.9 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.3.0.tar.gz
Algorithm Hash digest
SHA256 31562419d1631c818e6a87b6f837c54181f18e5bf23346d80347f9474b03961e
MD5 7e3407887fc2a10ce5870b441b3bb9d9
BLAKE2b-256 9fb58c5d35f05cf5fc33df6e8a5c78139b9aa7e7857c0459f64284a9108de08b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pltr_cli-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: pltr_cli-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 54.8 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ed12217e9da3b309ba06463a84e3332ca12252a2ad1c93c3f72cb98d3685f23
MD5 4ead1c7d578f09da6550b015dbf58587
BLAKE2b-256 e723789fc2b5fcac05686af4be56f6a100fbda6e5f6b3d1a9b79852993272711

See more details on using hashes here.

Provenance

The following attestation bundles were made for pltr_cli-0.3.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