msdparser


Namemsdparser JSON
Version 2.0.0 PyPI version JSON
download
home_pagehttp://github.com/garcia/msdparser
SummaryRobust & lightning fast MSD parser (StepMania file format)
upload_time2022-07-23 22:54:12
maintainer
docs_urlNone
authorAsh Garcia
requires_python>=3.6
licenseMIT
keywords stepmania simfile sm ssc dwi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # msdparser

A robust & lightning fast MSD parser for Python.
MSD is the underlying file format
for the SM and SSC simfile formats used by StepMania,
as well as a few older formats like DWI.

Full documentation can be found on **[Read the Docs](https://msdparser.readthedocs.io/en/latest/)**.

## Features

- Speed-optimized lexer & low-overhead parser
- Support for escape sequences by default
- Strict & lenient parse modes

## Installation

`msdparser` is available on PyPI:

```sh
pip install msdparser
```

## Quickstart

`parse_msd` takes a **named** _file_ or _string_ argument and yields `MSDParameter` instances:

```python
>>> msd_data = """
... #VERSION:0.83;
... #TITLE:Springtime;
... #SUBTITLE:;
... #ARTIST:Kommisar;
... """
>>> from msdparser import parse_msd
>>> for param in parse_msd(string=msd_data):
...         print(
...             "key=" + repr(param.key),
...             "value=" + repr(param.value),
...         )
...
key='VERSION' value='0.83'
key='TITLE' value='Springtime'
key='SUBTITLE' value=''
key='ARTIST' value='Kommisar'
```

`MSDParameter` instances stringify back to MSD.
They can be created from a sequence of strings,
typically the key and value:

```python
>>> from msdparser import MSDParameter
>>> pairs = [('TITLE', 'Springtime'), ('ARTIST', 'Kommisar')]
>>> for key, value in pairs:
...     print(str(MSDParameter([key, value])))
...
#TITLE:Springtime;
#ARTIST:Kommisar;
```

Prefer to use `MSDParameter`
over interpolating the key/value pairs
between `#:;` characters yourself.
The `str()` implementation inserts escape sequences where required,
preventing generation of invalid MSD.

## Developing

**msdparser** 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



            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/garcia/msdparser",
    "name": "msdparser",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "stepmania simfile sm ssc dwi",
    "author": "Ash Garcia",
    "author_email": "python-msdparser@garcia.sh",
    "download_url": "https://files.pythonhosted.org/packages/5e/a0/554a03cedc509c00440897c4e9e668c23f3970db9a79b66123212eab336c/msdparser-2.0.0.tar.gz",
    "platform": null,
    "description": "# msdparser\n\nA robust & lightning fast MSD parser for Python.\nMSD is the underlying file format\nfor the SM and SSC simfile formats used by StepMania,\nas well as a few older formats like DWI.\n\nFull documentation can be found on **[Read the Docs](https://msdparser.readthedocs.io/en/latest/)**.\n\n## Features\n\n- Speed-optimized lexer & low-overhead parser\n- Support for escape sequences by default\n- Strict & lenient parse modes\n\n## Installation\n\n`msdparser` is available on PyPI:\n\n```sh\npip install msdparser\n```\n\n## Quickstart\n\n`parse_msd` takes a **named** _file_ or _string_ argument and yields `MSDParameter` instances:\n\n```python\n>>> msd_data = \"\"\"\n... #VERSION:0.83;\n... #TITLE:Springtime;\n... #SUBTITLE:;\n... #ARTIST:Kommisar;\n... \"\"\"\n>>> from msdparser import parse_msd\n>>> for param in parse_msd(string=msd_data):\n...         print(\n...             \"key=\" + repr(param.key),\n...             \"value=\" + repr(param.value),\n...         )\n...\nkey='VERSION' value='0.83'\nkey='TITLE' value='Springtime'\nkey='SUBTITLE' value=''\nkey='ARTIST' value='Kommisar'\n```\n\n`MSDParameter` instances stringify back to MSD.\nThey can be created from a sequence of strings,\ntypically the key and value:\n\n```python\n>>> from msdparser import MSDParameter\n>>> pairs = [('TITLE', 'Springtime'), ('ARTIST', 'Kommisar')]\n>>> for key, value in pairs:\n...     print(str(MSDParameter([key, value])))\n...\n#TITLE:Springtime;\n#ARTIST:Kommisar;\n```\n\nPrefer to use `MSDParameter`\nover interpolating the key/value pairs\nbetween `#:;` characters yourself.\nThe `str()` implementation inserts escape sequences where required,\npreventing generation of invalid MSD.\n\n## Developing\n\n**msdparser** uses Pipenv for dependency management. Activate the environment:\n\n    pipenv shell\n\nTo run the unit tests:\n\n    py -m unittest\n\nTo build the documentation:\n\n    docs/make html\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Robust & lightning fast MSD parser (StepMania file format)",
    "version": "2.0.0",
    "project_urls": {
        "Homepage": "http://github.com/garcia/msdparser"
    },
    "split_keywords": [
        "stepmania",
        "simfile",
        "sm",
        "ssc",
        "dwi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a784df3deda184b573055ac6ba4a7a8fa4084844d4f98b42550f3673550baff",
                "md5": "f9c3f15edc5782da723a60ee342b20ad",
                "sha256": "bbef8c89b2dc16183ba714354b093fff11a43469971c42972284c5046826002d"
            },
            "downloads": -1,
            "filename": "msdparser-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f9c3f15edc5782da723a60ee342b20ad",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8949,
            "upload_time": "2022-07-23T22:54:11",
            "upload_time_iso_8601": "2022-07-23T22:54:11.199070Z",
            "url": "https://files.pythonhosted.org/packages/4a/78/4df3deda184b573055ac6ba4a7a8fa4084844d4f98b42550f3673550baff/msdparser-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ea0554a03cedc509c00440897c4e9e668c23f3970db9a79b66123212eab336c",
                "md5": "ba834bee0a5d06c59dd5c0da3d03220e",
                "sha256": "9bb6cf4b705c76850b1ce22823c768b62ba2bb63d1c2407bbe3e2c23e38be8e3"
            },
            "downloads": -1,
            "filename": "msdparser-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ba834bee0a5d06c59dd5c0da3d03220e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6792,
            "upload_time": "2022-07-23T22:54:12",
            "upload_time_iso_8601": "2022-07-23T22:54:12.663244Z",
            "url": "https://files.pythonhosted.org/packages/5e/a0/554a03cedc509c00440897c4e9e668c23f3970db9a79b66123212eab336c/msdparser-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-07-23 22:54:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "garcia",
    "github_project": "msdparser",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "msdparser"
}
        
Elapsed time: 0.12827s