This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 3.0.1 instead.
Reason given by maintainers: new version available
ply_parser
Read PLY (Polygon File Format) files in Python, with zero dependencies.
ply_parser reads ASCII and binary PLY meshes into plain Python lists: vertices, faces, colours and normals. It follows the header, so unusual vertex layouts and extra elements are handled, and malformed files fail with a readable ValueError instead of silent garbage.
pip install ply_parser
Requires Python 3.8+.
Quick start
from ply_parser import parse_ply_file
obj = parse_ply_file("cube.ply")
print(obj.name) # cube.ply
print(len(obj.vertices)) # 8
print(len(obj.faces)) # 12
print(obj.faces[0]) # [0, 1, 2]
What you get
parse_ply_file() returns a PLYObject with:
| Attribute | Contents |
|---|---|
name |
The file name, or the name you passed to parse_ply() |
vertices |
[x, y, z] for every vertex |
faces |
Vertex indices for each face (any number of vertices per face) |
colors |
[r, g, b] per vertex, as stored in the file. Empty if none |
normals |
[nx, ny, nz] per vertex. Empty if none |
Colours keep their file values: a uchar colour channel is 0-255.
Features
- ASCII, binary little-endian and big-endian formats
- Any header layout: properties in any order, extra properties and extra elements are skipped
- Polygons, not just triangles: faces keep every vertex index
- Colours and normals picked up from
red/green/blue,r/g/b,diffuse_*,nx/ny/nzornormal_*properties - Strict by default: header and body must agree, indices must be in range, coordinates must be finite
- Parse from memory as well as from disk
Parsing data you already have
from ply_parser import parse_ply
with open("scan.ply", "rb") as f:
obj = parse_ply(f.read(), name="scan")
parse_ply() takes str for ASCII data or bytes for any format.
For line-based input, parse_ply_file_data() returns the older [vertices, faces, colors] list:
from ply_parser import parse_ply_file_data
vertices, faces, colors = parse_ply_file_data(lines)
Handling bad files
from ply_parser import parse_ply_file
try:
obj = parse_ply_file("broken.ply")
except ValueError as err:
print(err) # e.g. "PLY: vertex index 9 out of range (only 8 vertices) in face 0"
Development
git clone https://github.com/KrishnaMBhattarai/ply_parser
cd ply_parser
pip install .
python -m unittest tests/test_ply_parser.py -v
Contributing
Issues and pull requests are welcome, especially sample PLY files that the parser gets wrong. Please include a small file that reproduces the problem.
Licence
MIT. See license.txt.
Metadata
Release files for ply-parser 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ply_parser-3.0.0.tar.gz | 9.9 kB | Without provenance | Details for ply_parser-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ply_parser-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for ply_parser-3.0.0-py3-none-any.whl |
Total release size: 16.5 kB
Release files / ply_parser-3.0.0.tar.gz
| Download URL | ply_parser-3.0.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5144a88ed3eb2e6b37381b761c429a25a5fe53844d3bff59c87692706715fbd7
|
|
BLAKE2b-256 checksum How to use checksums |
cd12dc5f9e3fa6d30536361153eba9ecc1dcda1e3625912ac655ae8a3ef8567d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.9
|
Release files / ply_parser-3.0.0-py3-none-any.whl
| Download URL | ply_parser-3.0.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c96be273025cec3ce58fab2158b794503534ad2c8125264cb31f75a0c1f379dd
|
|
BLAKE2b-256 checksum How to use checksums |
7f0166db9f8e67339268857214a36e753e6dbd33bc63202ecff60286a4dfd3a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.9
|
Security for ply-parser 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.