Skip to content

Built in methodsclassesfunctions lack documentation#2912

Closed
AthulMuralidhar wants to merge 8 commits into
RustPython:mainfrom
AthulMuralidhar:built-in-methodsclassesfunctions-lack-documentation
Closed

Built in methodsclassesfunctions lack documentation#2912
AthulMuralidhar wants to merge 8 commits into
RustPython:mainfrom
AthulMuralidhar:built-in-methodsclassesfunctions-lack-documentation

Conversation

@AthulMuralidhar
Copy link
Copy Markdown

@AthulMuralidhar AthulMuralidhar commented Aug 19, 2021

main issue is here: #2680

@AthulMuralidhar AthulMuralidhar force-pushed the built-in-methodsclassesfunctions-lack-documentation branch from bf0573d to e27b810 Compare August 19, 2021 10:09
Comment thread vm/src/builtins/list.rs Outdated
@youknowone
Copy link
Copy Markdown
Member

Generally, people shouldn't 'merge' anything from git repository. please rebase your work onto upstream/master. Otherwise cherry-picking your commit will work too.

@AthulMuralidhar
Copy link
Copy Markdown
Author

Generally, people shouldn't 'merge' anything from git repository. please rebase your work onto upstream/master. Otherwise cherry-picking your commit will work too.

i'm not too familiar with cherrypicking, i will try the rebase route

@AthulMuralidhar AthulMuralidhar force-pushed the built-in-methodsclassesfunctions-lack-documentation branch 3 times, most recently from 068e2cc to cdff42a Compare September 6, 2021 09:43
Comment thread vm/src/builtins/bytearray.rs Outdated
@youknowone
Copy link
Copy Markdown
Member

@AthulMuralidhar how are you testing your PRs?

@AthulMuralidhar
Copy link
Copy Markdown
Author

AthulMuralidhar commented Sep 8, 2021

@AthulMuralidhar how are you testing your PRs?

just by the testing doc in the dev guide, i also run fmt and clippy

I also try to run the interpreter prompt from runpython and check the __doc__ there

@fanninpm
Copy link
Copy Markdown
Contributor

fanninpm commented Sep 8, 2021

@AthulMuralidhar how are you testing your PRs?

just by the testing doc in the dev guide, i also run fmt and clippy

Try actually compiling and running the RustPython executable. When the primary shows up, type help(bytearray()).

@youknowone
Copy link
Copy Markdown
Member

We write the code to build a real product, not just writing codes for codes themselves. Understanding how your code change affect the product is important for contributions. If you don't understand how your contribution affect products, please investigate about it first. This comment is also about your other PR too.

@AthulMuralidhar
Copy link
Copy Markdown
Author

AthulMuralidhar commented Sep 10, 2021

Firstly, thanks guys for your inputs. I admit that I do not understand the project completely yet, but I will do my best and I assure you that as I work with the project more, I will be able to see the various parts of the project and how they work together. If you guys think that my contributions are not upto the mark, please feel free to reject the pr's - maybe also leaving some comments there so that i can learn and improve. Thanks again for letting me be a part of this project :)

@AthulMuralidhar AthulMuralidhar force-pushed the built-in-methodsclassesfunctions-lack-documentation branch 2 times, most recently from 8233479 to 3022a79 Compare September 10, 2021 18:04
@AthulMuralidhar AthulMuralidhar force-pushed the built-in-methodsclassesfunctions-lack-documentation branch from 09a4b53 to 8ed83c4 Compare September 11, 2021 14:22
@AthulMuralidhar
Copy link
Copy Markdown
Author

question:
sometimes, i come across some pymethod deninitions like this:

    #[pymethod(name = "__radd__")]
    #[pymethod(magic)]

when i add the doc strings to the top of the code like so:

///  Return value+self.
  #[pymethod(name = "__radd__")]
  #[pymethod(magic)]
...

the output of the help method is the same for both __radd__ and __add__. I tried to add something like this:

///  Return value+self.
  #[pymethod(name = "__radd__")]
/// Return self+value.
  #[pymethod(magic)]
...

but now it just prints both the doc strings together, how can i get the radd doc string and add doc string to render separately? For now i have omitted the doc string all together. I will update it once i get some pointers from here :) thanks again

@youknowone
Copy link
Copy Markdown
Member

You caught good point. I have no idea whether we can fix it by fixing macro implementation or need to find another way. But they are ok for now. Let’s keep it like 3rd version for now. Thank you!

@AthulMuralidhar
Copy link
Copy Markdown
Author

AthulMuralidhar commented Sep 26, 2021

another question / help required: i just added the docs to the coroutine builtin, seems like the docs are not being genereated:
my local python build

 |  __del__(...)
 |  
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |  
 |  __iter__(self, /)
 |      Implement iter(self).
 |  
 |  __next__(self, /)
 |      Implement next(self).
 |  
 |  __repr__(self, /)
 |      Return repr(self).
 |  
 |  close(...)
 |      close() -> raise GeneratorExit inside generator.
 |  
 |  send(...)
 |      send(arg) -> send 'arg' into generator,
 |      return next yielded value or raise StopIteration.
 |  
 |  throw(...)
 |      throw(typ[,val[,tb]]) -> raise exception in generator,
 |      return next yielded value or raise StopIteration.

help on coroutine from rustpython

 |  object()
 |  --
 |  
 |  The base class of the class hierarchy.
 |  
 |  When called, it accepts no arguments and returns a new featureless
 |  instance that has no instance attributes and cannot be given any.
 |  
 |  Methods defined here:
 |  
 |  __iter__(...)
 |  
 |  __next__(...)
 |  
 |  __repr__(...)
 |  
 |  close(...)
 |  
 |  send(...)
 |  
 |  throw(...)
 |  

please also notice that i have the exact same docs added in the file - seems like the doc generator is not picking it up. I will wait for your comments on this, while i move onto other builtins


the __reduce__ magic is also not rendered with the enumerate builtin

@DimitrisJim
Copy link
Copy Markdown
Member

Hey @AthulMuralidhar. If you can, please pause on working on this for a bit since there's some ongoing work to try and automatically include these (see #3101).

Somewhat unfortunate that this conflicts with your current work but I'm sure there's going to be certain parts where some manual documentation will need to be added (from the top of my head, the __r*__ methods will need help).

@AthulMuralidhar
Copy link
Copy Markdown
Author

maybe i can make a pr with the current changes already? or should i keep this one open you think? @DimitrisJim

@DimitrisJim
Copy link
Copy Markdown
Member

I'd say wait a bit until the we get a clear picture of what can/cannot be covered automatically and then we can see how we can go forward with it.

@DimitrisJim
Copy link
Copy Markdown
Member

A very late thanks for the PR but automating this to avoid copy pasting docstrings was the way to go 😄 I'll be closing this now but thanks again!

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.

4 participants