Plette is a Python library that provides structured models for parsing, generating, and validating Pipfile and Pipfile.lock files. It allows developers to programmatically interact with project dependencies in a structured manner. The current version is 2.1.0, and it maintains a regular release cadence with significant updates, including a major version bump from v1 to v2.
pip install pletteVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load Pipfile and Pipfile.lock content from strings using `io.StringIO`, access their structured properties, and then modify and dump a Pipfile back to a string. It shows how to retrieve the required Python version from Pipfile, list packages, and access specific dependency versions from Lockfile.
Use the `.get()` method or `try-except` blocks to handle potentially missing keys gracefully. For example: `pipfile.get('non_existent_section', {})`.Prefer higher-level `plette` APIs for modifications, if available, or regenerate the lockfile using `pipenv lock` if using Pipenv, to ensure integrity and correct hashing.
Review your code for direct property access, especially for nested structures or alias usage. Consult the official `plette` GitHub repository for any unlisted breaking changes. Prioritize using official loading/dumping methods and avoid direct dictionary manipulation where possible.
Use dictionary-style `.get()` method to safely access sections, providing a default value if the section might be missing. E.g., `pipfile.get('missing_section', {})`.Verify the package name is correct and present in the `Pipfile.lock`. Use `lockfile.default.get('some-package')` to handle cases where the package might not exist without raising an error.Access specific sections of the `Lockfile` (e.g., `lockfile.default`, `lockfile.develop`) and iterate over those dictionaries. For example, `for package, details in lockfile.default.items(): ...`.
No dependency data recorded yet.