ENGINE 03

SFS-E03-PTX · PARTNERSHIP TAX · REV 2026-07-20 · PRODUCTION

PRODUCTION = runnable end-to-end, CI-backed, full test suite passing. All data fictional and seeded.

Partnership Tax · Form 1065

Deterministic Form 1065 support builder with penny-exact K-1s and seven tie-out checks

From a seeded, fully fictional source bundle it builds the partnership's book-to-tax bridge, maps every figure onto Form 1065 and Schedule K, L, M-1, M-2 plus a K-1 preview, and allocates ordinary income so the partner K-1s sum to the exact penny. It runs seven deterministic tie-out checks and marks the package READY only when all pass, otherwise exit code 2. A separate mode tracks IRC §704(c) built-in gain under the traditional method, carrying two parallel capital accounts and flagging the ceiling rule rather than silently curing it.

Every figure on this page re-derives from the public repository: the 653,550.00 ordinary income, the seven tie-out checks, the 15 sourced return lines, and the §704(c) roll-forward are printed by commands you can run, not asserted.

Run it Book a consultation

Architecture

functional block stack · static overview
Review & tie-out gate Reporting & artifacts 1065 mapping & K-1 allocation Book-to-tax compute & integer-cent money core Seeded synthetic source intake substrate: seeded fictional data

Select a layer

Each layer is one stage of the pipeline, top of stack to substrate. Select a layer for its plain-terms and engineering detail.

Key specifications

at a glance
8,6051
Tests
the checks that pin this engine's behavior
72
Tie-out checks
deterministic reviewer checks that gate READY
153
Mapped return lines
Form 1065 + Schedule K/L/M-1/M-2 lines, all sourced
integer cents4
Money precision
largest-remainder allocation, K-1s sum exactly
10655
Default seed
deterministic synthetic source bundle
0 = READY · 2 = REVIEW6
Gate exit codes
so it can act as a CI gate

What it does for you

plain terms

Preparing Form 1065 partnership-tax support is manual and error-prone: the book-to-tax bridge, the K-1 allocations that must sum to the penny, the Schedule L / M-1 / M-2 tie-outs, and multi-year IRC §704(c) built-in-gain tracking all have to reconcile before anything is filed. Typical failures are off-by-a-penny K-1 allocations, an unbalanced Schedule L, unsupported return lines, and §704(c) ceiling-rule distortions that get quietly smoothed over. This engine builds the whole package deterministically on fictional seeded data, sources every mapped line, and refuses to mark the package ready until all tie-out checks pass.

A standard 1065 support package that ties out7. The default run builds the fictional Demo 721 Development LP return: ordinary business income of 653,550.00, a 15-line Form 1065 / Schedule K/L/M-1/M-2 map, a three-partner K-1 preview, and 7/7 checks OK, so the package is marked READY and the process exits 0.

Skip the optional Excel workbook8. Passing --no-xlsx builds the identical package but omits the openpyxl support workbook, emitting only the Markdown and JSON artifacts — useful in CI or where Excel is not wanted.

An IRC §704(c) built-in gain with a binding ceiling9. The §704(c) mode models Harborview Partners LP: Atlas contributes property (FMV 1,200,000 / tax basis 300,000 = 900,000 built-in gain) and Beacon contributes 1,200,000 cash. Book depreciation (200,000/yr) exceeds tax depreciation (50,000/yr), so the ceiling rule binds in FY1-5 (flagged BINDING short 50,000 each year); the residual 150,000 layer is caught up to Atlas on the FY6 sale and the tax-basis balance sheet ties at 2,260,000.

Functional block diagram

engineering · each block links to its source
Functional block diagram of the Partnership Tax · Form 1065 engine default mode --section704c TaxSourcePackage ordinary income ordinary income form lines K-1 rows READY / REVIEW md / json / xlsx results section704c_*.md CLI dispatch Source intake Book-to-tax bridge 1065 / K / L /M-1 / M-2 line map K-1 partner allocation Review checks gate Report writers Artifacts §704(c)built-in-gain engine §704(c) reports SFS-E03-PTX · FUNCTIONAL BLOCK DIAGRAM · REV 2026-07-20

