Metadata-Version: 2.1
Name: cargo-parse
Version: 0.1.0
Summary: Library to parse the Cargo.toml manifest file.
Home-page: https://github.com/Deca-Technologies/cargo-parse
License: MIT
Keywords: cargo,rust
Author: Andrew Hoetker
Author-email: andrew.hoetker@thinkdeca.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: pydantic (>=1.8.2,<2.0.0)
Requires-Dist: toml (>=0.10.2,<0.11.0)
Project-URL: Repository, https://github.com/Deca-Technologies/cargo-parse
Description-Content-Type: text/markdown

# 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](https://python-poetry.org/).

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`:


```python
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}")
```

