Setup.cfg File Handling

Some of our hooks need to read and/or modify contents of setup.cfg; this module provides the utility to do so easily.

class hooks.utils.setup_file.SetupFile(path: str)

Setup file object to include custom functionality within our hooks specific to a setup.cfg file.

add_mypy_ignore(bad_imports)

Adds new content to silence mypy bad import errors.

add_pylint_ignore(bad_imports)

Adds new content to silece pylint bad import errors.

property lines: List[str]

Returns the contents of this setup file, line by line.

property package_name: str

Returns the name of the package this setup file refers to.

This is extracted from the name = <package_name line of the file.

save_to_disk() None

Saves the (updated) contents of this config file back to disk.