Skip to main content

Easily document cables and wiring harnesses

Project description

filare (formerly WireViz)

PyPI - Version PyPI - Python Version PyPI - Downloads Docs Code style: black

Summary

Filare (the new name for WireViz) is a tool for documenting cables, wiring harnesses and connector pinouts. It takes plain text, YAML-formatted files as input and produces graphical output (SVG, PNG, ...) via GraphViz. It handles automatic BOM (Bill of Materials) creation and a number of extras.

Features

  • Filare input files are fully text based
    • No special editor required
    • Human readable
    • Easy version control
    • YAML syntax
    • UTF-8 input and output files for special character support
  • Understands and uses color abbreviations as per IEC 60757 (black=BK, red=RD, ...)
  • Auto-generates standard wire color schemes and allows custom ones if needed
  • Understands wire gauge in mm² or AWG
    • Optionally auto-calculates equivalent gauge between mm² and AWG
  • Is suitable for both very simple cables, and more complex harnesses.
  • Allows for easy-autorouting for 1-to-1 wiring
  • Generates BOM (Bill of Materials)

Note: Filare is not designed to represent the complete wiring of a system. Its main aim is to document the construction of individual wires and harnesses.

Examples

Demo 01

Filare input file:

connectors:
  X1:
    type: D-Sub
    subtype: female
    pinlabels: [DCD, RX, TX, DTR, GND, DSR, RTS, CTS, RI]
  X2:
    type: Molex KK 254
    subtype: female
    pinlabels: [GND, RX, TX]

cables:
  W1:
    gauge: 0.25 mm2
    length: 0.2
    color_code: DIN
    wirecount: 3
    shield: true

connections:
  - - X1: [5, 2, 3]
    - W1: [1, 2, 3]
    - X2: [1, 3, 2]
  - - X1: 5
    - W1: s

Output file:

Sample output diagram

Bill of Materials (auto-generated)

Demo 02

Source - Bill of Materials

Syntax, tutorial and example gallery

Read the syntax description to learn about Filare's features and how to use them.

See the tutorial page for sample code, as well as the example gallery to see more of what Filare can do.

Installation

Requirements

Filare requires Python 3.9 or later.

Filare requires GraphViz to be installed in order to work. See the GraphViz download page for OS-specific instructions.

Note: Ubuntu 18.04 LTS users in particular may need to separately install Python 3.7 or above, as that comes with Python 3.6 as the included system Python install. The option to generate pdf is not supported for python 3.7, so it might not be possible to use with this version of Ubuntu. If you are forced to use Ubuntu 18.04 for some reason, fill up an issue/MR and I can provide a Docker image to perform the generation.

Container (Ubuntu 24.04, uv, graphviz, prettier)

A Docker image is provided to avoid local dependency setup:

docker build -t filare:latest .

Run common tasks (mount your working tree so outputs land on the host):

  • Build all examples/tutorials/demos:
    docker run --rm -v "$PWD":/app filare uv run --no-sync python src/filare/tools/build_examples.py
    
  • Build examples only:
    docker run --rm -v "$PWD":/app filare uv run --no-sync filare examples/ex*.yml -d examples/metadata.yml -f hs -o outputs/examples
    
  • Build tutorials only:
    docker run --rm -v "$PWD":/app filare uv run --no-sync filare tutorial/tutorial*.yml -d tutorial/metadata.yml -f hs -o outputs/tutorial
    
  • Lint (black + prettier):
    docker run --rm -v "$PWD":/app filare ./scripts/lint.sh
    
  • Build and serve docs (port 9000):
    docker run --rm -p 9000:9000 -v "$PWD":/app filare bash -lc 'cd /app && uv run --no-sync mkdocs build && cd site && python3 -m http.server 9000'
    

Building docs locally (without Docker)

From the project root:

uv run --no-sync mkdocs build
python3 -m http.server 9000 --directory site

Then open http://localhost:9000.

  • Run tests:
    docker run --rm -v "$PWD":/app filare uv run --no-sync pytest
    

