Kanin / PyPixel

A Python Wrapper for The Hypixel API
MIT License
10 stars 2 forks source link

Full Async Support #19

Open notnotmelon opened 4 years ago

notnotmelon commented 4 years ago

I suggest two versions of the library, one that implements the asyncio library https://docs.python.org/3/library/asyncio.html and one that does not.

Async library is used to pause execution of the current function while waiting on io functions, and move to another function in the meantime

The reason I suggest this is becuase the async library is the standard for the discord.py library, which is where I see the most usage out of this library.

The reason you would need two versions of the library is becuase some people don't need or want to deal with the added complexities from working with asyncio.

I should also add that it would be impossible to adapt this into my sbs discord bot without these features

Darkflame72 commented 4 years ago

In regards to this and seeing that there has been no activity on this library, I have been building an asynchronous wrapper for hypixel. It is implemented in a different way and is currently not finished but should be in the next 2 weeks. It also has greater coverage of the hypixel api and its endpoints.I have linked it here https://github.com/Obsidion-dev/asyncpixel if you are interested. This has been tested on discord bots among other things and performs well.

Kanin commented 4 years ago

The reason you would need two versions of the library is becuase some people don't need or want to deal with the added complexities from working with asyncio.

@notnotmelon is there any reason really to not use async? I'm not sure how to go about making the API support both in the best way possible, I may just make it use async.

Darkflame72 commented 4 years ago

For standalone projects like websites that use flask or Django async is not generally used so making the library async would make it complex to implement. Also simple projects that checks stats etc 1 time an hour don't need to be async.

Kanin commented 4 years ago

Also simple projects that checks stats etc 1 time an hour don't need to be async.

If that's the case you don't need a lib, and I don't really see why I'd go through the issues of having 2 clients for the minority of people who prefer to not use async. I'm just not sure that it's worth the extra work.

Darkflame72 commented 4 years ago

you could implement an async and non-async class instead of different version. I would look at who is currently using the library and tailor to them.

Darkflame72 commented 4 years ago

To make this easier since there is already a hypixel wrapper available on pypi (asyncpixel) that has full async support to keep this synchronous for the people who have that requirement instead of creating multiple libs to do the same thing as there are currently around 8 different hypixel libs in various states.

Kanin commented 4 years ago

No, this will support async if its both or not.

Darkflame72 commented 4 years ago

No, this will support async if its both or not.

Would it be easier to work on improving some of the current asynchronous libraries instead of creating another one with identical functions? https://github.com/Obsidion-dev/asyncpixel is already on pypi and is receiving constant updates and improvements for example.

Kanin commented 4 years ago

I've seen your lib, you dont need to keep refrencing it. I picked up this project for myself, to learn and create what I wanted it to be. If you want a non async library go make one.

Kanin commented 4 years ago

I dont mean to be an ass, but I genuinely don't care about your or anyone else's lib. But when 90% of your comments are just referencing your own project its kind of annoying.

Darkflame72 commented 4 years ago

No problem this is a great lib and if you want to go full asynchronous then do it. I just thought it would be good to make 1 lib really good instead of multiple ones that do the same thing.

Kanin commented 4 years ago

Like I had said before, It'd be nice to do both I'm just not sure when that will be a possibility. Not something i've done before

Darkflame72 commented 4 years ago

It should be pretty easy to migrate requests to aiohttp without too much work and then make it async