Skip to main content

Modern simfile library for Python

Project description

simfile - for Python 3

A modern simfile parsing & editing library for Python 3.

Full documentation can be found on Read the Docs.

Features

Installation

simfile is available on PyPI:

pip3 install simfile

Quickstart

Load simfiles from disk using simfile.open or simfile.load:

>>> import simfile
>>> springtime = simfile.open('testdata/Springtime/Springtime.ssc')
>>> springtime
<SSCSimfile: Springtime>
>>> with open('testdata/nekonabe/nekonabe.sm', 'r') as infile:
...     nekonabe = simfile.load(infile)
...
>>> nekonabe
<SMSimfile: 猫鍋>

Use lowercase attributes to access most common properties:

>>> springtime.artist
'Kommisar'
>>> springtime.banner
'springbn.png'
>>> springtime.subtitle = '(edited)'
>>> springtime
<SSCSimfile: Springtime (edited)>

Alternatively, use uppercase strings to access the underlying dictionary:

>>> springtime['ARTIST']
'Kommisar'
>>> springtime['ARTIST'] is springtime.artist
True
>>> list(springtime.keys())[:7]
['VERSION', 'TITLE', 'SUBTITLE', 'ARTIST', 'TITLETRANSLIT', 'SUBTITLETRANSLIT', 'ARTISTTRANSLIT']

Charts are stored in a list under the .charts attribute and function similarly to simfile objects:

>>> len(springtime.charts)
9
>>> chart = springtime.charts[0]
>>> chart
<SSCChart: dance-single Challenge 12>
>>> list(chart.keys())[:7]
['CHARTNAME', 'STEPSTYPE', 'DESCRIPTION', 'CHARTSTYLE', 'DIFFICULTY', 'METER', 'RADARVALUES']

Developing

simfile uses Pipenv for dependency management. Activate the environment:

pipenv shell

To run the unit tests:

py -m unittest

To build the documentation:

docs/make html

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

simfile-2.1.1.tar.gz (33.8 kB view hashes)

Uploaded Source

Built Distribution

simfile-2.1.1-py3-none-any.whl (42.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page