Plain terms

  • CLI dispatch. Reads the flags and picks either the standard 1065 build or the §704(c) demo.
  • Source intake. Produces the fictional trial balance, balance sheet, capital, and line-map targets.
  • Book-to-tax bridge. Builds book income and the M-1 adjustments to reach taxable ordinary income.
  • 1065 / K / L / M-1 / M-2 line map. Maps each computed number onto its return line, with source IDs.
  • K-1 partner allocation. Splits ordinary income and capital activity across partners to the penny.
  • Review checks gate. Runs seven tie-out checks; only marks READY when all pass.
  • Report writers. Renders the Markdown, JSON, and optional Excel outputs.
  • Artifacts. The review-ready files land in the output directory.
  • §704(c) built-in-gain engine. Alternate mode: tracks book vs tax capital and applies the traditional method with the ceiling rule.
  • §704(c) reports. Writes the built-in-gain summary and a per-partner K-1 capital analysis.

Engineering

  • CLI dispatch. argparse parser with --year (2025), --seed (1065), --out, --no-xlsx, --section704c; routes to _run_section704c or the standard build.
  • Source intake. generate_source_package(year, seed) -> TaxSourcePackage, seeded by random.Random(seed).
  • Book-to-tax bridge. build_tax_package computes book_income, adjustment_total, ordinary_income, tax_depreciation, and total_deductions in integer cents.
  • 1065 / K / L / M-1 / M-2 line map. _form_lines emits 15 FormLine rows across Form 1065 and Schedules K/L/M-1/M-2.
  • K-1 partner allocation. _partner_allocations with money.allocate_by_bps (largest remainder) so K-1 amounts sum exactly to Schedule K.
  • Review checks gate. _review_checks -> seven ReviewCheck rows; TaxPackage.ready = all OK; exit 0 / 2.
  • Report writers. write_outputs -> tax_workpapers.md, review_checks.md, form_1065_preview.json, optional xlsx.
  • Artifacts. output/tax_workpapers.md, review_checks.md, form_1065_preview.json, 1065_supporting_package.xlsx.
  • §704(c) built-in-gain engine. section704c.py tracks parallel §704(b) book and tax capital, allocates tax items under the traditional method, and flags ceiling_binding with the shortfall.
  • §704(c) reports. run_demo writes section704c_summary.md and section704c_k1_<PARTNER>.md.

Instruction set

every public command
CommandOperationOutputExitArtifacts
python -m partnership_tax
Build the standard fictional Form 1065 support packageConsole summary (year, partnership, ordinary income, checks OK, READY/REVIEW) + written files0 if READY, 2 if REVIEWoutput/tax_workpapers.md, review_checks.md, form_1065_preview.json, 1065_supporting_package.xlsx
python run.py --no-xlsx
Same build via the convenience entrypoint, skipping the Excel workbookConsole summary + written files (no xlsx)0 if READY, 2 if REVIEWoutput/tax_workpapers.md, review_checks.md, form_1065_preview.json
python -m partnership_tax --section704c
Run the IRC §704(c) built-in-gain demo (traditional method + ceiling rule)Console summary (partnership, partners, contributed props, built-in gain) + written files0output/section704c_summary.md, section704c_k1_ATLAS.md, section704c_k1_BEACON.md
python -m pytest -q
Run the engine's test suitepytest pass/fail summary0 if all passnone (test run)

Benchmarks

measured demo results
MeasureResult
Tests collected108,605 tests
the checks that pin this engine's behavior
Ordinary business income (seed 1065)11653,550.00 USD (fictional)
Demo 721 Development LP taxable ordinary income
Tie-out checks passing127/7 checks OK
all reviewer checks pass, package READY
§704(c) built-in gain (Harborview demo)13900,000.00 USD (fictional)
FMV 1,200,000 minus tax basis 300,000 at formation
§704(c) tax-basis balance sheet142,260,000.00 USD (fictional), ties
assets = liabilities 0 + tax capital 2,260,000; book and tax capital totals also tie

