Skip to main content

ccnl-engine

PyPI version Python CI Coverage License: MIT

A Python library for modeling Italian collective labor agreements (CCNL) as structured, versioned data and computing gross-to-net salary and employer cost from first principles.

Documentation · Demo

Motivation

I never really understood employment contracts or pay slips. The whole system strikes me as needlessly complicated. On top of that, finding reliable CCNL information online feels like an uphill battle: conflicting figures are everywhere, and identifying authoritative sources is harder than it should be. This project grew out of a desire to understand a little more. I make no claim to becoming an expert, but I hope to make this information more accessible and comprehensible for everyone.

The Problem

Italian payroll is governed by collective agreements (CCNL) that define base salaries, seniority increments, and allowances as time-series values — they change at negotiated renewal dates. Existing tools either lock this data inside proprietary systems or require a full HRMS. This library treats each CCNL as a validated JSON file and the computation as a pure function:

compute(ccnl, rules, employee) → Payslip

Quickstart

from datetime import date
from ccnl_engine import (
    ContractPosition, Employee, Permanent,
    WorkArrangement, compute, load_ccnl, load_year_rules,
)

ccnl = load_ccnl("commercio-confcommercio.json")
rules = load_year_rules(2026, ccnl.meta.tax_sector, num_employees=50)
employee = Employee(
    position=ContractPosition(
        level_code="4",
        as_of=date(2026, 9, 1),
        employment=Permanent(),
    ),
    arrangement=WorkArrangement(),
)
payslip = compute(ccnl, rules, employee)

print(payslip.net_annual)              # → Decimal('...')
print(payslip.trattamento_integrativo) # → Decimal('...') — Art. 1 D.L. 3/2020 bonus
print(payslip.fiscal_simplifications)  # → frozenset of items not computed by the engine
print(payslip.employer_cost_annual)    # → Decimal('...')

CCNL coverage

85 contracts covering ~15 million employees across private and public sectors.

→ Full CCNL coverage table

What is not modelled

  • Detrazioni per carichi di famiglia (Art. 12 TUIR)
  • Bilateral system contributions (EST, Fon.Te, …)
  • Overtime, night/holiday premiums, leave accruals, sick-pay integrations
  • Preferential 5% tax on premio di risultato (Art. 1 c. 182 L. 208/2015)

See API docs for full detail.

Disclaimer

This library is not legal or tax advice. Figures are computed from publicly available CCNL tables and statutory rates as of the dates indicated in the data files. Always verify results against official sources or a qualified payroll professional.

Metadata

Release files for ccnl-engine 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ccnl-engine 0.4.0
File Size Uploaded
ccnl_engine-0.4.0.tar.gz 424.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ccnl-engine 0.4.0
File Interpreter ABI Platform
ccnl_engine-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 855.8 kB

Release files / ccnl_engine-0.4.0.tar.gz

Download URL ccnl_engine-0.4.0.tar.gz
Size 424.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2605b13bfa5128cc09050192072f4a1efb01829edbd9e7d1e4ca14fcc510e39b
BLAKE2b-256 checksum
How to use checksums
ccf0893002d37f56837ab072616a34d0447b7eca9924cf0d0f5f7cf865762da0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release files / ccnl_engine-0.4.0-py3-none-any.whl

Download URL ccnl_engine-0.4.0-py3-none-any.whl
Size 431.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
808a42fe57fd4b6f4a4afe2b1d769554aa62a9c36dbe3dc388a6e39ff1606a6a
BLAKE2b-256 checksum
How to use checksums
6f52b2f3e23da519d4f0e7ddf93d130b16edbaec7ad2c54761e773db4398392b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.1

2 release files

0.5.0

2 release files

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release 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