Registry / serialization / gemfileparser2

gemfileparser2

JSON →
library0.9.4pypypi✓ verified 90d ago

Parse Ruby Gemfile, .gemspec and Cocoapod .podspec files using Python. Current version 0.9.4, requires Python >=3.7. Maintenance cadence is sporadic.

pip install gemfileparser2
INSTALL
IMPORT
SIG · GEMFILEPARSER2
G
gemfileparser2
serializationpythonv0.9.4
Install
1.5s avg
Import
10ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.9.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 17.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.006s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GemfileParser
✓ from gemfileparser2 import GemfileParser
✗ from gemfileparser import GemfileParser
Prior to v0.9.0 the package was named gemfileparser, renamed to avoid conflict.

Read and parse a Ruby Gemfile.

from gemfileparser2 import GemfileParser import os # Parse a Gemfile with open('Gemfile', 'r') as f: content = f.read() parser = GemfileParser().parse(content) print(parser.dependencies)
Debug
Known issues
breakingThe package was renamed from gemfileparser to gemfileparser2 in v0.9.0. All imports must be updated.
fix
Change 'from gemfileparser import ...' to 'from gemfileparser2 import ...'
affects: <0.9.0
gotchaThe parse() method accepts plain text string, not a file path. Passing a file path will fail silently or raise an error.
fix
Read the file content with open() and pass the string to parse().
affects: all
deprecatedThe old module 'gemfileparser' was restored in v0.9.3 for compatibility but may be removed in future releases.
fix
Use 'gemfileparser2' instead of 'gemfileparser'.
affects: 0.9.3+
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'gemfileparser'
Package renamed to gemfileparser2 in v0.9.0.
fix
Install gemfileparser2 and import from gemfileparser2.
AttributeError: 'str' object has no attribute 'read'
Passing a file path string to parse() instead of file contents.
fix
Open the file and read its content: open('Gemfile').read()
gemfileparser2.exceptions.ParseError: Expected ...
Malformed Gemfile content (e.g., syntax error in Ruby source).
fix
Ensure the Gemfile is valid Ruby syntax.
Upgrade
Version history
0.9.4latest on PyPI · released Aug 21, 2024
Audit
Dependencies
pyyamloptionalUsed for parsing .gemspec files
Agent activity
7 hits · last 30 days
node
6
Resources
gemfileparser2 — pip install gemfileparser2 · libregistry