Control characteristics

engineering

Plain terms

The code enforces the READY/REVIEW machine gate and exit code; per the README Controls, human review remains the final sign-off.

Engineering

Deterministic envelope. seeded fictional inputs, read-only operation, offline default mode.

Demo gate. machine gate: READY only when all seven tie-out checks pass, otherwise REVIEW and exit code 2

SeverityVerdictAction
All seven tie-out checks within tolerance (0)READYTaxPackage.ready = True; status READY in the reports; main() exits 0
Any tie-out check outside toleranceREVIEWTaxPackage.ready = False; that check reads FAIL; main() exits 2
§704(c): actual tax depreciation below the non-contributor's book-depreciation shareBINDINGnon-contributor capped at the available tax item, contributor gets none, year flagged BINDING with the uncured shortfall
§704(c): tax item meets or exceeds the book sharenot binding (—)the book-tax disparity is cured normally; no shortfall flag

Standard 1065 package (default). python -m partnership_tax builds the book-to-tax bridge, the 15-line Form 1065 / Schedule K/L/M-1/M-2 map, the K-1 preview, and the seven tie-out checks; exit 0 READY / 2 REVIEW. --no-xlsx skips the optional Excel workbook.

§704(c) built-in-gain demo (--section704c). python -m partnership_tax --section704c runs the traditional method plus the ceiling rule over multiple years, tracking parallel §704(b) book and tax capital, and writes section704c_summary.md and a per-partner K-1; exit 0.

Operating limits

what it refuses to do

See it run

animated overview
Animated brand overview of the Partnership Tax · Form 1065 engine — the pipeline from seeded source intake through the book-to-tax bridge and 1065 / K-1 mapping to the tie-out gate, on fictional seeded data.
Animated overview of the tax run on fictional seeded data; run the commands above to reproduce.

Integration

how to run it

Distribution: public repository, MIT license.

git clone https://github.com/sophonfinance-wq/finance-automation-portfolio.git && cd finance-automation-portfolio/partnership-1065-automation && python -m partnership_tax
python -m partnership_tax --section704c
Source on GitHub Engine README All tests, by engine Run in Codespaces
Substantiation
  • 1python -m pytest --collect-only -q (partnership-1065-automation/); verified 2026-07-20 and pinned in site-datasheets/counts.json
  • 2partnership_tax/engine.py _review_checks (CHK-001..CHK-007); output/review_checks.md
  • 3partnership_tax/engine.py _form_lines; CHK-007 counts 15/15 with source refs
  • 4partnership_tax/money.py to_cents / fmt / allocate_by_bps
  • 5partnership_tax/generate.py DEFAULT_SEED = 1065
  • 6partnership_tax/cli.py main() (return 0 if package.ready else 2)
  • 7README Run It (python -m partnership_tax); output/review_checks.md CHK-001..CHK-007; partnership_tax/cli.py main()
  • 8README Run It (python run.py --no-xlsx); partnership_tax/cli.py --no-xlsx flag; partnership_tax/report.py write_outputs
  • 9README §704(c) section (python -m partnership_tax --section704c); output/section704c_summary.md
  • 10python -m pytest --collect-only -q (partnership-1065-automation/); verified 2026-07-20 and pinned in site-datasheets/counts.json
  • 11output/review_checks.md CHK-001; output/form_1065_preview.json
  • 12output/review_checks.md (Overall status: READY)
  • 13output/section704c_summary.md; README §704(c) section
  • 14output/section704c_summary.md
  • 15partnership_tax/section704c.py module docstring ('LIMITATION (documented on purpose)'); output/section704c_summary.md method-limitation note
  • 16partnership_tax/section704c.py (ceiling_binding / ceiling_shortfall); README §704(c) section
  • 17partnership_tax/cli.py main() (return 0 if package.ready else 2); README Controls; partnership_tax/generate.py (ein='00-0000000', synthetic names)

Show us where the hours go.

One conversation: you describe the work that consumes your team's month; we tell you plainly what this engine can take over, what it can't, and what a scoped first phase would cost. Your people keep approval authority.

Book a free consultation