spadarian / docblock-python

Atom plugin to insert documentation blocks for python functions
GNU General Public License v2.0
22 stars 9 forks source link

Cython support #19

Closed SebastianSemper closed 5 years ago

SebastianSemper commented 6 years ago

This is an awesome extension!

It would be really nice, if Cython would be supported, where even more information can be automatically casted into the docstring, since sometimes statically typed function definitions are used.

But as a starting point it would be really helpful, if at least Cython would be allowed by extending the accepted starting keywords with 'cdef' and 'cpdef'.

spadarian commented 6 years ago

The syntax of the typing in Cython ("int a") is different from Python ("a: int"), so just adding cdef and cpdef to the starting keywords wouldn't help much I think.

To fix this issue is necessary to:

  1. Modify format_lines to parse the parameters differently when the starting keyword is cdef or cpdef.
  2. Add the new starting keywords.
  3. Extract the type of the returned value (between cdef/cpdef and the name of the function).

An extra task is to add support for things like except?, `except*' and probably other things of which I don't know.

I think it is worth implementing this, so I will add it to my todo list. I will also tag this as a "good first issue". If anyone wants to help, let me know so we don't work in the same thing.

spadarian commented 5 years ago

@SebastianSemper Let me know if that is enough. I have no idea how to document things like "except" or if it even necessary. Let me know if you need me to fix or add something.

SebastianSemper commented 5 years ago

@spadarian: Thanks for the nice update! For me on atom 1.32.2, docblock-python version 0.11 and electron 2.0.12 the plugin does not work anymore at all. It always throws me an error with "Nothing to do.Try selecting a line where you define a function or class."

Should I open an issue? What other info do you need?

spadarian commented 5 years ago

Can you post an example of your function? Are you using Windows?

Travis used electron 2.0.9 but I doubt that is the problem.

José Padarian C. ✉ spadarian@gmail.com

Sydney Institute of Agriculture THE UNIVERSITY OF SYDNEY Suite 105, Biomedical Building, 1 Central Avenue Australian Technology Park, Eveleigh, NSW 2015, Australia

On Mon, 19 Nov 2018 20:49 Sebastian Semper, notifications@github.com wrote:

@spadarian https://github.com/spadarian: Thanks for the nice update! For me on atom 1.32.2, docblock-python version 0.11 and electron 2.0.12 the plugin does not work anymore at all. It always throws me an error with "Nothing to do.Try selecting a line where you define a function or class."

Should I open an issue? What other info do you need?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spadarian/docblock-python/issues/19#issuecomment-439833267, or mute the thread https://github.com/notifications/unsubscribe-auth/AAV0KkQf9ITANLGcAsE9FiinTmclp7sTks5uwn6ZgaJpZM4WgX1D .

SebastianSemper commented 5 years ago

I tried

` def WARNING(string):

print("\033[91mWARNING:\033[0m %s" % (string))

`

on Manjaro Linux.

spadarian commented 5 years ago

So even in a "normal" (no Cython) function...

Just to be sure, your cursor is in the def WARNING(string): line, right?

SebastianSemper commented 5 years ago

Yes, of course. :-)

On Mon, 19 Nov 2018 at 23:03, José Padarian notifications@github.com wrote:

So even in a "normal" (no Cython) function...

Just to be sure, your cursor is in the def WARNING(string): line, right?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spadarian/docblock-python/issues/19#issuecomment-440057985, or mute the thread https://github.com/notifications/unsubscribe-auth/ABDZRlk2T-zsxwPKrVX964AzZEtv0j2iks5uwyqtgaJpZM4WgX1D .

spadarian commented 5 years ago

Create a new issue and let's move the conversation there. No idea how to reproduce the problem but maybe someone else has an idea.