Skip to main content

Library to parse the Cargo.toml manifest file.

Project description

cargo-parse

A Python package to parse Cargo.toml manifest files.

Installation

This package is not (yet) published on PyPI. For now, the best way to install the package is to use Poetry.

Clone this repository and run poetry install.

Install in another environment

To install the package in a system environment, or another virtual environment besides the Poetry project environment:

  1. Build the package wheel with poetry build.
  2. Install the package using the correct environment's pip:
<your-python> -m pip install <path-to-repo>/dist/cargo-parse-*.whl

Usage

Import the parse_manifest_from_toml function and use it to parse the contents of Cargo.toml:

from cargo_parse import parse_manifest_from_toml

from pathlib import Path

cargo_toml_file = "Cargo.toml"
manifest = parse_manifest_from_toml(Path(cargo_toml_file))

# Print out the package version
print(manifest.package.version)

# Print out the dependencies
if manifest.dependencies is not None:
    print(manifest.dependencies)
else:
    print(f"No dependencies defined in {cargo_toml_file}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cargo-parse-0.1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

cargo_parse-0.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file cargo-parse-0.1.0.tar.gz.

File metadata

  • Download URL: cargo-parse-0.1.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.2 Linux/5.8.0-1042-azure

File hashes

Hashes for cargo-parse-0.1.0.tar.gz
Algorithm Hash digest
SHA256 58dbb18b5bf9bb44153c61a5587f8f78be2a5a53a16af3181dbca50a31133d77
MD5 d8e9cc3d91ef7bfba928255d58f506dd
BLAKE2b-256 a3040881a6ebf44b71258c4edc84c7f30efeee1812e3895c1488b0bc2f5f21af

See more details on using hashes here.

File details

Details for the file cargo_parse-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cargo_parse-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.2 Linux/5.8.0-1042-azure

File hashes

Hashes for cargo_parse-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c91a6762373022c6f01290be418cc48b1a905d6481f3defd146c0e34d66ea5f8
MD5 d5aaf208948f26c9f6d58f51ad9b8e02
BLAKE2b-256 e1764a3ff4219bf265323d1bb5a5319a3497b3131faf5d027cf5589dd672ac89

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page