A mathematically explicit Python foundation for fuzzy sets, membership functions, linguistic models, and compatibility-safe modernization.
FuzzyRoutines 2.0 combines a modern typed API with the protected historical API. See the current implementation boundary.
At a glance
| Area | Current contract |
|---|---|
| Runtime | CPython 3.13 and 3.14 |
| Package version | 2.0.0 |
| Modern API | Root exports from fuzzyroutines |
| Compatibility API | fuzzyroutines.FuzzyRoutines preserves the ADR-protected contract and documents the wider observed 1.0.3 facade |
| API reference | Published English reference built from the installed package |
| License | Apache License 2.0 with attribution details in NOTICE |
FuzzyRoutines targets scientific-grade behavior within fuzzy computing: explicit domains, traceable formulas, analytical results where practical, controlled numerical methods elsewhere, and executable evidence for important boundaries and invariants. It is a focused library, not a computer-algebra system or notebook environment.
Start with the canonical mathematical model for the integrated definitions, formulas, compatibility spellings, and explicit implemented-versus-roadmap boundary.
Install
Use CPython 3.13 or 3.14:
python -m pip install fuzzyroutines==2.0.0
Historical 1.x packages do not provide the modern API shown below. For a source checkout, see Development.
The quick start explains installation
and classifies a 24 °C measurement.
Explore nine worked scenarios, with
independent numerical checks and eleven reproducible scientific figures, or
reconstruct the historical Universal Fuzzy Scale, or
browse the membership gallery.
The computation diagrams explain the
different workflows; the public example index
links all 193 inventoried public symbols to executed examples.
From a checkout with the package installed, python -I examples/guide.py runs
every scenario without NumPy, Matplotlib, network access, or file creation.
Choose the API surface
| Surface | Use it for | Start here |
|---|---|---|
| Modern typed API | New code with explicit universes, policies, and evidence strength | Modern API inventory |
| Historical compatibility | Existing software written against the 1.0.3-style facade | Protected and observed surfaces |
| Migration boundary | Moving one supported scenario at a time | Canonical migration guide |
Modern example
from fuzzyroutines import ContinuousUniverse, DeriveProperties, ScalarFuzzySet, Triangle
universe = ContinuousUniverse(0.0, 1.0, leftClosed=True, rightClosed=True)
membership = Triangle(left=0.0, peak=0.5, right=1.0)
fuzzySet = ScalarFuzzySet(universe, membership)
properties = DeriveProperties(membership, universe)
assert fuzzySet.Membership(0.5) == 1.0
assert properties.core.Contains(0.5)
assert properties.height == 1.0
A declared ContinuousUniverse
is part of fuzzy-set identity. An
IntegrationDomain is only
a finite interval used by a numerical method; it is never mathematical
support.
Historical compatibility example
from fuzzyroutines.FuzzyRoutines import FuzzySet, MFunction, TNorm
membership = MFunction("triangle", a=0.0, b=1.0, c=0.5)
fuzzySet = FuzzySet(
membership,
supportSet=(0.0, 1.0),
linguisticName="Medium",
)
print(TNorm(0.4, 0.7, normType="algebraic"))
print(fuzzySet.Defuz())
The legacy triangle order is a, b, c, where c is the apex. Protected
names and corrected historical defects are tracked in the
compatibility ledger.
Core contracts
| Concept | Mathematical contract | Architecture decision |
|---|---|---|
| Membership functions | Families, formulas, and parameter domains | ADR-0003 |
| Universes and support | Universe, support, core, boundary, and height | ADR-0002 |
| Negations and scalar norms | Formula and algorithm invariants | ADR-0004 |
| Fuzzy-set operations | Complement, intersection, union, and difference | ADR-0008 |
| Alpha-cuts | Exact and sampled alpha-cut evidence | Universe semantics |
| Height and normalization | Exact evidence and fail-closed normalization | Numerical policy |
| Equality and inclusion | Explicit comparison domains and policies | Modern domain boundary |
| Linguistic terms and scales | Immutable typed representation | Roadmap boundary |
Documentation map
| Need | Canonical source |
|---|---|
| What exists now | Current implementation status |
| Audited contracts and release limits | Project readiness audit |
| Public symbols | Public API inventory |
| Static types and custom callbacks | Public modern typing |
| Mathematical definitions | docs/mathematics |
| Compatibility and migration | Canonical guide · Corrected-bug ledger |
| Release changes and version decision | Development changelog · 1.0.3 migration · Version rationale |
| Benchmarks and performance claims | Results · Protocol |
| Tests, tools, examples, and artifacts | Executable documentation |
| Contribution and evidence rules | Development evidence protocol · Python style |
| Optional vectorization strategy | ADR-0015 · Scalar/array evidence |
| API documentation architecture | ADR-0010 · Reproducible build |
Development
For an editable source checkout:
git clone --branch master https://github.com/Fuzzy-Technologies/FuzzyRoutines.git
cd FuzzyRoutines
python -m pip install -e .
python -m pip install -r requirements.txt
python -m pytest -q tests/test_membership_function_contracts.py
python -m ruff check fuzzyroutines/membership.py
Choose the tests and lint paths for the files and contracts being changed. PR CI runs the complete deterministic suite, typing, documentation builds, and package installation gates. Full local regression and build runs are reserved for an explicit maintainer request.
The canonical full-suite runner, python -m tools.test_runner, discovers the complete suite, uses independent
pytest-xdist worker processes by default, caps automatic parallelism at
12, and moves tests marked serial into a separate sequential phase. Use
--jobs N, --timeout N, --serial, or --fail-fast for an explicit run.
It never retries failures automatically.
The project intentionally does not use ruff format. Markdown tables are
source-aligned and checked automatically. Generated API HTML is disposable
output under _build/api-reference/; annotations, English Google-style
Markdown docstrings, and tracked Markdown remain the sources of truth.
Roadmap boundary
The current typed surface already includes explicit scalar universes, immutable
fuzzy sets, operations, derived properties, alpha-cuts, comparison policies,
and linguistic representations. Inline modern annotations, py.typed, strict
source checks, and installed-wheel consumer checks are implemented; see the
typing contract. Symmetric difference, executable
convexity, defuzzification methods beyond the implemented centroid contract,
vectorized backends, and free-threaded CPython support remain roadmap work.
Performance and concurrency claims require numerical-parity,
timing, memory, and race-safety evidence.
The generated reference is composed with the
FuzzyRoutines GitHub Pages site.
Pull requests and develop produce preview artifacts; production deployment
occurs only from the approved master branch. Stable routes separate the
moving references in English, Russian and Simplified Chinese. The version index
links to tagged sources for historical versions. Separately hosted documentation
snapshots for individual releases are not currently provided.
License
Source code, tests, documentation, examples, tools, workflows, and project-owned site assets are licensed under the Apache License 2.0. Redistributions must preserve the license, copyright, and attribution notices, including NOTICE.
The license does not grant permission to use Fuzzy Technologies trade names or marks beyond reasonable attribution and the NOTICE requirements. See the licensing and provenance policy.
Metadata
Release files for fuzzyroutines 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fuzzyroutines-2.0.0.tar.gz | 176.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fuzzyroutines-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 243.0 kB
Release files / fuzzyroutines-2.0.0.tar.gz
| Download URL | fuzzyroutines-2.0.0.tar.gz |
|---|---|
| Size | 176.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6056850e0d6798d43e35c3119d55afd33ab7f7d5f8550f80fd51fe184ca15cf9
|
|
BLAKE2b-256 checksum How to use checksums |
1bb8de69002fd900c49b7cf964592d1e49bb9ba805c7f46633856f42d2ec0f36
|
| 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 Oct 10, 2026.
Transparency logRelease files / fuzzyroutines-2.0.0-py3-none-any.whl
| Download URL | fuzzyroutines-2.0.0-py3-none-any.whl |
|---|---|
| Size | 66.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
501eefd15cefdbb137ad05f2887cb63d662b0f574c64a818ccb6675b2138a2c4
|
|
BLAKE2b-256 checksum How to use checksums |
4924dd8ad847925adfeafb3c57333d906e8a13a0f44b5f7b2aa84807b6182fb4
|
| 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 Oct 10, 2026.
Transparency log