Documentation (MkDocs + optional Sphinx)

  • Build MkDocs site locally:
    uv run --no-sync mkdocs build
    
  • Serve for preview:
    uv run --no-sync mkdocs serve -a 0.0.0.0:8000
    
  • (Optional) Generate API docs with Sphinx: see docs/mkdocs.md for suggested setup.

Debian Dependencies

sudo apt install graphviz

Fedora Dependencies

sudo dnf install graphviz

Pango (only for weasyprint pdf generation)

See https://pango.gnome.org/

Installing the latest release

The latest Filare release can be downloaded from PyPI with the following command:

pip3 install filare

Installing the development version

Access to the current state of the development branch can be gained by cloning the repo and installing manually.

We suggest always installing Filare within a python virtualenv. This avoids many issues caused by dependencies management.

Installing Filare within a virtual env

# Cloning the repository
git clone git+https://github.com/laurierloi/Filare
cd Filare

# Setup virtualenv
python3 -m pip install --user virtualenv
python3 -m virtualenv venv-filare
source venv-filare/bin/activate

# Installing/Upgrading dependencies
pip install -U pip setuptools wheel

# Installing with local modification tracking
pip install -e .

If you would like to contribute to this project, make sure you read the contribution guidelines!

Usage

How to run

The Filare CLI (legacy filare alias still available) creates harness documents. To do so, a shared metadata file (or multiple) must be provided to the filare command. Then, a list of harnesses to include within the document should also be provided. In the simplest case, 1 harness can be provided.

$ filare -d ~/path/to/file/metadata.yml ~/path/to/file/myharness1.yml ~/path/to/file/myharness2.yml

Depending on the options specified, this will output some or all of the following files:

titlepage.html            Titlepage document. It has links to the different harness for easy navigation
shared_bom.tsv            A BOM (bill of materials) for all items within the harness document
myharness{1,2}.gv         GraphViz output
myharness{1,2}.svg        Wiring diagram as vector image
myharness{1,2}.png        Wiring diagram as raster image
myharness{1,2}.bom.tsv    BOM (bill of materials) as tab-separated text file
myharness{1,2}.html       HTML page with wiring diagram and BOM embedded

Wildcars in the file path are also supported to process multiple files at once, e.g.:

$ filare ~/path/to/files/*.yml

To see how to specify the output formats, as well as additional options, run:

$ filare --help

Sample run all examples

$ filare -d examples/metadata.yml examples/ex*.yml

Then open examples/titlepage.html to open the document root

(Re-)Building the example projects

Please see the documentation of the build_examples.py script for info on building the demos, examples and tutorial.

Changelog

See CHANGELOG.md

Status

This is very much a work in progress. Source code, API, syntax and functionality may change wildly at any time.

License

GPL-3.0

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

filare-1.1.0.tar.gz (75.0 kB view details)

Uploaded Source

Built Distribution

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

filare-1.1.0-py3-none-any.whl (89.1 kB view details)

Uploaded Python 3

File details

Details for the file filare-1.1.0.tar.gz.

File metadata

  • Download URL: filare-1.1.0.tar.gz
  • Upload date:
  • Size: 75.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for filare-1.1.0.tar.gz
Algorithm Hash digest
SHA256 aa3662746033581d70e4465def2d761de101b2fa5e4d8f65acea46ba8b8db861
MD5 8e0e9c643884995c8871c88139872998
BLAKE2b-256 b6b6b19aa21570903a9662ba78a4253644257f89a77a635a6a2f5687f832b111

See more details on using hashes here.

File details

Details for the file filare-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: filare-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 89.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for filare-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db6afd93e6e82a0596b9cbf3ede2a10a0b09da5534955e4f60b455f32758f8c5
MD5 a66b9761233919c31d5fc7dcf896a6dc
BLAKE2b-256 1c157f3b9691afd92aa1231c3b20bea3f5fe877da9368e519022b640f6b62e52

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