Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing project.version automatically #301

Merged

Conversation

nathanjmcdougall
Copy link
Owner

No description provided.

@nathanjmcdougall nathanjmcdougall linked an issue Feb 13, 2025 that may be closed by this pull request
Copy link

codspeed-hq bot commented Feb 13, 2025

CodSpeed Performance Report

Merging #301 will improve performances by 25.37%

Comparing 299-handle-missing-projectversion-field-in-pyprojecttoml (da29758) with main (0c6fb50)

Summary

⚡ 1 improvements

Benchmarks breakdown

Benchmark BASE HEAD Change
test_several_tools_add_and_remove 776 ms 618.9 ms +25.37%

@codecov-commenter
Copy link

codecov-commenter commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 95.16908% with 10 lines in your changes missing coverage. Please review.

Project coverage is 96.59%. Comparing base (0c6fb50) to head (da29758).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/usethis/_interface/readme.py 71.42% 4 Missing ⚠️
src/usethis/_interface/version.py 66.66% 3 Missing ⚠️
src/usethis/_core/badge.py 50.00% 1 Missing ⚠️
src/usethis/_core/show.py 85.71% 1 Missing ⚠️
src/usethis/_interface/ci.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #301      +/-   ##
==========================================
+ Coverage   95.03%   96.59%   +1.56%     
==========================================
  Files          61       66       +5     
  Lines        2759     2878     +119     
==========================================
+ Hits         2622     2780     +158     
+ Misses        137       98      -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nathanjmcdougall
Copy link
Owner Author

nathanjmcdougall commented Feb 13, 2025

There is definitely a performance regression to address. One idea would be: only read the pyproject.toml once for the whole call. When we "write" we just save to global state until the very last moment and then on packdown we actually do the write. The idea being, we can avoid doing as much IO.

Also, need to add test coverage for the following cases:

  • not project section at all
  • invalid dtype for project
  • invalid dtype for project.dynamic
  • Not needed for test coverage, but probably good to have a test which checks that we don't try and add project.version when project.dynamic contains "version".

@nathanjmcdougall nathanjmcdougall merged commit 3a30c55 into main Feb 20, 2025
15 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 299-handle-missing-projectversion-field-in-pyprojecttoml branch February 20, 2025 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants