{"id":23629,"library":"dparse2","title":"dparse2","description":"A robust fork of the original dparse library with up-to-date dependency file parsing (pip requirements, Pipfile, conda env yml, poetry, setup.cfg). Version 0.7.0 supports Python 3.6+. Maintained by nexB.","status":"active","version":"0.7.0","language":"python","source_language":"en","source_url":"https://github.com/nexB/dparse2","tags":["parser","dependencies","pip","requirements","pipfile","conda","poetry"],"install":[{"cmd":"pip install dparse2","lang":"bash","label":"pip"}],"dependencies":[{"reason":"version comparison","package":"packaging","optional":false},{"reason":"parsing Pipfile and poetry files","package":"toml","optional":false},{"reason":"parsing conda yml files","package":"pyyaml","optional":false}],"imports":[{"note":"Original dparse used 'from dparse import parse'. The module is now dparse2.","symbol":"parse","correct":"from dparse2 import parse"},{"note":"Package name changed from dparse to dparse2.","wrong":"from dparse import filetypes","symbol":"filetypes","correct":"from dparse2.filetypes import RequirementsFile"},{"note":"Top-level package is dparse2, not dparse.","symbol":"dparse2","correct":"import dparse2"}],"quickstart":{"code":"from dparse2 import parse\nfrom dparse2.filetypes import RequirementsFile\n\nwith open('requirements.txt') as f:\n    content = f.read()\nparsed = parse(content, RequirementsFile)\nfor dep in parsed.dependencies:\n    print(dep.name, dep.specs)","lang":"python","description":"Parses a requirements.txt file and prints each dependency name and version specifier."},"warnings":[{"fix":"Replace 'import dparse' with 'import dparse2'.","message":"Package renamed from dparse to dparse2. All imports must use dparse2.","severity":"breaking","affected_versions":"all"},{"fix":"Upgrade to Python 3.6+ or use dparse2==0.5.0.1.","message":"Python 2.7 support dropped after 0.5.0.1. Versions 0.6+ require Python 3.6+.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Use 'if parsed.dependencies: for dep in parsed.dependencies: ...'","message":"parse() returns a ParsedFile object; dependencies can be empty if file is malformed. Always check dependencies before iteration.","severity":"gotcha","affected_versions":"all"},{"fix":"Pass base_dir parameter to parse() to control relative path resolution.","message":"RequirementsFile parser expects base directory (default: '.'). Relative paths in requirements.txt are resolved against the base dir.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.7.0':27 '3.6':30 'conda':21,39 'date':14 'depend':15,35 'dpars':8 'dparse2':1 'env':22 'file':16 'fork':4 'librari':9 'maintain':31 'nexb':33 'origin':7 'pars':17 'parser':34 'pip':18,36 'pipfil':20,38 'poetri':24,40 'python':29 'requir':19,37 'robust':3 'setup.cfg':25 'support':28 'up-to-d':11 'version':26 'yml':23","created_at":"2026-05-01T08:08:47.501945+00:00","updated_at":"2026-05-01T08:08:47.501945+00:00","problems":[{"fix":"Run 'pip install dparse2' and change imports to 'import dparse2'.","cause":"Package renamed to dparse2; old import fails.","error":"ModuleNotFoundError: No module named 'dparse'"},{"fix":"Use 'from dparse2 import parse' or 'dparse2.parse(...)'.","cause":"Wrong import path; parse is a function, not a module attribute when using 'import dparse2'.","error":"AttributeError: module 'dparse2' has no attribute 'parse'"},{"fix":"Provide a file type, e.g., 'from dparse2.filetypes import RequirementsFile' and call 'parse(content, RequirementsFile)'.","cause":"parse() requires a file type class as second argument.","error":"TypeError: parse() missing 1 required positional argument: 'file_type'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.7.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/nexB/dparse2","docs":null,"changelog":null,"pypi":"https://pypi.org/project/dparse2/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}