Skip to content

Prepare public API

Jonathan Neuhauser requested to merge github/fork/Ede123/api into master

Created by: Ede123

This is meant to be a first step towards a public API (#119)

Functions that are intended to be exposed via this API are collected in __init__.py. The current list is

  • scour_string and scour_xml_file for the actual scouring
  • options() to create default options (or sanitize an arbitrary object that might have fitting attributes)
  • parse_args() in case someone prefers to create options from a string of command line arguments

With this Scour usage is as simple as

import scour

options = scour.options()
options.quiet = True

result = scour.scour_string("...", options)

I also added a __main__.py so execution of scour would be simply python -m scour instead of the redundant python -m scour.scour.

These changes also add an abstraction layer that should allow us to rename / move functions and split up source files (#103) in future without breaking compatibility.

Merge request reports

Loading