Skip to main content

Replicate Alteryx Designer tools as independent Python functions — migrate from Alteryx to pandas with a familiar API.

Project description

🐦 PyTeryx: The Alteryx-to-Python Migration Engine

Replicate Alteryx Designer tools as independent Python functions.

Python 3.9+ License: MIT PyPI version


PyTeryx is a Python package that mirrors every major Alteryx Designer tool as a simple, independent function. If you're migrating from Alteryx to Python, PyTeryx gives you a familiar API while leveraging the full power, speed, and ecosystem of pandas.

Note: This package is not affiliated with Alteryx, Inc. "Alteryx" is a registered trademark of Alteryx, Inc. PyTeryx is an independent, community-driven open-source project.

🌟 Why PyTeryx?

Migrating from a visual ETL tool like Alteryx to code-first Python is traditionally painful. Data engineers and analysts have to translate complex logic, visual anchors, and proprietary tool configurations into standard Pandas operations.

PyTeryx bridges this gap by providing:

  • Zero-Friction Migration: Translating an Alteryx workflow to Python becomes a straightforward 1:1 mapping exercise.
  • Escape Vendor Lock-In: Execute your data pipelines anywhere Python runs—locally, on Airflow, AWS Lambda, or Databricks—without expensive proprietary licensing.
  • Pure Python, Pure Pandas: Under the hood, PyTeryx leverages optimized pandas operations. No bloated dependencies, no proprietary file formats.
  • CI/CD Ready: Since your workflows are now standard Python scripts or declarative YAML files, you can version control them, write unit tests, and integrate them into standard CI/CD pipelines.

✨ Core Architecture & Features

  • 1:1 Alteryx Tool Mapping: Each core Alteryx tool has a corresponding Python function (e.g. Preparation.filter, Join.join, Transform.summarize).
  • Familiar Output Anchors: Tools that have multiple output anchors in Alteryx return tuples in Python.
    • Filter returns (True_Data, False_Data)
    • Join returns (Left_Unjoined, Joined, Right_Unjoined)
    • Unique returns (Unique_Records, Duplicate_Records)
  • Pure Functions: All methods are @staticmethod. There is no hidden instance state and no side effects.
  • Immutable by Default: Original DataFrames are never mutated. Every tool returns a brand new DataFrame.
  • Type-Hinted & Documented: Full type annotations and Google-style docstrings enable rich IDE autocomplete.

📦 Installation

Install PyTeryx via pip:

pip install pyteryx

(Requires Python 3.9+ and pandas 1.5.0+)


🚀 How to Use PyTeryx

PyTeryx is designed for both software engineers (Python API) and data analysts (Declarative YAML).

Option 1: Python API (For Developers)

Use PyTeryx exactly like you use pandas, but with the familiar Alteryx tool names and behaviors. You can chain these together natively.

from pyteryx import InOut, Preparation, Join, Transform, Parse, Developer

# 1. Read data (Alteryx: Input Data tool)
sales = InOut.input_data("sales.csv")
customers = InOut.input_data("customers.csv")

# 2. Filter rows (Alteryx: Filter tool → T/F anchors)
# Returns a tuple representing the True and False output anchors
high_revenue, low_revenue = Preparation.filter(sales, "Revenue > 1000")

# 3. Add a calculated column (Alteryx: Formula tool)
high_revenue = Preparation.formula(high_revenue, "Profit", "Revenue - Cost")

# 4. Join with another dataset (Alteryx: Join tool → L/J/R anchors)
# Returns (Left Unjoined, Joined, Right Unjoined)
left_only, joined, right_only = Join.join(high_revenue, customers, on="CustomerID")

# 5. Summarize (Alteryx: Summarize tool)
# Supports native Alteryx aggregation aliases!
summary = Transform.summarize(
    joined,
    group_by="Region",
    aggregations={
        "Profit": ["sum", "mean"], 
        "CustomerID": "count distinct"
    }
)

# 6. Verify data integrity (Alteryx: Test / Expect Equal tool)
Developer.test(summary, lambda df: df["Sum_Profit"].sum() > 0, "Profit must be positive!")

# 7. Output results (Alteryx: Output Data tool)
InOut.output_data(summary, "summary.parquet")

