{"id":9703,"library":"dracopy","title":"DracoPy - Draco Mesh Compression Wrapper","description":"DracoPy is a Python wrapper for Google's Draco Mesh Compression Library, enabling efficient encoding and decoding of 3D mesh data. It supports common formats like OBJ and PLY (via in-memory mesh objects). The current version is 2.0.0, with releases occurring infrequently, often coinciding with upstream Draco library updates or significant API overhauls.","status":"active","version":"2.0.0","language":"python","source_language":"en","source_url":"https://github.com/seung-lab/DracoPy","tags":["3d","mesh","compression","draco","numpy"],"install":[{"cmd":"pip install dracopy","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"wrong":"from dracopy import encode","symbol":"encode","correct":"from dracopy import encode"},{"wrong":"from dracopy import decode","symbol":"decode","correct":"from dracopy import decode"},{"wrong":"from dracopy import DracoMesh","symbol":"DracoMesh","correct":"from dracopy import DracoMesh"}],"quickstart":{"code":"import dracopy\nimport numpy as np\n\n# 1. Create a dummy mesh (a simple triangle)\n# Vertices and faces must be NumPy arrays in DracoPy 2.0.0+\nvertices = np.array([\n    [0.0, 0.0, 0.0],\n    [1.0, 0.0, 0.0],\n    [0.0, 1.0, 0.0]\n], dtype=np.float32)\n\nfaces = np.array([\n    [0, 1, 2]\n], dtype=np.int32)\n\n# Create a DracoMesh object\nmesh_to_encode = dracopy.DracoMesh(vertices=vertices, faces=faces)\n\n# 2. Encode the mesh to Draco bytes\nprint(\"Encoding mesh...\")\ndraco_bytes = dracopy.encode(mesh_to_encode, compression_level=7)\nprint(f\"Encoded bytes length: {len(draco_bytes)}\")\n\n# 3. Decode the Draco bytes back to a DracoMesh\nprint(\"Decoding mesh...\")\ndecoded_mesh = dracopy.decode(draco_bytes)\n\n# 4. Access decoded data (still NumPy arrays)\nprint(f\"Decoded vertices shape: {decoded_mesh.vertices.shape}\")\nprint(f\"Decoded faces shape: {decoded_mesh.faces.shape}\")\n\n# Optional: Verify data equality\nassert np.array_equal(vertices, decoded_mesh.vertices)\nassert np.array_equal(faces, decoded_mesh.faces)\nprint(\"Encoding and decoding successful!\")","lang":"python","description":"This quickstart demonstrates how to create a simple 3D mesh using NumPy arrays, encode it into Draco compressed bytes, and then decode it back into a `DracoMesh` object. It highlights the use of NumPy for mesh data, which is standard in version 2.0.0 and above."},"warnings":[{"fix":"Ensure all mesh data passed to `DracoMesh` or assigned to its attributes are NumPy arrays. Convert existing lists using `np.array(your_list)`.","message":"`DracoMesh` attributes (`vertices`, `faces`, `normals`, `colors`, `uvs`) now strictly require NumPy arrays instead of Python lists.","severity":"breaking","affected_versions":"2.0.0+"},{"fix":"Users must now handle file I/O explicitly. Read file content into bytes before passing to `dracopy.decode()` and write `dracopy.encode()` output bytes to a file manually. For example: `with open('mesh.drc', 'rb') as f: mesh_bytes = f.read(); decoded_mesh = dracopy.decode(mesh_bytes)`.","message":"The helper functions `dracopy.decode_file` and `dracopy.encode_file` have been removed.","severity":"breaking","affected_versions":"2.0.0+"},{"fix":"Ensure your system has the necessary build tools (e.g., C++ compiler, CMake) if wheels are not provided. Check the official GitHub repository for more specific build requirements for your platform. Consider using a common Python version (3.8-3.10) for which wheels are typically provided.","message":"Installation can fail if pre-compiled wheels are not available for your specific Python/OS/architecture combination, requiring local compilation.","severity":"gotcha","affected_versions":"All versions"},{"fix":"These parameters are no longer supported. If you were using them, re-evaluate how you are representing and handling custom attributes. The current `DracoMesh` structure focuses on standard mesh components (vertices, faces, normals, colors, uvs).","message":"The `vertex_features` and `face_features` parameters in the `DracoMesh` constructor have been removed.","severity":"deprecated","affected_versions":"2.0.0+"}],"env_vars":null,"search_vec":"'2.0.0':45 '3d':24,61 'api':59 'coincid':51 'common':29 'compress':4,16,63 'current':42 'data':26 'decod':22 'draco':2,14,54,64 'dracopi':1,6 'effici':19 'enabl':18 'encod':20 'format':30 'googl':12 'in-memori':36 'infrequ':49 'librari':17,55 'like':31 'memori':38 'mesh':3,15,25,39,62 'numpi':65 'obj':32 'object':40 'occur':48 'often':50 'overhaul':60 'pli':34 'python':9 'releas':47 'signific':58 'support':28 'updat':56 'upstream':53 'version':43 'via':35 'wrapper':5,10","created_at":"2026-04-17T01:20:17.300616+00:00","updated_at":"2026-04-17T01:20:17.300616+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'dracopy'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.0.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/seung-lab/DracoPy","docs":null,"changelog":null,"pypi":"https://pypi.org/project/dracopy/","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}}