Skip to main content

Atlan Python Client

Project description

pyatlan Logo

The official Python SDK for the Atlan ๐Ÿ’™

PyPI version Python versions License Downloads Build Status Documentation Docker


๐Ÿ“– Documentation โ€ข ๐Ÿณ Docker โ€ข ๐Ÿค Contributing

-----------------------------------------------------

๐Ÿ“Š Project Stats

  • ๐Ÿ Python Versions: 3.9, 3.10, 3.11, 3.12, 3.13
  • ๐Ÿ“ฆ Package Size: Optimized for fast installation
  • ๐Ÿš€ Performance: Built with modern async/await support
  • ๐Ÿ”ง Dependencies: Minimal, modern stack
  • ๐Ÿ“ˆ Stability: Production-ready

๐Ÿ“ฆ Installation

Production Use

# Latest stable version
pip install pyatlan

# Specific version
pip install pyatlan==7.1.3

# With uv (faster) - install uv first: curl -LsSf https://astral.sh/uv/install.sh | sh
uv add pyatlan

Development Setup

# Clone the repository
git clone https://github.com/atlanhq/atlan-python.git
cd atlan-python

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install with development dependencies
uv sync --group dev

# Run quality checks
uv run ./qa-checks

# Run tests
uv run pytest tests/unit

Dependency Groups

This project uses uv dependency groups for better dependency management:

  • Core dependencies: Always installed (uv sync)
  • Development dependencies: Testing, linting, formatting (uv sync --group dev)
  • Documentation dependencies: Sphinx docs (uv sync --group docs)

You can install multiple groups:

# Install both dev and docs dependencies
uv sync --group dev --group docs

# Install all dependencies
uv sync --all-groups

๐Ÿณ Docker

Pre-built Images (Harbor)

# Latest main image
docker pull registry.atlan.com/public/pyatlan:main-latest

# Version + Python tag
docker pull registry.atlan.com/public/pyatlan:8.5.1-3.11

# Commit-specific image
docker pull registry.atlan.com/public/pyatlan:sha-1a064032

Usage

# Interactive Python session
docker run -it --rm registry.atlan.com/public/pyatlan:main-latest

# Run a script
docker run -it --rm \
  -v $(pwd):/app \
  -e ATLAN_API_KEY=your_key \
  -e ATLAN_BASE_URL=https://your-tenant.atlan.com \
  registry.atlan.com/public/pyatlan:main-latest \
  python your_script.py

๐Ÿ”’ Security Scans

Run Snyk locally (dependencies)

uv export --all-extras --no-hashes > requirements.txt
snyk test --file=requirements.txt --severity-threshold=high --skip-unresolved
rm -f requirements.txt

๐Ÿงช Testing

Unit Tests

# Run all unit tests
uv run pytest tests/unit

# Run with coverage
uv run pytest tests/unit --cov=pyatlan --cov-report=html

Integration Tests

# Set up environment
cp .env.example .env
# Edit .env with your Atlan credentials

# Run integration tests
uv run pytest tests/integration

Quality Assurance

# Run all QA checks (formatting, linting, type checking)
uv run ./qa-checks

# Individual checks
uv run ruff format .          # Code formatting
uv run ruff check .           # Linting
uv run mypy .                 # Type checking

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

Development Setup

# Fork and clone the repository
git clone https://github.com/your-username/atlan-python.git
cd atlan-python

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install development dependencies
uv sync --group dev

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

Making Changes

# Create a feature branch
git checkout -b feature/amazing-feature

# Make your changes and test
uv run ./formatter
uv run ./qa-checks
uv run pytest tests/unit

# Commit with conventional commits
git commit -m "feat: add amazing feature"

# Push and create a pull request
git push origin feature/amazing-feature

Guidelines

  • โœ… Follow conventional commits
  • โœ… Add tests for new features
  • โœ… Update documentation as needed
  • โœ… Ensure all QA checks pass

๐Ÿ› ๏ธ SDK Generator

Generate asset models from your Atlan instance:

# Generate models automatically
uv run ./generator

# Force re-download typedefs (bypass cache)
uv run ./generator --override

# Use custom typedefs file
uv run ./generator ./my-typedefs.json

# Both flags can be combined
uv run ./generator --override ./my-typedefs.json

This will:

  • ๐Ÿ“ฅ Retrieve typedefs from your Atlan instance
  • ๐Ÿ—๏ธ Generate asset models, enums, and structures
  • ๐ŸŽจ Format code automatically
  • โšก Support incremental updates

๐Ÿ—๏ธ pyatlan_v9 Model Generation (msgspec)

