{"id":28005,"library":"ocpsvg","title":"ocpsvg","description":"A Python library for parsing, manipulating, and rendering SVG (Scalable Vector Graphics) files with support for OCP (Open Canvas Protocol) extensions. Version 0.6.0, active development with no fixed release cadence.","status":"active","version":"0.6.0","language":"python","source_language":"en","source_url":"https://github.com/ocpng/ocpsvg","tags":["svg","vector-graphics","ocp","xml"],"install":[{"cmd":"pip install ocpsvg","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"XML parsing of SVG files","package":"lxml","optional":false},{"reason":"CSS selector support for element selection","package":"cssselect","optional":false}],"imports":[{"wrong":"from ocpsvg import SVG","symbol":"SVG","correct":"import ocpsvg"}],"quickstart":{"code":"from ocpsvg import SVG\n\n# Load an SVG file\nsvg = SVG.from_file('example.svg')\n\n# Access SVG elements (using CSS selectors)\nrect = svg.cssselect('rect')[0]\nprint(rect.attrib)\n\n# Modify attributes\nrect.set('fill', 'blue')\n\n# Get the XML string\nprint(svg.tostring())","lang":"python","description":"Load an SVG file, select an element via CSS, modify its attribute, and output the updated XML."},"warnings":[{"fix":"Use svg.tostring() instead of print(svg) to serialize XML.","message":"SVG.from_file() returns an SVG object, not a string. Use .tostring() to get the XML string, not str() or repr().","severity":"gotcha","affected_versions":"all"},{"fix":"Remember that the returned elements are standard lxml elements; use .set() and .get() for attributes.","message":"CSS selectors via cssselect() return a list of lxml elements, not SVG-specific objects. Direct attribute manipulation on returned elements works fine.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.6.0':24 'activ':25 'cadenc':31 'canva':20 'develop':26 'extens':22 'file':14 'fix':29 'graphic':13,35 'librari':4 'manipul':7 'ocp':18,36 'ocpsvg':1 'open':19 'pars':6 'protocol':21 'python':3 'releas':30 'render':9 'scalabl':11 'support':16 'svg':10,32 'vector':12,34 'vector-graph':33 'version':23 'xml':37","created_at":"2026-05-09T05:53:14.289409+00:00","updated_at":"2026-05-09T05:53:14.289409+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmp0u50gvpk/venv/lib/python3.12/site-packages/ocpsvg/__init__.py\", line 1, in <module>\n    from .svg import (\n  File \"/tmp/tmp0u50gvpk/venv/lib/python3.12/site-packages/ocpsvg/svg.py\", line 23, in <module>\n    fro"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/ocpsvg/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}