Functional Weave
Code in Python

property.holding-deposit-cap

Maximum holding deposit to reserve a rental property: one week's rent (annual rent ÷ 52), rounded down.

1.0.0 (not the latest) · published 2026-10-03 by charlie · Anterra

Pinned by 11 tests, run in TypeScript, Python and Rust.

Not professional advice. This capability calculates property figures from published rules. It is a software component for developers, not legal or financial advice. Rules change and every rate here has an effective date. Check that the dates cover your case. Verify results against the official sources listed in its README, and have a conveyancer or tax adviser review how you use it, before anyone relies on the output. Provided “as is” under its licence, without warranty.

What it does

The most a landlord or letting agent may take as a holding deposit to take a property off the market while references are checked: one week's rent.

One week's rent is the annual rent divided by 52, and annual rent is weekly rent × 52, monthly rent × 12, or the annual rent itself. £1,000 a month is £12,000 a year, so the cap is £230.76 (£230.769… rounded down). A weekly rent is its own cap exactly.

For example

  • holding_deposit_cap(£1,000.00, monthly) → £230.76 £1,000 a month: £230.76, rounded down from £230.769
  • holding_deposit_cap(£240.00, weekly) → £240.00 £240 a week (the guidance's example): exactly £240
  • holding_deposit_cap(£1,300.00, monthly) → £300.00 £1,300 a month is exactly £300 a week

The function

The same function in TypeScript, Python and Rust, pinned by the same tests. Pick your language; the choice follows you around the registry.

def holding_deposit_cap(rent: Money, rent_period: RentPeriod) -> Money
rentMoneythe total rent for the property (all joint tenants together), in GBP, zero or more
rent_periodRentPeriodwhat one payment of rent covers
returnsMoneyone week's rent: annual rent ÷ 52, rounded down to the penny

Your code names it in one line, in the file that uses it

from fune.property.holding_deposit_cap import holding_deposit_cap  # property.holding-deposit-cap@^1
impl/python.py · 25 lines · open · raw

Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.

from .money_amount import Money, money  ← from money.amount ^1.0.0 · built alongside by fune
from .property_deposit_cap import RentPeriod  ← from property.deposit-cap ^1.0.0 · built alongside by fune

# Keeps annual rent exact as a JavaScript number; the same limit here.
_MAX_MINOR = 1_000_000_000_000


def holding_deposit_cap(rent: Money, rent_period: RentPeriod) -> Money:
    """One week's rent, the statutory maximum holding deposit: the annual rent
    divided by 52, rounded down once so the deposit can never exceed the cap."""
    if rent.currency != "GBP":
        raise ValueError("rent must be in GBP, received %s" % (rent.currency,))
    if rent.minor < 0:
        raise ValueError("rent must not be negative, received %r" % (rent.minor,))
    if rent_period == "weekly":
        annual = rent.minor * 52
    elif rent_period == "monthly":
        annual = rent.minor * 12
    elif rent_period == "annual":
        annual = rent.minor
    else:
        raise ValueError('unknown rent period "%s"' % (rent_period,))
    if annual > _MAX_MINOR:
        raise ValueError("annual rent must be at most %d minor units" % (_MAX_MINOR,))
    return money(annual // 52, "GBP")

Install

fune build

With that line in your source, in a Python project (language python in fune.project), fune build resolves it and its 2 dependencies, pins them in fune.lock, downloads only the Python package of each, and builds the code above into your project’s .fune/build, one readable file per capability with a header linking back here. Or pin a range in fune.project and build in one step:

fune add property.holding-deposit-cap
Download for Python property.holding-deposit-cap-1.0.0-python.fune · 7,527 bytes sha256 8c8bc440f5ebe6932286af58f45bfc9d545e8ea35eb24cd65db3d46d808b5683

The manifest, vectors and README with only the Python implementation. Install it without the registry with fune add ./property.holding-deposit-cap-1.0.0-python.fune, or fetch it from a terminal with fune pull property.holding-deposit-cap@1.0.0:python.

The whole function, every language, is one file too: property.holding-deposit-cap-1.0.0.fune, 10,083 bytes, sha256 a1a3d163ad3c1f63cbe46f37fb76cd9f358f35aaf39b59a3da715de89a5f1f11. It installs into a project of any language.

Customise it in your app

The seams this capability offers. Put a marker directly above a function of your own and fune build wires it into the built code; the package on the registry is not changed, the built file’s header lists it under CUSTOMISED, and fune hooks lists every hook in the project. How hooks work.

before — your function gets the arguments and returns them, changed or not, or throws to refuse the call.

# fune: before property.holding-deposit-cap

after — your function gets the result and the arguments, and returns the final result.

# fune: after property.holding-deposit-cap

replace — inside this capability’s code only, calls to a dependency go to your function, with the same signature. Other capabilities that use it are unaffected; write in * to replace it everywhere.

# fune: replace money.amount in property.holding-deposit-cap
# fune: replace property.deposit-cap in property.holding-deposit-cap

step — your function runs at a numbered point inside the function’s body, receives the in-scope values it names as parameters, and may return replacements. List the points with fune show property.holding-deposit-cap --steps.

# fune: step property.holding-deposit-cap after <n|label>

Tests

A version published now needs at least 8 tests for every function, and one that expects the error for each function that throws; the registry refuses it otherwise. fune verify --all runs each case in TypeScript, Python and Rust, and a project runs them again with fune verify. This page lists the cases; it does not run them. The exact JSON is vectors.json.

CaseArgumentsExpected
£1,000 a month: £230.76, rounded down from £230.769 £1,000.00, monthly → £230.76
£240 a week (the guidance's example): exactly £240 £240.00, weekly → £240.00
£1,300 a month is exactly £300 a week £1,300.00, monthly → £300.00
£26,000 a year is exactly £500 a week £26,000.00, annual → £500.00
£25,999.99 a year rounds down to £499.99 £25,999.99, annual → £499.99
not a quarter of the monthly rent: £1,500 a month is £346.15, not £375 £1,500.00, monthly → £346.15
a penny a month rounds down to nothing £0.01, monthly → £0.00
zero rent £0.00, weekly → £0.00
rent in euros is refused €1,000.00, monthly → error: rent must be in GBP
negative rent is refused -£1.00, monthly → error: rent must not be negative
Show the other 1 test
CaseArgumentsExpected
an unknown rent period is refused £1,000.00, quarterly → error: unknown rent period

More from the author

## Why it is shaped this way

- **Rounded down, once.** Neither Act states a rounding rule; rounding up would put the deposit a fraction of a penny over the statutory maximum, so the only safe answer is down. - **Total rent, not per tenant.** For a joint tenancy the cap is one week of the rent the tenants are jointly liable for, and the guidance is explicit that a landlord cannot take a week's rent from each tenant. - **No date argument.** The cap has been one week's rent since it was introduced (England from 1 June 2019, Wales from 1 September 2019) and has not changed; the Renters' Rights Act 2025 left it as it was. If it ever changes, it becomes dated data in a new version. - The rent period type is `RentPeriod` from property.deposit-cap, so the two calculations accept the same inputs.

## What it does not do

It does not decide whether a holding deposit may be kept or must be repaid (the 15-day deadline for agreement and its exceptions), and it does not apply to Scotland, where holding deposits are treated differently.

## Sources

- Tenant Fees Act 2019, Schedule 1 paragraph 3 (holding deposit: at most one week's rent, being the annual rent divided by 52): https://www.legislation.gov.uk/ukpga/2019/4/schedule/1 - "Tenant Fees Act 2019: statutory guidance for enforcement authorities" (as amended by the Renters' Rights Act 2025; the joint-tenancy example, a weekly rent of £240 allows one £240 holding deposit in total): https://www.gov.uk/government/publications/tenant-fees-act-amended-by-the-renters-rights-act-2025/tenant-fees-act-2019-statutory-guidance-for-enforcement-authorities - Renting Homes (Fees etc.) (Wales) Act 2019, Schedule 2 (holding deposit of no more than one week's rent): https://www.legislation.gov.uk/anaw/2019/2/schedule/2

Files

PathBytes
README.md2,246
impl/python.py1,066
impl/rust.rs1,278
impl/typescript.ts1,150
vectors.json2,150