The main quickly module

The quickly module.

On first import, our own language definitions are added to the parce registry.

find(name=None, *, filename=None, mimetype=None, contents=None)[source]

Find a root lexicon, either by language name, or by filename, mimetype and/or contents.

If you specify a name, tries to find the language with that name, ignoring the other arguments.

If you don’t specify a name, but instead one or more of the other (keyword) arguments, tries to find the language based on filename, mimetype or contents.

If a language is found, returns the root lexicon. If no language could be found, None is returned (which can also be used as root lexicon, resulting in an empty token tree).


>>> import parce
>>> parce.find("xml")
>>> parce.find(contents='{"key": 123;}')
>>> parce.find(filename="style.css")

This function uses the registry module and by default it finds all bundled languages. See the module’s documentation to find out how to add your own languages to a registry.

load(filename, lexicon=True, encoding=None, errors=None, newline=None)[source]

Convenience function to read text from filename and return a parce.Document.

If lexicon is True, the lexicon will be guessed based on filename and contents. If it is a string name, its name is looked up in the registry; otherwise the lexicon is used directly.

The encoding, if specified, is used to read the file; otherwise the encoding is autodetected. The errors and newline arguments will be passed to Python’s open() function. Raises OSError if the file can’t be read.


The version as a three-tuple(major, minor, patch). See pkginfo.


The version as a string.