The pyatlan_v9 package uses msgspec Struct-based models generated from Pkl type definitions in the atlanhq/models repo.

Using Claude Code

The recommended way to regenerate models is via the Claude Code skill:

# From the atlan-python repo root:
/generate-v9-models              # Generate from models@master
/generate-v9-models <branch>     # Generate from a specific models branch
/generate-v9-models test         # Generate and run tests
/generate-v9-models <branch> test

The skill will:

  1. Clone/update atlanhq/models at ../models
  2. Run the Pkl code generator with SDK mode (pkl eval typedefs/*.pkl -m . -p sdk=true)
  3. Selectively sync generated files to pyatlan_v9/model/assets/ (excluding hand-written types)
  4. Apply post-sync patches (e.g., set[str] fields in asset.py)
  5. Optionally run tests_v9/unit/ tests

Overlay Files

Custom methods (creator(), updater(), policy helpers, etc.) live in pyatlan_v9/model/assets/_overlays/. These are Python files read by the Pkl renderer and injected into generated classes. Each overlay file uses import directives:

  • # IMPORT: โ€” external imports (not remapped)
  • # INTERNAL_IMPORT: โ€” internal imports (remapped to pyatlan_v9.*)
  • # STDLIB_IMPORT: โ€” standard library imports

Hand-written Types

Some types are not yet fully generated and are maintained by hand:

  • Infrastructure: __init__.py, entity.py, referenceable.py
  • GTC types: atlas_glossary.py, atlas_glossary_term.py, atlas_glossary_category.py
  • Others: persona.py, purpose.py, badge.py, access_control.py, auth_policy.py, etc.

๐Ÿ“ Project Structure

Understanding the codebase layout will help you navigate and contribute effectively:

atlan-python/
โ”œโ”€โ”€ pyatlan/                          # ๐Ÿ Main Python package
โ”‚   โ”œโ”€โ”€ __init__.py                   # Package initialization
โ”‚   โ”œโ”€โ”€ cache/                        # ๐Ÿ’พ Caching mechanisms
โ”‚   โ”‚   โ”œโ”€โ”€ atlan_tag_cache.py       # Tag name โ†” GUID mapping
โ”‚   โ”‚   โ”œโ”€โ”€ custom_metadata_cache.py  # Custom metadata definitions
โ”‚   โ”‚   โ”œโ”€โ”€ enum_cache.py            # Enum value caching
โ”‚   โ”‚   โ””โ”€โ”€ aio/                     # Async versions of caches
โ”‚   โ”œโ”€โ”€ client/                       # ๐ŸŒ HTTP client implementations
โ”‚   โ”‚   โ”œโ”€โ”€ atlan.py                 # Main synchronous client
โ”‚   โ”‚   โ”œโ”€โ”€ asset.py                 # Asset operations (CRUD, search)
โ”‚   โ”‚   โ”œโ”€โ”€ admin.py                 # Administrative operations
โ”‚   โ”‚   โ”œโ”€โ”€ audit.py                 # Audit log operations
โ”‚   โ”‚   โ”œโ”€โ”€ common/                  # Shared client logic
โ”‚   โ”‚   โ””โ”€โ”€ aio/                     # Async client implementations
โ”‚   โ”œโ”€โ”€ model/                        # ๐Ÿ“Š Data models and assets
โ”‚   โ”‚   โ”œโ”€โ”€ assets/                  # Asset type definitions
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ core/                # Core asset types (Table, Database, etc.)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ relations/           # Relationship models
โ”‚   โ”‚   โ”œโ”€โ”€ fields/                  # Search field definitions
โ”‚   โ”‚   โ”œโ”€โ”€ open_lineage/            # OpenLineage specification models
โ”‚   โ”‚   โ”œโ”€โ”€ packages/                # Package/workflow models
โ”‚   โ”‚   โ””โ”€โ”€ aio/                     # Async model variants
โ”‚   โ”œโ”€โ”€ generator/                    # ๐Ÿ—๏ธ Code generation tools
โ”‚   โ”‚   โ”œโ”€โ”€ templates/               # Jinja2 templates for generation
โ”‚   โ”‚   โ””โ”€โ”€ class_generator.py       # Main generation logic
โ”‚   โ”œโ”€โ”€ pkg/                         # ๐Ÿ“ฆ Package creation utilities
โ”‚   โ”œโ”€โ”€ events/                      # ๐Ÿ”” Event handling (webhooks, lambdas)
โ”‚   โ”œโ”€โ”€ samples/                     # ๐Ÿ’ก Example code and scripts
โ”‚   โ””โ”€โ”€ test_utils/                  # ๐Ÿงช Testing utilities
โ”œโ”€โ”€ tests/                            # ๐Ÿงช Test suite
โ”‚   โ”œโ”€โ”€ unit/                        # Unit tests (fast, no external deps)
โ”‚   โ”œโ”€โ”€ integration/                 # Integration tests (require Atlan instance)
โ”‚   โ””โ”€โ”€ data/                        # Test fixtures and mock data
โ”œโ”€โ”€ docs/                            # ๐Ÿ“š Sphinx documentation
โ”‚   โ”œโ”€โ”€ conf.py                      # Sphinx configuration
โ”‚   โ””โ”€โ”€ *.rst                       # Documentation source files
โ”œโ”€โ”€ pyproject.toml                   # ๐Ÿ“‹ Project configuration (deps, tools)
โ”œโ”€โ”€ uv.lock                          # ๐Ÿ”’ Locked dependencies
โ”œโ”€โ”€ qa-checks                        # โœ… Quality assurance script
โ”œโ”€โ”€ formatter                        # ๐ŸŽจ Code formatting script
โ””โ”€โ”€ generator                        # ๐Ÿ—๏ธ Model generation script

Key Components

๐ŸŒ Client Layer (pyatlan/client/)

  • Synchronous: Direct HTTP operations using httpx
  • Asynchronous: Async/await operations using httpx.AsyncClient
  • Common: Shared business logic between sync/async clients
  • Specialized: Domain-specific clients (admin, audit, lineage, etc.)

๐Ÿ“Š Model Layer (pyatlan/model/)

  • Assets: 400+ asset types (tables, dashboards, pipelines, etc.)
  • Core Models: Base classes, requests, responses
  • Fields: Search and filtering field definitions
  • OpenLineage: Data lineage specification compliance

๐Ÿ’พ Cache Layer (pyatlan/cache/)

  • Tag Cache: Maps human-readable tag names to internal GUIDs
  • Custom Metadata: Caches custom attribute definitions
  • Connection Cache: Stores connector and connection metadata
  • Async Variants: Full async implementations for all caches

๐Ÿ—๏ธ Generation System (pyatlan/generator/)

  • Templates: Jinja2 templates for assets, enums, documentation
  • Generator: Retrieves typedefs and generates Python models
  • Incremental: Only regenerates changed models for efficiency

๐Ÿงช Testing Strategy

  • Unit Tests: Fast, isolated tests with mocks/fixtures
  • Integration Tests: Real API calls (requires credentials)
  • VCR Cassettes: Record/replay HTTP interactions for consistent testing

๐Ÿ“ฆ Package System (pyatlan/pkg/)

  • Custom Packages: Framework for building Atlan-deployable packages
  • Templates: Pre-built package structures and configurations
  • Utilities: Helper functions for package development

Development Workflow

  1. Models: Generated from your Atlan instance's typedefs
  2. Clients: Hand-crafted for optimal developer experience
  3. Tests: Mix of unit (fast iteration) and integration (real validation)
  4. Quality: Automated formatting, linting, and type checking
  5. Documentation: Auto-generated from docstrings and examples

๐Ÿ“„ License

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

๐Ÿ™ Attribution

Portions of this SDK are based on original work from:

Built with ๐Ÿ’™ by Atlan

Website โ€ข Documentation โ€ข Support

-----------------------------------------------------

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pyatlan-9.5.0.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

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

pyatlan-9.5.0-py3-none-any.whl (5.0 MB view details)

Uploaded Python 3

File details

Details for the file pyatlan-9.5.0.tar.gz.

File metadata

  • Download URL: pyatlan-9.5.0.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyatlan-9.5.0.tar.gz
Algorithm Hash digest
SHA256 1d262685681023d70e04248725c827e8e118230fade1049e04d97f53316f7969
MD5 ed7fc88c9e99cf0acc642bfb5f6d2e35
BLAKE2b-256 a8a4a41778ac1e14123b518f7a971797da04517d103bd50e4ab6e9d49957f8d8

See more details on using hashes here.

File details

Details for the file pyatlan-9.5.0-py3-none-any.whl.

File metadata

  • Download URL: pyatlan-9.5.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyatlan-9.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e740e314a7b4643ea5fddf5c1418815c44736a6a075933f66f72d52dcf8647e
MD5 5828203aea473deb8e9cec7a982b0c96
BLAKE2b-256 d00dc6eb0a39ceb0c62c47676a26e00be41d472f19b3ef4d2cda46eac5d3540c

See more details on using hashes here.

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