Skip to main content

Business rule tracking for Python functions

Project description

Nomia

Nomia is a Python CLI for tracking alignment between business rules and code.

It lets you declare business rules in nomia.yaml, link those rules to Python functions with a decorator, capture a validated alignment snapshot, and later check whether the repository has drifted from that snapshot.

Nomia does not prove that code is semantically correct. It makes rule-code alignment explicit and reports when declared rules, linked implementations, or validated mappings have changed.

Core Workflow

Nomia has two main workflow commands:

  • nomia validate captures or updates the validated alignment state after you have reviewed and accepted the current rule-code associations.
  • nomia check checks the current repository against the validated state and reports alignment issues.

A typical workflow is:

nomia validate

Review and accept the current rule-code associations. Nomia writes the validated state to .nomia/state.json.

Later, after code or rule changes:

nomia check

Nomia compares the current repository to the last validated state and reports anything that needs review. If there are no issues, the default output is:

Nomia check completed.
Tracked rules: 3
No alignment issues found.

The tracked rule count is based on the configured rule IDs discovered from the current Nomia config.

Quick Example

Declare rules and source packages in nomia.yaml:

sources:
  - my_app

rules:
  - id: discount.eligibility
    description: Customer must be active and have no outstanding balance.

Link code to a rule:

from nomia import rule


@rule("discount.eligibility")
def is_customer_eligible(customer):
    return customer.is_active and customer.balance == 0

Capture the reviewed state:

nomia validate

Check for changes later:

nomia check

If the function body changes, the rule definition changes, a configured rule has no implementation, or a previously validated implementation is removed, check reports an alignment issue.

Commands

Nomia provides three commands:

nomia validate
nomia check
nomia audit

Global options:

nomia --config path/to/nomia.yaml check
nomia --verbose check

--config selects a Nomia config file. --verbose shows detailed discovery and import output.

nomia validate

nomia validate

Validates Nomia rule tracking and refreshes the local validation snapshot.

Use validate after you have reviewed the current rule-code associations and want to accept them as the new baseline.

On success, Nomia prints a compact summary:

Validation snapshot created. Rules tracked: 3, functions tracked: 3

If a declared rule has no discovered implementation, validation fails and reports the missing implementation.

nomia check

nomia check

Runs repository checks and reports findings.

By default, findings are informational and the command exits with code 0 when execution succeeds. Use --strict to exit with code 1 when findings are found:

nomia check --strict

Available output formats:

nomia check --format default
nomia check --format compact
nomia check --format detailed
nomia check --format json

check can report:

  • linked function code changed since the last validated snapshot
  • rule content changed since the last validated snapshot
  • a declared rule has no discovered implementation
  • a previously validated rule was removed from the config
  • a previously validated linked implementation was removed
  • a discovered rule-code association has not been validated yet

nomia audit

nomia audit

Lists discovered project functions that are not linked to a Nomia rule.

If no untracked functions are found, Nomia prints:

No untracked functions found.

Configuration

Nomia looks for a config file such as nomia.yaml.

sources:
  - my_app

rules:
  - id: orders_above_credit_limit_must_be_blocked
  - id: high_risk_customers_require_manual_approval
    title: High-risk customers require manual approval
    severity: high

sources tells Nomia where to discover Python functions. rules declares the business rule IDs that should be tracked.

What Nomia Is Not

Nomia does not:

  • infer business rules automatically
  • replace tests
  • require full rule coverage
  • enforce a domain model
  • prove that implementation behavior matches business intent

It gives you a lightweight way to notice when accepted rule-code alignment has changed and needs review.

License

This project is licensed under the terms of 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

nomia-0.1.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

nomia-0.1.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nomia-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6bcd85d074971e4d544da910479579e5af292dd001692a90ea6044b23db6d726
MD5 7baf5dba6510d8991e4ecd003830f39e
BLAKE2b-256 c1dbb331e310a381c235d18eab7825b80d4fc72c16a87b73558fbe5fb54d9e81

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nomia-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a4c2dcea7d6ea1abee3a3c80e723bb6c3c93bd3cd8933a584849938532ac03c
MD5 9c5c435c6d2df087958915b1f488b931
BLAKE2b-256 b3ef8c627210e7a069b6e2e9885c57d56f0599f4bffd64ac17d57318db1b9812

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