Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 101 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ dashmap = "6.1"
deps-core = { version = "0.2.1", path = "crates/deps-core" }
deps-cargo = { version = "0.2.1", path = "crates/deps-cargo" }
deps-npm = { version = "0.2.1", path = "crates/deps-npm" }
deps-pypi = { version = "0.2.1", path = "crates/deps-pypi" }
deps-lsp = { version = "0.2.1", path = "crates/deps-lsp" }
futures = "0.3"
insta = "1"
mockito = "1"
node-semver = "2.2"
pep440_rs = "0.7"
pep508_rs = "0.9"
reqwest = { version = "0.12", default-features = false }
semver = "1"
serde = "1"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Crates.io](https://img.shields.io/crates/v/deps-lsp)](https://crates.io/crates/deps-lsp)
[![docs.rs](https://img.shields.io/docsrs/deps-lsp)](https://docs.rs/deps-lsp)
[![codecov](https://codecov.io/gh/bug-ops/deps-lsp/graph/badge.svg?token=S71PTINTGQ)](https://codecov.io/gh/bug-ops/deps-lsp)
[![CI](https://img.shields.io/github/actions/workflow/status/bug-ops/deps-lsp/ci.yml?branch=main)](https://github.com/bug-ops/deps-lsp/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![MSRV](https://img.shields.io/badge/MSRV-1.89-blue)](https://blog.rust-lang.org/)
Expand Down
1 change: 1 addition & 0 deletions crates/deps-cargo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Crates.io](https://img.shields.io/crates/v/deps-cargo)](https://crates.io/crates/deps-cargo)
[![docs.rs](https://img.shields.io/docsrs/deps-cargo)](https://docs.rs/deps-cargo)
[![codecov](https://codecov.io/gh/bug-ops/deps-lsp/graph/badge.svg?token=S71PTINTGQ&flag=deps-cargo)](https://codecov.io/gh/bug-ops/deps-lsp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)

Cargo.toml support for deps-lsp.
Expand Down
1 change: 1 addition & 0 deletions crates/deps-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Crates.io](https://img.shields.io/crates/v/deps-core)](https://crates.io/crates/deps-core)
[![docs.rs](https://img.shields.io/docsrs/deps-core)](https://docs.rs/deps-core)
[![codecov](https://codecov.io/gh/bug-ops/deps-lsp/graph/badge.svg?token=S71PTINTGQ&flag=deps-core)](https://codecov.io/gh/bug-ops/deps-lsp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)

Core abstractions for deps-lsp: caching, errors, and traits.
Expand Down
1 change: 1 addition & 0 deletions crates/deps-lsp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Crates.io](https://img.shields.io/crates/v/deps-lsp)](https://crates.io/crates/deps-lsp)
[![docs.rs](https://img.shields.io/docsrs/deps-lsp)](https://docs.rs/deps-lsp)
[![codecov](https://codecov.io/gh/bug-ops/deps-lsp/graph/badge.svg?token=S71PTINTGQ&flag=deps-lsp)](https://codecov.io/gh/bug-ops/deps-lsp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)

Language Server Protocol implementation for dependency management.
Expand Down
1 change: 1 addition & 0 deletions crates/deps-npm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Crates.io](https://img.shields.io/crates/v/deps-npm)](https://crates.io/crates/deps-npm)
[![docs.rs](https://img.shields.io/docsrs/deps-npm)](https://docs.rs/deps-npm)
[![codecov](https://codecov.io/gh/bug-ops/deps-lsp/graph/badge.svg?token=S71PTINTGQ&flag=deps-npm)](https://codecov.io/gh/bug-ops/deps-lsp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)

npm/package.json support for deps-lsp.
Expand Down
26 changes: 26 additions & 0 deletions crates/deps-pypi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "deps-pypi"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
description = "PyPI/Python support for deps-lsp"

[dependencies]
deps-core = { workspace = true }
async-trait = { workspace = true }
pep440_rs = { workspace = true }
pep508_rs = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
thiserror = { workspace = true }
tower-lsp = { workspace = true }
toml_edit = { workspace = true }
tracing = { workspace = true }

[dev-dependencies]
insta = { workspace = true, features = ["json"] }
mockito = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
67 changes: 67 additions & 0 deletions crates/deps-pypi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# deps-pypi

[![Crates.io](https://img.shields.io/crates/v/deps-pypi)](https://crates.io/crates/deps-pypi)
[![docs.rs](https://img.shields.io/docsrs/deps-pypi)](https://docs.rs/deps-pypi)
[![codecov](https://codecov.io/gh/bug-ops/deps-lsp/graph/badge.svg?token=S71PTINTGQ&flag=deps-pypi)](https://codecov.io/gh/bug-ops/deps-lsp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)

PyPI/Python support for deps-lsp.

This crate provides parsing, validation, and registry client functionality for Python dependency management in `pyproject.toml` files, supporting both PEP 621 and Poetry formats.

## Features

- **PEP 621 Support**: Parse `[project.dependencies]` and `[project.optional-dependencies]`
- **Poetry Support**: Parse `[tool.poetry.dependencies]` and `[tool.poetry.group.*.dependencies]`
- **PEP 508 Parsing**: Handle complex dependency specifications with extras and markers
- **PEP 440 Versions**: Validate and compare Python version specifiers
- **PyPI API Client**: Fetch package metadata from PyPI JSON API with HTTP caching

## Usage

```rust
use deps_pypi::{PypiParser, PypiRegistry};
use deps_core::PackageRegistry;

// Parse pyproject.toml
let content = std::fs::read_to_string("pyproject.toml")?;
let parser = PypiParser::new();
let dependencies = parser.parse(&content)?;

// Fetch versions from PyPI
let registry = PypiRegistry::new();
let versions = registry.get_versions("requests").await?;
```

## Supported Formats

### PEP 621 (Standard)

```toml
[project]
dependencies = [
"requests>=2.28.0,<3.0",
"flask[async]>=3.0",
"numpy>=1.24; python_version>='3.9'",
]

[project.optional-dependencies]
dev = ["pytest>=7.0", "mypy>=1.0"]
```

### Poetry

```toml
[tool.poetry.dependencies]
python = "^3.9"
requests = "^2.28.0"
flask = {version = "^3.0", extras = ["async"]}

[tool.poetry.group.dev.dependencies]
pytest = "^7.0"
mypy = "^1.0"
```

## License

MIT
Loading
Loading