Skip to content

Implement get_project_deps and tests#853

Merged
nathanjmcdougall merged 1 commit intomainfrom
849-a-method-to-read-in-the-project-dependencies-from-pyprojecttoml
Jul 14, 2025
Merged

Implement get_project_deps and tests#853
nathanjmcdougall merged 1 commit intomainfrom
849-a-method-to-read-in-the-project-dependencies-from-pyprojecttoml

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the get_project_deps function to extract core dependencies from a project's pyproject.toml and adds a suite of tests to validate its behavior across various edge cases.

  • Implements get_project_deps in deps.py, handling missing files, empty or malformed sections, dependency parsing, and error conditions.
  • Adds comprehensive tests in test_deps.py covering valid dependencies (with extras and version constraints), missing sections, and invalid inputs.
  • Updates imports in tests to include InvalidRequirement for requirement parsing errors.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/usethis/_integrations/uv/test_deps.py Added TestGetProjectDeps with tests for missing/empty sections, valid deps (extras/constraints), and error cases.
src/usethis/_integrations/uv/deps.py Added get_project_deps to parse project.dependencies into Dependency models, with validation and error handling.
Comments suppressed due to low confidence (2)

src/usethis/_integrations/uv/deps.py:28

  • Update the docstring to note that version specifiers and environment markers are discarded, and only package names and extras are returned.
    """Get all project dependencies.

tests/usethis/_integrations/uv/test_deps.py:250

  • [nitpick] Add a test for requirement strings containing environment markers (e.g., "package; python_version<'3.8'") to verify markers are properly ignored.
        with (

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jul 14, 2025

CodSpeed Instrumentation Performance Report

Merging #853 will not alter performance

Comparing 849-a-method-to-read-in-the-project-dependencies-from-pyprojecttoml (388c570) with main (972cbb5)

Summary

✅ 2 untouched benchmarks

@nathanjmcdougall nathanjmcdougall merged commit a7ac01e into main Jul 14, 2025
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 849-a-method-to-read-in-the-project-dependencies-from-pyprojecttoml branch July 14, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A method to read-in the project dependencies from pyproject.toml

2 participants