{"id":3287,"library":"svgwrite","title":"SVGWrite","description":"SVGWrite is a Python library for programmatically creating SVG (Scalable Vector Graphics) drawings. It enables developers to generate vector graphic shapes, text, and images as XML files. The library is currently in maintenance mode (version 1.4.3, last updated July 14, 2022), meaning it receives bug fixes but no new feature development. It focuses solely on writing SVG files and does not support reading or modifying existing SVG documents, though it can embed other SVGs as images.","status":"maintenance","version":"1.4.3","language":"en","source_language":"en","source_url":"https://github.com/mozman/svgwrite.git","tags":["SVG","graphics","vector graphics","drawing","XML"],"install":[{"cmd":"pip install svgwrite","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"Drawing","correct":"import svgwrite\ndwg = svgwrite.Drawing('output.svg', profile='tiny')"},{"symbol":"rgb","correct":"import svgwrite\ncolor = svgwrite.rgb(10, 10, 16, '%')"}],"quickstart":{"code":"import svgwrite\n\ndef create_simple_svg(filename='test.svg'):\n    dwg = svgwrite.Drawing(filename, profile='tiny', size=('200px', '100px'))\n\n    # Add a line\n    dwg.add(dwg.line((0, 0), (100, 50), stroke=svgwrite.rgb(10, 10, 16, '%')))\n\n    # Add text\n    text_element = dwg.text('Hello svgwrite!', insert=(10, 70), fill='red')\n    text_element.set_font_size('20px')\n    dwg.add(text_element)\n\n    dwg.save()\n    print(f\"SVG saved to {filename}\")\n\nif __name__ == '__main__':\n    create_simple_svg()","lang":"python","description":"This example creates a simple SVG file named 'test.svg' with a line and some red text. It demonstrates the basic steps of initializing a `Drawing` object, adding elements like `line` and `text`, and saving the output."},"warnings":[{"fix":"Ensure your project runs on Python 3.6 or newer. For older Python 3 versions, upgrade your environment. For Python 2, consider an older svgwrite version (e.g., <1.4) or migrating to Python 3.","message":"Python 2 support was officially dropped in version 1.4. Projects using older Python versions must upgrade to Python 3.6+ to use svgwrite 1.4 and later.","severity":"breaking","affected_versions":">=1.4"},{"fix":"If you need to read or modify existing SVG files, consider using a different library like `lxml` to parse the XML structure, or a dedicated SVG manipulation library.","message":"The library is exclusively for *writing* SVG files. It does not provide functionality to read, parse, or modify existing SVG documents. While you can include other SVGs using the <image> entity, direct manipulation is not supported.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Only enable `debug=True` during development for error detection. Remove or set `debug=False` for production builds to maintain performance.","message":"Using `svgwrite.Drawing(debug=True)` should be strictly avoided in production environments. The validation algorithm, while useful for development, is unoptimized and can significantly degrade performance for larger SVG files.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware that new features or significant API changes are unlikely. Plan your usage around the existing feature set and consider community forks or alternatives if advanced features or active development are critical.","message":"The package is in 'maintenance mode' (also described as 'inactive'). This means no new features will be added, and only critical bug fixes will be merged. The project maintains an infrequent release cadence for fixes.","severity":"gotcha","affected_versions":">=1.4.1"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}