Skip to content

feat: Implement Type-aware purity analysis and integrate boundary and enum extractor #213

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

Open
wants to merge 253 commits into
base: main
Choose a base branch
from

Conversation

Muellersen
Copy link

@Muellersen Muellersen commented Apr 23, 2025

Summary of Changes

  1. Integrated enum and boundary extractor from Nils bachelor's thesis. But unfortunately I had to disable the enum extractor for generating safe ds stubs, as there are some errors. For Example types like multiple_types : int, bool are extracted as ["True", "False"]
  2. Integrated and wrote new tests for the enum and boundary extractors.
  3. Integrated the purity analysis from Lukas bachelor's thesis. Can still be run by passing --old_purity_analysis as cli argument.
  4. Implemented a type aware purity analysis which uses the typeextractors types to improve the purity analysis of Lukas.
  5. Added the tests of the purity analysis from lukas and wrote a new test case to test the type aware purity analysis.
  6. The purity results are passed to the stub generator which uses the results to annotate functions as either pure or impure.

depends on #185

Masara and others added 30 commits August 19, 2024 00:28
…ready in there would be appended to the file once more
…ugh having a "return" without any type; fixed a bug where attributes would not have a type even though a type is defined the docstrings
…s generator and adjusted code to make the tests pass
Add type_string attribute to class ParameterDocstring. Lets us use the extractors of boundaries and valid values, as they need the type_string, also update some imports
boundaries and valid values are added to ParameterDocstring, also updated the corresponding tests
they were added as comments temporarily, also updated snapshots
fixed them so that they run without errors
…or the loaded griffe data instead of parsing through it every time we search for a specific docstring
next, I have to implement the @pure annotation
…s generator and adjusted code to make the tests pass
@Muellersen Muellersen added the enhancement 💡 New feature or request label Apr 23, 2025
@Muellersen Muellersen self-assigned this Apr 23, 2025
Copy link

github-actions bot commented Apr 23, 2025

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ PYTHON mypy 39 0 0 8.96s
✅ PYTHON ruff 39 0 0 0 0.05s
✅ REPOSITORY git_diff yes no no 0.03s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@Muellersen Muellersen changed the title Implement Type-aware purity analysis and integrate boundary and enum extractor feat: Implement Type-aware purity analysis and integrate boundary and enum extractor Apr 23, 2025
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

Attention: Patch coverage is 99.96777% with 1 line in your changes missing coverage. Please review.

Project coverage is 99.91%. Comparing base (70cb952) to head (3f95bf4).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...bgen/api_analyzer/purity_analysis/_infer_purity.py 99.47% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #213      +/-   ##
==========================================
+ Coverage   99.84%   99.91%   +0.06%     
==========================================
  Files          26       40      +14     
  Lines        2616     5616    +3000     
==========================================
+ Hits         2612     5611    +2999     
- Misses          4        5       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Muellersen
Copy link
Author

It seems like I have to update astroid, in order to make the poetry-with-codecov (3.12) check work, as the current astroid version is not compatible with python 3.12. I will try to do that soon. :)

@Muellersen Muellersen marked this pull request as ready for review May 17, 2025 19:16
@Muellersen Muellersen requested a review from a team as a code owner May 17, 2025 19:16
@Muellersen
Copy link
Author

Muellersen commented May 17, 2025

@lars-reimann This branch can be merged now, but only after #185 was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 💡 New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants