Skip to main content

repr_soso

Prints an object all spread out and indented.

Takes an object like this:

{'format': 2, 'versions': ['ARIA', 'Cakewalk', 'LinuxSampler', 'SFZ v1', 'SFZ v2', 'sfizz'], 'headers': [{'name': 'region', 'short_description': 'The basic component of an instrument. An instrument is defined by one or more regions.', 'version': 'SFZ v1'}, {'name': 'group', 'short_description': 'Multiple regions can be arranged...

... and formats it like this:

{
	"format"	: 2,
	"versions"	: [
		'ARIA',
		'Cakewalk',
		'LinuxSampler',
		'SFZ v1',
		'SFZ v2',
		'sfizz'
	],
	"headers"	: [
		{
			"name"				: 'region',
			"short_description"	: 'The basic component of an instrument. An instrument is defined by one or more regions.',
			"version"			: 'SFZ v1'
		},
		{
			"name"				: 'group',
			"short_description"	: 'Multiple regions can be arranged in a group. Groups allow entering common parameters for multiple regions.',
			"version"			: 'SFZ v1'
		},
		...

Goal

My purpose in creating this was to use it to produce good-looking code which can be placed in the source file of another project (sfzen). I had an expensive operation, building up a large dictionary which never changes. Instead of performing it on every invocation, it made sense to just include the definition in the source. Using repr_soso, I wrote the dictionary directly to a file with a .py extension.

Usage:

from repr_soso import Repr
repr = Repr(big_dictionary)
repr.print()

... or ...

repr(big_dictionary).print()

Speed

This package differs from "rich", which already does this, by doing only one thing, and doing it fast. Testing with a large dictionary produced the following:

rich:       2.1802 seconds
repr_soso:  0.1395 seconds

YMMV.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repr_soso-1.0.1.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

repr_soso-1.0.1-py2.py3-none-any.whl (14.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file repr_soso-1.0.1.tar.gz.

File metadata

  • Download URL: repr_soso-1.0.1.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for repr_soso-1.0.1.tar.gz
Algorithm Hash digest
SHA256 75f9c8f6723a3a8e01e03d223745958913412772b47a2496ef04d189bb16a804
MD5 ae36f21adb8743d55850085062276e8e
BLAKE2b-256 90b7567d8a95a8a11ca5ead31e490f8c41e549e08bba53e4e44030c4354f4339

See more details on using hashes here.

File details

Details for the file repr_soso-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: repr_soso-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for repr_soso-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d660d1bc34b04891f7ac5fd847bd4163c9c6f8aaae6672668258623d5ecf8c3f
MD5 193368a94473c3966a1b84be598849cd
BLAKE2b-256 56dd77ae65548484e20c3282b939611e7f3c55775a209c44a3428aa65c346930

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.2

2 files

This release

1.0.1 This release

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page