Option 2: YAML Pipelines (No-Code ETL)

For users who prefer a declarative approach, you can build end-to-end data pipelines without writing any Python code using PyTeryx's declarative YAML engine. This is perfect for defining pipelines as configuration files.

  1. Create a pipeline.yaml
name: "Sales Filter Pipeline"
steps:
  - id: "load"
    tool: "InOut.input_data"
    args:
      path: "sales.csv"
  
  - id: "filter_high"
    tool: "Preparation.filter"
    inputs:
      df: "load"
    args:
      condition: "Revenue > 1000"
  
  - id: "save"
    tool: "InOut.output_data"
    inputs:
      df: "filter_high.0"  # The '.0' grabs the first tuple output (the 'True' anchor)
    args:
      path: "high_revenue.csv"
  1. Run via Command Line Interface (CLI)
pyteryx run pipeline.yaml

📚 Complete Tool Reference

PyTeryx has fully audited and implemented the 6 core Alteryx data-manipulation palettes, giving you comprehensive parity for data transformation.

🔌 In/Out Palette

Read, write, browse, and generate data.

PyTeryx Method Alteryx Tool Description
InOut.input_data() Input Data Read CSV, Excel, JSON, Parquet (auto-detect format)
InOut.output_data() Output Data Write DataFrame to CSV, Excel, JSON, Parquet
InOut.text_input() Text Input Create DataFrame from inline dictionary/list data
InOut.browse() Browse Display rich summary statistics, types, and head to stdout
InOut.directory() Directory List files in a path with creation/modification metadata
InOut.date_time_now() DateTime Now Return the current timestamp as a DataFrame

🔧 Preparation Palette

Cleanse, filter, sort, and transform rows/columns.

PyTeryx Method Alteryx Tool Description
Preparation.filter() Filter Split data based on condition into (true_df, false_df)
Preparation.formula() Formula Add/update a column using a string expression
Preparation.select() Select Select, rename, or cast data types of columns
Preparation.data_cleansing() Data Cleansing Strip whitespace, modify case, remove punctuation/nulls
Preparation.sort() Sort Sort dataframe by one or multiple columns
Preparation.unique() Unique Split data into (unique_df, duplicate_df)
Preparation.sample() Sample Extract first N, last N, random N, or percentage
Preparation.record_id() Record ID Attach an auto-incrementing integer ID column
Preparation.generate_rows() Generate Rows Create sequential rows programmatically
Preparation.auto_field() Auto Field Optimize column data types to save memory
Preparation.multi_field_formula() Multi-Field Formula Apply a single formula across multiple columns
Preparation.multi_row_formula() Multi-Row Formula Apply formulas that reference previous/next rows
Preparation.tile() Tile Group data into quantiles or uniform bins
Preparation.imputation() Imputation Fill missing values (mean, median, mode, or custom value)
Preparation.create_samples() Create Samples Split data into estimation/validation/holdout sets
Preparation.date_filter() Date Filter Filter dataset by a specific date range
Preparation.oversample_field() Oversample Field Perform stratified sampling to balance a target class
Preparation.rank() Rank Assign numeric ranks (supports group-by ranking)

🔗 Join Palette

Blend and match multiple datasets together.

PyTeryx Method Alteryx Tool Description
Join.join() Join Standard join. Returns (Left_Unjoined, Joined, Right_Unjoined)
Join.join_multiple() Join Multiple Merge 3 or more DataFrames on a common key
Join.union() Union Stack DataFrames vertically (by column name or position)
Join.find_replace() Find Replace Lookup-based string replacement (or append lookup value)
Join.append_fields() Append Fields Cross (Cartesian) join to append all rows
Join.fuzzy_match() Fuzzy Match Approximate string matching (Levenshtein/Jaro-Winkler)
Join.make_group() Make Group Group relationship keys using DFS connected-components

📊 Transform Palette

Reshape, pivot, and aggregate data.

PyTeryx Method Alteryx Tool Description
Transform.summarize() Summarize GroupBy with named aggregations
Transform.transpose() Transpose Wide-to-long reshaping (unpivot)
Transform.cross_tab() Cross Tab Long-to-wide reshaping (pivot)
Transform.running_total() Running Total Cumulative sum calculation (supports grouping)
Transform.count_records() Count Records Output total row count as a single-value DataFrame
Transform.arrange() Arrange Manually transpose and rearrange multiple columns
Transform.make_columns() Make Columns Wrap sequential rows into multiple columns
Transform.weighted_average() Weighted Average Calculate weighted average (supports grouping)

Pro-Tip: Transform.summarize() and Transform.cross_tab() natively support familiar Alteryx aggregation aliases like "count distinct", "count null", "count blank", "concatenate", "longest", "shortest", and "mode" out-of-the-box (in addition to all standard pandas agg strings like "sum" and "mean"). Output columns are automatically named Agg_ColumnName (e.g. Sum_Profit), just like Alteryx.

📝 Parse Palette

Extract and parse dates, XML, and text.

PyTeryx Method Alteryx Tool Description
Parse.date_time() DateTime Convert strings to DateTime (or infer formats automatically)
Parse.regex_match() RegEx (Match) Create a boolean flag if a pattern is found
Parse.regex_parse() RegEx (Parse) Extract regex capture groups directly into new columns
Parse.regex_replace() RegEx (Replace) Replace text based on a regular expression
Parse.regex_tokenize() RegEx (Tokenize) Split a string by a delimiter into rows or columns
Parse.text_to_columns() Text to Columns Split delimited text into columns or rows
Parse.xml_parse() XML Parse Extract XML nodes, outer XML, and auto-flatten child tags

🛠️ Developer Palette

Advanced data manipulation utilities.

PyTeryx Method Alteryx Tool Description
Developer.base64_encode() Base64 Encoder Encode string columns to Base64
Developer.base64_decode() Base64 Encoder Decode Base64 columns to strings
Developer.download() Download Perform an HTTP GET request directly into a DataFrame
Developer.column_info() Column Info Generate a rich metadata/schema report of your data
Developer.dynamic_rename() Dynamic Rename Rename columns dynamically via a lookup table mapping
Developer.json_parse() JSON Parse Flatten a JSON string column dynamically into multiple columns
Developer.dynamic_select() Dynamic Select Subset columns dynamically by data type or regex pattern
Developer.test() Test Assert a condition evaluates to True on the dataset
Developer.test_equal() Expect Equal Strictly validate that two DataFrames are identical

(Note: PyTeryx intentionally skips Alteryx GUI workflow orchestrators like "Detour" and "Block Until Done", as well as external execution nodes like the "R Tool", since PyTeryx workflows natively leverage standard Python script execution flow).


🧪 Testing & Development

PyTeryx boasts an extensive test suite verifying 1:1 parity with Alteryx tools.

# Clone the repository
git clone https://github.com/pyteryx/pyteryx.git
cd pyteryx

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

# Run the test suite with coverage
pytest tests/ -v --cov=pyteryx --cov-report=term-missing

🤝 Contributing

Contributions are heavily encouraged! PyTeryx is community-driven. If you find a missing edge-case, want to optimize a pandas operation, or want to add support for a new Alteryx Marketplace tool, please open an issue or submit a pull request on GitHub!

📄 License

MIT License — see the LICENSE file for details.

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

pyteryx-0.1.0.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

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

pyteryx-0.1.0-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file pyteryx-0.1.0.tar.gz.

File metadata

  • Download URL: pyteryx-0.1.0.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for pyteryx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7262695fb881de8a60280054207e418a6e2a80fdd1263376436142dce7620521
MD5 4d2dc3ee3621ee9e7f645f4e34070120
BLAKE2b-256 e9dabcd4216afa3ffa7520fe8599a8c774b2d02fa0010cdb839acd21ef322a54

See more details on using hashes here.

File details

Details for the file pyteryx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyteryx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for pyteryx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f599e67553fbf35fdd7794a093eea497d0b3eac65f5781323ec0d3d7f6e6ab7f
MD5 c294345cd6ef01bcfc7bfb8bc1ff1425
BLAKE2b-256 28115365d1cd09bd4af09b767eae2d88e2aee4a9a84c521427e21c3111976672

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