{"id":8399,"library":"paragraphs","title":"Paragraphs","description":"Paragraphs is a Python library designed to simplify the incorporation of long strings into Python code, making them more readable and maintainable. It provides a simple function to format multi-line strings, aiming to prevent common formatting issues that arise with extensive text blocks in code. The current version is 1.0.1, and its release cadence appears to be infrequent, with the last update in 2019.","status":"maintenance","version":"1.0.1","language":"en","source_language":"en","source_url":"https://github.com/ShayHill/paragraphs","tags":["text-formatting","strings","readability"],"install":[{"cmd":"pip install paragraphs","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The primary utility is the 'par' function, usually imported directly for conciseness.","wrong":"import paragraphs; paragraphs.par(...)","symbol":"par","correct":"from paragraphs import par"}],"quickstart":{"code":"from paragraphs import par\n\nlong_text = par(\n    \"\"\"\n    This is a very long string that needs to be incorporated\n    into Python code without looking messy. The 'paragraphs'\n    library helps format such text blocks beautifully, handling\n    line breaks and indentation consistently. It's especially\n    useful for error messages, documentation strings, or large\n    text data that needs to be easily editable and readable\n    within the code itself.\n    \"\"\"\n)\n\nprint(long_text)\n# Expected output will be the text, re-wrapped and dedented automatically by 'par'.\n# The exact wrapping depends on the internal logic of 'par'.\n\n# Example of usage within an exception message:\nclass CustomError(Exception):\n    def __init__(self, detail: str):\n        self.detail = detail\n\n    def __str__(self):\n        return par(\n            f\"\"\"\n            An error occurred: {self.detail}. This message is designed\n            to be human-readable and automatically formatted by 'par'.\n            The original issue was due to an unexpected input value.\n            Please review the input and try again.\n            \"\"\"\n        )\n\ntry:\n    raise CustomError(\"Invalid configuration file\")\nexcept CustomError as e:\n    print(e)","lang":"python","description":"The `par` function takes a multi-line string (often a triple-quoted string) and formats it, typically by dedenting and re-wrapping it to remove extraneous whitespace and improve readability. This is particularly useful for constructing human-readable messages or documentation within the code."},"warnings":[{"fix":"Ensure `paragraphs` matches your text processing needs. For semantic paragraph detection, try `to-paragraphs`. For Knuth-Plass line-breaking with PIL rendering, look at `pyparagraph`.","message":"The `paragraphs` library provides a single `par` function. Its main purpose is to dedent and wrap multiline strings. If you expect more advanced text processing, like natural language paragraph detection or rich text rendering, this is not the correct library; consider `to-paragraphs` or `pyparagraph` respectively.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For mission-critical projects or those requiring active maintenance, evaluate alternatives or consider vendoring the code if its current functionality suffices and no breaking changes are anticipated from Python updates.","message":"The library has not seen updates since 2019 (version 1.0.1). While its simple functionality might remain stable, active development and compatibility with newer Python features or more complex text formatting needs are not guaranteed.","severity":"deprecated","affected_versions":"<=1.0.1"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install the library using pip: `pip install paragraphs`.","cause":"The 'paragraphs' library has not been installed or is not accessible in the current Python environment.","error":"ModuleNotFoundError: No module named 'paragraphs'"},{"fix":"Change your import statement from `import paragraphs` to `from paragraphs import par`.","cause":"You are trying to access 'par' as an attribute of the 'paragraphs' module, but it should be imported directly.","error":"AttributeError: module 'paragraphs' has no attribute 'par'"}]}