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.2.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.2-py2.py3-none-any.whl (14.8 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for repr_soso-1.0.2.tar.gz
Algorithm Hash digest
SHA256 04a4d37dcfab01ce1dbde4911c73fb4da83ac4f8fd647c9e21ccfac2b62a2ba3
MD5 a3a6dbc0bfad23473028343bea6667eb
BLAKE2b-256 b2ea8ad4f8c29633fee528b43ddee3af36fd01070405c36d1c5aa21c5ae272e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: repr_soso-1.0.2-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.2.0 CPython/3.14.4

File hashes

Hashes for repr_soso-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 82688432317e39967a4ec66c2f9aadd7b56ca20742c43f674891681862f4ed1f
MD5 43501075eccba7af5424016a12b030a6
BLAKE2b-256 f2cccb431620638f5fcdc255bc2df42a22e8fcc1fcf598827ec402881a2ca8c3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 files

1.0.1

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