Skip to main content

A deliberately complicated and inefficient file format alternative to JSON

Project description

FAC Format - A Deliberately Complicated File Format

FAC (Frustratingly Awful Configuration) is an intentionally complicated and inefficient alternative to JSON. It's designed to be hard to read, write, and parse - because sometimes we need to appreciate how good we have it with JSON!

Features

  • ❌ Not human-readable (by design!)
  • ❌ Unnecessarily complex syntax
  • ❌ Deliberately verbose
  • ✅ Python parser included
  • ✅ Converts to/from Python dictionaries

Installation

pip install fac-format

Usage

Writing FAC Files

from fac_parser import FacWriter

data = {
    "name": "John Doe",
    "age": 30,
    "hobbies": ["reading", "coding"]
}

writer = FacWriter()
fac_content = writer.write(data)

with open('output.fac', 'w') as f:
    f.write(fac_content)

Reading FAC Files

from fac_parser import FacParser

with open('input.fac', 'r') as f:
    content = f.read()

parser = FacParser()
data = parser.parse(content)

File Format Specification

FAC uses a unique and deliberately complicated syntax:

  1. Files must start with @begin/format@ and end with @end/format@
  2. Comments use \note prefix
  3. Values are declared using:
    @value|key_name
    /content\|type|value
    
  4. Lists are declared using:
    @list|list_name
    |item\value1
    |item\value2
    /end\list
    
  5. Objects are declared using:
    @object|object_name
    @value|nested_key
    /content\|type|value
    /end\object
    

Data Types

  • Text: |text|value
  • Numbers: |number|value
  • Booleans: |boolean|true or |boolean|false

Example FAC File

@begin/format@
\note this is a sample FAC file

@value|name
/content\|text|John Doe

@value|age
/content\|number|30

@list|hobbies
|item\reading
|item\coding
/end\list

@object|address
@value|street
/content\|text|123 Main St
/end\object
@end/format@

Why Use FAC?

You probably shouldn't! This format was created as a demonstration of how not to design a data format. It serves as an educational tool to appreciate the elegance and simplicity of formats like JSON, YAML, and TOML.

Contributing

If you want to make FAC even worse (or better at being worse), feel free to contribute! Just remember: the more complicated and frustrating, the better.

License

MIT License - Because even bad ideas should be free to share!

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

fac_format-0.1.0.tar.gz (10.2 MB view details)

Uploaded Source

Built Distribution

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

fac_format-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file fac_format-0.1.0.tar.gz.

File metadata

  • Download URL: fac_format-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for fac_format-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4f66be9a1c8193dddb004a1ae7ee65168c220937ef3f0a265e67562103b6c114
MD5 a766d9c22394f7f26d58ad76601fb718
BLAKE2b-256 722964957e5314f067cf5fb6c7f1a785c6e7c3626070b1a9d00107dcafcb9805

See more details on using hashes here.

File details

Details for the file fac_format-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fac_format-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for fac_format-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04945874177ad97c222070482207ef0b1b80964477580607fc8f56350e2446fe
MD5 704b4eaf2389bc6cd5bda8b0e4f4c192
BLAKE2b-256 f73a248d422e048c2d897d591b3547fb051370a61d2799461bd414d58fc8ffe7

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