Reduce dependencies#568
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #568 +/- ##
==========================================
+ Coverage 97.71% 98.31% +0.59%
==========================================
Files 63 63
Lines 2368 2368
==========================================
+ Hits 2314 2328 +14
+ Misses 54 40 -14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR reduces default (install-time) dependencies by removing some packages from the core dependency set and gating related functionality behind optional extras / runtime checks.
Changes:
- Remove
useful-typesand loosen typing initems_sortedto avoid that dependency. - Move
python-fsutil/requestsusage behind optional-install checks (require_fsutil) and guarded imports. - Restructure optional dependencies in
pyproject.toml(notably aroundio,s3, andxlsextras).
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| requirements.txt | Removes useful-types from the pinned dev/test requirements list. |
| pyproject.toml | Removes python-fsutil, requests, useful-types from core deps; adjusts optional extras composition. |
| benedict/serializers/xls.py | Makes fsutil an optional dependency and enforces it at runtime via require_fsutil. |
| benedict/extras.py | Adds require_fsutil helper to standardize optional dependency enforcement. |
| benedict/dicts/io/io_util.py | Guards fsutil import/usage and requires fsutil at runtime for file/url/s3 IO helpers. |
| benedict/core/items_sorted.py | Removes useful-types usage by replacing rich-comparison typing with Any. |
Comments suppressed due to low confidence (1)
benedict/dicts/io/io_util.py:103
is_filepathstill usescast("str", s)forPath | strinputs. Sincecastis a runtime no-op, passing a non-existentPath("foo.json")will fall throughfsutil.is_file(...)and then callis_data(...)/is_s3(...)/is_url(...)with aPath, causing anAttributeError(e.g.,Pathhas nosplitlines). Convert once withs_str = str(s)and uses_strfor the string-only helpers (and forget_format_by_path).
def is_filepath(s: Path | str) -> bool:
if fsutil_installed and fsutil.is_file(s):
return True
return bool(
get_format_by_path(s)
and not is_data(cast("str", s))
and not is_s3(cast("str", s))
and not is_url(cast("str", s))
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
…serializer Agent-Logs-Url: https://github.com/fabiocaccamo/python-benedict/sessions/841a9dfb-c101-4f41-b8d3-552ef909284b Co-authored-by: fabiocaccamo <1035294+fabiocaccamo@users.noreply.github.com>
All changes from that review thread were already applied in eb8459f:
|
name: Pull request
about: Submit a pull request for this project
assignees: fabiocaccamo
Describe your changes
Make the core installation super lightweight.
Related issue
#567
Checklist before requesting a review