Skip to main content

Typed, validated schemas for Gherkin data tables

Project description

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, 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 | yes    |
  | Badal | 25  | Tester             | no     |

Describe what those cells mean:

from talika import RowTable, boolean, field, split


class UserTable(RowTable):
    name = field("name", 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

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 | yes     | no      |

Both shapes use the same field declarations, parsers, validation hooks, output models, 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.

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

talika-0.2.0.tar.gz (81.5 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.2.0-py3-none-any.whl (71.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for talika-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9dda87025a22221bd3a49c23cc38c55177d5d21c3e035535ff43cab95b6f1c6b
MD5 6ccdbea6e153b660a339bd1afc8da7b1
BLAKE2b-256 92d716d0b1e0c2e0817a84de9b614b1c08e9199df3fb075c0246431e8e062d8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for talika-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: talika-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 71.2 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa8c3f82a4633bd4fb1339c59eb73595cadd79f1e02f23dc73af12ca3d782c83
MD5 c4daa22e87a2272e58252ae1777c6b3f
BLAKE2b-256 0f61fbb140214658785df5847057f4b506c0bfc0f72ec395cc7a52031148656e

See more details on using hashes here.

Provenance

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

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