Skip to main content

Volund's MudString library for Python

CONTACT INFO

Name: Volund

Email: volundmush@gmail.com

PayPal: volundmush@gmail.com

Discord: Volund#1206

Discord Channel: https://discord.gg/Sxuz3QNU8U

Patreon: https://www.patreon.com/volund

Home Repository: https://github.com/volundmush/mudstring-python

TERMS AND CONDITIONS

MIT license. In short: go nuts, but give credit where credit is due.

Please see the included LICENSE.txt for the legalese.

INTRO

MUD (Multi-User Dungeon) games and their brethren like MUSH, MUX, MUCK, and MOO (look 'em up!) use various ANSI features to provide colors to clients. Sadly there aren't many libraries out there which allow advanced manipulation of such text which preserve the formatting already applied to it. This attempts to address this problem.

mudstring is built upon the existing library, rich, using monkey-patching to hack in support for MXP (Mud eXtension Protocol). So, in order to use this library effectively, one must familiarize themselves with Rich. Rich is awesome, so be sure and do that soon.

FEATURES

  • Everything Rich can do. Seriously, check it out...
  • MXP Support.
  • Encodings library, containing fully-working examples for how to implement various ANSI systems used by existing games.

OKAY, BUT HOW DO I USE IT?

Glad you asked.

Early on in your program, you should...

import mudstring
mudstring.install()

This will monkey-patch Rich for this process, replacing a few classes with ones from MudString in a way that will still allow Rich to do everything it normally does. From here on out, though, importing from Rich will net you the patched versions of classes like Style, Text, and Console.

Afterwards, instantiating a MudConsole and directing some output to an output buffer is this easy.

# this will get the MudCOnsole and MudText if install() has been run!
from rich import Console
from rich.text import Text
from mudstring.util import OutBuffer

buffer = bytearray()

out = OutBuffer(buffer)

con = Console(color_system="256", mxp=True, soft_wrap=True, file=out)

con.print(Text("Have some red text!", style="red"))

Afterwards, buffer will contain the formatted red text.

Note that MudString's Text class for Rich implements a great deal more of the Python String API than Rich's original version, allowing for advanced text formatting - though, unfortunately, no f-strings or str.format() - it won't preserve the styling...

FAQ

Q: This is cool! How can I help?
A: Patreon support is always welcome. If you can code and have cool ideas or bug fixes, feel free to fork, edit, and pull request! Join our discord to really get cranking away though.

Q: I found a bug! What do I do?
A: Post it on this GitHub's Issues tracker. I'll see what I can do when I have time. ... or you can try to fix it yourself and submit a Pull Request. That's cool too.

Q: But... I want a MUD! Where do I start making a MUD?
A: check out pymush and athanor

Special Thanks

  • The absolutely awesome lunatics who wrote PennMUSH's ANSI library.
  • The Evennia Project.
  • All of my Patrons on Patreon.
  • Anyone who contributes to this project or my other ones.
  • The Rich devs. That library is a godsend.

Metadata

Release files for mudstring 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mudstring 0.5.0
File Size Uploaded Provenance
mudstring-0.5.0.tar.gz 5.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mudstring 0.5.0
File Interpreter ABI Platform
mudstring-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.0 kB

Release files / mudstring-0.5.0.tar.gz

Download URL mudstring-0.5.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c2a7aba6287fa2cfed359ccc0c0a5113972a8f80c776c59fdc2fc15daafe8671
BLAKE2b-256 checksum
How to use checksums
da98dec8a0a269694256f966d7d469805bbbb24e08a8d1289d42f0f429ec1486
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Release files / mudstring-0.5.0-py3-none-any.whl

Download URL mudstring-0.5.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
310a044b063b124593fe69aa436a994d902ae990fa2d64172b4816c3effaa781
BLAKE2b-256 checksum
How to use checksums
86f5c1666059a10acde2ec56c914acea176d5d355dc7f521b0ef2dfb61fce08a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Security for mudstring 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

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