Convert factory functions to proper python classes
djhoese opened this issue · comments
Aggdraw seems to define all of its class __new__
methods as functions in the aggdraw
module. It then creates a new object by creating a new type. This is an issue because this means classes like aggdraw.Draw
aren't actually classes, they are functions, and that a user has no access to the methods without creating an instance of the object. Even worse you can't use sphinx autodoc functionality to document the classes because they don't technically exist until an instance is made.
I don't think this will be extremely hard to implement, but it isn't a top priority for me. Additionally, it has a high chance of breaking something.
Wouldn't mind helping on this, as it's just more stable and also affects clues from autocomplete, plus I suspect the missing parts from https://aggdraw.readthedocs.io/en/latest/.
But this would all have to be done in aggdraw.cxx, ie in C++, correct?
I have the same interest. I thought I raised an issue but I don't see it here. Might be because of my crappy internet. Anyway I would love to see the classes become actual classes but I only started using aggdraw a week ago so not sure how much help or damage I can be. But I'll start going through the code and investigate what might be required
So what happened? This implementing as classes is moved to another task, or forgotten?
You did make an issue in #68 where I commented with my concerns and then closed it as a duplicate of #45. In that comment I pointed out how there are some current issues with current master branch and how it doesn't match the exact output of the currently released version of aggdraw. While the cython (#45) could be worked on while the current master branch implementation has these inconsistency fixes applied in parallel, there isn't really enough developer time to do this. It sounds like you are willing to look at doing the cython stuff. If so, you can continue commenting on #45 with questions and make a pull request as soon as possible and we can review your code/updates together.
As far as "what happened", this project is completely volunteer work. For the pytroll group, aggdraw is a utility library used by a utility library. The libraries that use these libraries are also all volunteer work. Aggdraw is "good enough" and works for us so major refactors like this will always/likely fall to outside contributors as we won't have time to do this work "for fun".