Skip to main content

Talika

Talika — Hindi for tables.
Declarative schemas for typed, validated Gherkin data tables.

CI PyPI version Supported Python versions License Documentation


Gherkin data tables are wonderfully easy to read. The raw list[list[str]] that arrives in Python is less wonderful to maintain.

As a test suite grows, step definitions accumulate the same invisible work: matching labels, converting strings, applying defaults, rejecting typos, and explaining which cell was wrong. Talika moves that work into a small, reusable table contract.

Define the shape once. Talika parses the table, converts its cells into real Python values, validates the result, and keeps errors connected to the original .feature file.

Quickstart · Why Talika? · API reference

What you get

  • Declarative table contracts — describe labels, required fields, aliases, defaults, and parsing rules in one Python class.
  • Typed records — turn cells into int, bool, Decimal, date, datetime, enums, lists, and your own domain values.
  • Both natural table shapes — use row-oriented tables for lists and column-oriented tables for detailed items.
  • Errors where the data lives — report stable error codes with the field, row, column, item ID, and original value.
  • Your team's vocabulary — build readable cell conventions such as random, today, or 20 words with tokens and full-match patterns.
  • Room for real test suites — model variants, references, table transforms, cross-record validation, and dataclass or Pydantic output.
  • Checks before test execution — validate Gherkin tables in CI with the optional talika check CLI.
  • A zero-dependency core — install integrations only when you need them.

Installation

Talika supports Python 3.10 and newer.

pip install talika

Or with uv:

uv add talika

Optional extras keep the core package small:

pip install "talika[cli]"       # Static checks for .feature files
pip install "talika[pydantic]"  # Pydantic v2 output models

See the installation guide for environment setup and all available extras.

A table contract in a few lines

Start with a table that stays readable for everyone working on the scenario:

Given the users exist
  | name  | age | roles              | active |
  | Akash | 27  | Developer, Manager | true   |
  | Badal | 25  | Tester             | false  |

Describe what those cells mean:

from talika import RowTable, boolean, field, split


class UserTable(RowTable):
    name = field(required=True)
    age: int = field("age", required=True)
    roles = field("roles", parser=split(","))
    active = field("active", parser=boolean(), default=True)

Then parse at the boundary of your step:

from pytest_bdd import given


@given("the users exist", target_fixture="users")
def users(datatable):
    return UserTable.parse(datatable)

Your test now receives useful Python values instead of table-shaped strings:

assert users[0].name == "Akash"
assert users[0].age == 27
assert users[0].roles == ["Developer", "Manager"]
assert users[0].active is True

parse() always returns UserTable records. When a boundary needs a dataclass, Pydantic model, or another callable output type, use UserTable.parse_as(datatable, User) instead. Omitting the target uses a configured output_model or build_output() hook.

Bad input fails at the table boundary with source-aware diagnostics:

Field parser failed: invalid literal for int() with base 10: 'old'
(code=parser_failed, schema=UserTable, field='age', row=2, column=2, value='old').

The quickstart walks through defaults, collected errors, source metadata, and the pytest-bdd fixture.

Tables can have different shapes

RowTable treats the first row as labels and each following row as one record:

| name  | role  |
| Akash | admin |
| Badal | user  |

ColumnTable treats the first column as labels and each following column as one record—useful when each item has many attributes:

| IDs       | 1       | 2       |
| Type      | Article | Poll    |
| Headline  | Hello   | Vote?   |
| Published | true    | false   |

Both shapes use the same field declarations, parsers, validation hooks, parse_as() output conversion, and source-aware errors. Read choosing a table shape for the trade-offs.

Make tables speak your domain

Talika does not impose a universal table DSL. It gives your project safe hooks to own its vocabulary:

from talika import CellDSL


cells = CellDSL()


@cells.token("random", fields=("headline",))
def random_headline(context):
    return context.user_data["faker"].headline()


@cells.pattern(r"(?P<count>\d+) words", fields=("body",))
def generated_words(match, context):
    return context.user_data["faker"].words(int(match["count"]))

Feature authors can write compact intent such as random or 20 words, while the project decides exactly what those phrases mean. Explore tokens, patterns, and composition.

Check feature files without running scenarios

Install the CLI extra and validate tables during local development or CI:

pip install "talika[cli]"
talika check features/users.feature --schema tests.tables:UserTable --step "the users exist"

The checker uses the official Gherkin parser and can emit JSON diagnostics for editor and CI integrations. See the static checking guide for discovery, context factories, and exit codes.

Where Talika fits

Talika is deliberately focused. It is not a test runner, fixture factory, business workflow engine, or general model-validation library.

pytest-bdd still runs scenarios. Pydantic can still validate final models. Factories can still build database objects. Talika owns the boundary between a human-authored data table and the Python objects your test code wants to use.

Learn more

  • Why Talika? — the problem it solves and how it compares with adjacent tools.
  • Quickstart — build and use your first schema.
  • Guides — fields, parsers, validation, variants, references, transforms, and more.
  • API reference — the complete public interface.
  • Changelog — releases and notable changes.

Contributing

Contributions are welcome. See CONTRIBUTING.md for the local development workflow and project checks.

License

Talika is released under the MIT License.

Download files

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

Source Distribution

talika-0.5.0.tar.gz (114.1 kB view details)

Uploaded Source

Built Distribution

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

talika-0.5.0-py3-none-any.whl (95.0 kB view details)

Uploaded Python 3

File details

Details for the file talika-0.5.0.tar.gz.

File metadata

  • Download URL: talika-0.5.0.tar.gz
  • Upload date:
  • Size: 114.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for talika-0.5.0.tar.gz
Algorithm Hash digest
SHA256 611cbf21a7f96cef0a9d52ae5ca19c193b9463c4d2090d0c9d6b1c2ac723dbeb
MD5 71444c7c00427c1ad0db7cd842c6c989
BLAKE2b-256 9b731f5145acf5cec0a8de2662120181c77fdd56111c2fc8c8a0b949feff9bf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for talika-0.5.0.tar.gz:

Publisher: publish-pypi.yml on talikadev/talika

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

File details

Details for the file talika-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: talika-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 95.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for talika-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7fcae1b8eebc9bc05227dbe2a0f27ff10764807eb08d370cd8d11ebbd11d4e9
MD5 3684b7913f4c0491d9a21a578d293928
BLAKE2b-256 ae9e3f3afebc65a59d99aa340e6207c21913ebed2f8010b8921f4843a7c05455

See more details on using hashes here.

Provenance

The following attestation bundles were made for talika-0.5.0-py3-none-any.whl:

Publisher: publish-pypi.yml on talikadev/talika

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

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page