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

Support for characteristic #488

Closed
hynek opened this issue Oct 1, 2014 · 8 comments
Closed

Support for characteristic #488

hynek opened this issue Oct 1, 2014 · 8 comments

Comments

@hynek
Copy link

hynek commented Oct 1, 2014

Hi,

I’m the author of characteristic, a package that is supposed to make the usage of data classes in Python much easier.

Unfortunately it uses setattr (and may do even worse black magic for performance reasons later) and therefore jedi doesn’t pick up the defined attributes. But since they are explicitly declared using a decorator, I figure it could be feasible for you to support it directly? I’d be eternally indebted. :)

Cheers,
Hynek

P.S. For context, it has around 500 downloads a day from PyPI and is somewhat popular in the Twisted-verse: https://warehouse.python.org/project/characteristic/

@davidhalter
Copy link
Owner

Hmm, I guess it would be possible to catch a "characteristic.attributes" call and check for that in jedi/evaluate/stdlib.py. The easiest way would probably be to just return a pseudo super class that has all the required attributes.

However, it's not going to be on my priority list. But it should be fairly easy to implement.

@hynek
Copy link
Author

hynek commented Sep 24, 2016

I’m gonna close this since characteristic is deprecated in favor of attrs which is according to some The One Python Library Everyone Needs. ;) (~13k DL/day btw)

attrs uses class attributes so it works better; if you’d like to add deeper support, there’s a lot of meta data for jedi to harvest if it wanted to. :)

@hynek hynek closed this as completed Sep 24, 2016
@spookylukey
Copy link

@davidhalter I was about to file a ticket about supporting attrs, especially for providing help for the dynamically generated __init__ method, and found this ticket.

It looks like there is some enthusiasm about supporting attrs. If I were to start work on this, is there a recommended approach? Is it OK to have builtin support for this kind of 3rd party library directly in jedi, or is there some kind of plugin system it should be using?

@davidhalter
Copy link
Owner

There is no plugin system, yet. We would need to define one, first. Builtin support is not an option IMO.

@hynek
Copy link
Author

hynek commented Mar 15, 2017

I think though that a ticket for attrs support would be fair game?

@davidhalter
Copy link
Owner

If you want, you can create a ticket for a plugin system, if you want. There's also no support for Django models, which is probably a more pressing issue (in terms of users and what I'm using myself). I think a plugin system should be open to anyone.

@glyph
Copy link

glyph commented Jun 20, 2017

As I understand it the correct ticket for further discussion here is #626 ?

@davidhalter
Copy link
Owner

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants