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

feat: DocString result names for Safe-DS stub results #101

Conversation

Masara
Copy link
Contributor

@Masara Masara commented Apr 7, 2024

Closes #100

Summary of Changes

Result names for stubs from Numpy docstring are now supported. Google and ReST don't support multiple results or named results, therefore they handle these a bit different:

  • For Google docstrings, if there are multiple results we only get the first result docstring (type & description).
  • For ReST we get all types, but only the last result description in the docstring.

@Masara Masara requested a review from a team as a code owner April 7, 2024 12:31
@Masara Masara linked an issue Apr 7, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Apr 7, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 15 0 0 1.45s
✅ PYTHON mypy 15 0 5.93s
✅ PYTHON ruff 15 0 0 0.05s
✅ REPOSITORY git_diff yes 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

Copy link

codecov bot commented Apr 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.28%. Comparing base (c581e6a) to head (134532f).
Report is 51 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #101      +/-   ##
==========================================
+ Coverage   99.27%   99.28%   +0.01%     
==========================================
  Files          22       22              
  Lines        2192     2250      +58     
==========================================
+ Hits         2176     2234      +58     
  Misses         16       16              

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

megalinter-bot and others added 10 commits April 7, 2024 12:36
…nferred and did not have results named from docstrings
…ed results, where they would not get properly inferred and did not have results named from docstrings
…gs-for-result-names-in-generated-stubs' into 100-use-result-names-in-docstrings-for-result-names-in-generated-stubs

# Conflicts:
#	src/safeds_stubgen/api_analyzer/_ast_visitor.py
#	tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[numpydoc-NUMPYDOC].sdsstub
@Masara Masara force-pushed the 100-use-result-names-in-docstrings-for-result-names-in-generated-stubs branch from 79fd2a6 to e124b35 Compare April 7, 2024 20:53
Masara and others added 7 commits April 10, 2024 13:48
…t-names-in-generated-stubs

# Conflicts:
#	tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[infer_types_module].sdsstub
#	tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[numpydoc-NUMPYDOC].sdsstub
…gs-for-result-names-in-generated-stubs' into 100-use-result-names-in-docstrings-for-result-names-in-generated-stubs
@Masara
Copy link
Contributor Author

Masara commented Apr 10, 2024

@lars-reimann The linter failed to run

Run actions/upload-artifact@v4
Multiple search paths detected. Calculating the least common ancestor of all paths
The least common ancestor is /home/runner/work/Stub-Generator/Stub-Generator. This will be the root directory of the artifact
With the provided path, there will be 10 files uploaded
Artifact name is valid!
Root directory input is valid!
Beginning upload of artifact content to blob storage
Uploaded bytes 7[16](https://github.com/Safe-DS/Stub-Generator/actions/runs/8636183463/job/23675494721?pr=101#step:5:17)2
Finished uploading artifact content to blob storage!
SHA256 hash of uploaded artifact zip is eb6b45b691dee50ca3d7608b93b[18](https://github.com/Safe-DS/Stub-Generator/actions/runs/8636183463/job/23675494721?pr=101#step:5:19)b3b85f0a8ad228204896204a503d9caebe8
Finalizing artifact upload
Error: Failed to FinalizeArtifact: Received non-retryable error: Failed request: (403) Forbidden: Error from intermediary with HTTP status code 403 "Forbidden"

@Masara
Copy link
Contributor Author

Masara commented Apr 10, 2024

Nevermind, it runs now

@Masara
Copy link
Contributor Author

Masara commented Apr 11, 2024

@lars-reimann Could you merge this with higher priority? This is required for issue #80

@Masara Masara force-pushed the 100-use-result-names-in-docstrings-for-result-names-in-generated-stubs branch from 4d2bf27 to 134532f Compare April 11, 2024 17:34
@lars-reimann lars-reimann merged commit fe163e3 into main Apr 11, 2024
8 checks passed
@lars-reimann lars-reimann deleted the 100-use-result-names-in-docstrings-for-result-names-in-generated-stubs branch April 11, 2024 20:04
lars-reimann pushed a commit that referenced this pull request May 4, 2024
## [0.3.0](v0.2.0...v0.3.0) (2024-05-04)

### Features

* Added handling for sequence classes ([#127](#127)) ([cb061ab](cb061ab)), closes [#126](#126)
* DocString result names for Safe-DS stub results ([#101](#101)) ([fe163e3](fe163e3)), closes [#100](#100)
* Examples from docstrings are also taken over to stub docstrings ([#116](#116)) ([6665186](6665186)), closes [#115](#115)
* Replace the docstring_parser library with Griffe ([#79](#79)) ([9b2f802](9b2f802))

### Bug Fixes

* `Self` types as results are translated to class names  ([#110](#110)) ([4554a56](4554a56)), closes [#86](#86)
* Creating stubs with relative paths for source and output directories ([#128](#128)) ([b4493c9](b4493c9)), closes [#125](#125)
* Docstrings have the correct indentation for nested classes (stubs) ([#114](#114)) ([c7b8550](c7b8550)), closes [#113](#113)
* Fixed a bug where double ? would be generated for stubs ([#103](#103)) ([c35c6ac](c35c6ac)), closes [#87](#87) [#87](#87)
* Fixed a bug where imports would not check reexports for shortest path ([#112](#112)) ([48c5367](48c5367)), closes [#82](#82)
* Fixed a bug where results in stubs would not be named ([#131](#131)) ([4408c84](4408c84)), closes [#100](#100)
* Fixed a bug which prevented mypy version update ([#107](#107)) ([501d2cd](501d2cd))
* Fixed the stubs generator ([#108](#108)) ([9ad6df6](9ad6df6)), closes [#80](#80)
* Generated names of callback results start with result, not with param ([#104](#104)) ([6e696e9](6e696e9)), closes [#85](#85)
* Include lines of examples that start with `...` ([#130](#130)) ([3477b4a](3477b4a)), closes [#129](#129)
* No "// TODO ..." if return type is explicitly `None` ([#111](#111)) ([08e345f](08e345f)), closes [#83](#83)
* Removed the Epydoc parser ([#89](#89)) ([684a101](684a101))
* Replaced tabs with 4 spaces ([#105](#105)) ([8e7aa5d](8e7aa5d)), closes [#84](#84)
* The file structure of stubs resembles the "package" path. ([#106](#106)) ([ff1800e](ff1800e)), closes [#81](#81)
* Translation of callable ([#102](#102)) ([c581e6a](c581e6a)), closes [#88](#88) [#88](#88)
@lars-reimann
Copy link
Member

🎉 This PR is included in version 0.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lars-reimann lars-reimann added the released Included in a release label May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Included in a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use result names in docstrings for result names in generated stubs
3 participants