You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After taking a look over the project, I can make a few suggestions @TreasonMay .
Project structure
Laying out the project as a library
To end up a Python library, there are a few adjustments I would suggest making to the repository. Generally you have project_name/project_name/init.py along with all your other project files. This allows you to put setup files etc within the root directory, then the library itself is only in the sub folder. For example, see pyjokes. It has a lot else in there, but it has the rough idea. This is a great guide as well.
PEP8 support
This is definitely one of my big ones, but it isn't the end of the world. To help developers using your library, I would suggest switching over to PEP8 formatting. So that would mean
This avoids you by mistake uploading your virtual environment folder (I would suggest removing this) along with uploading your .idea folder. This is a pretty good example of one you can use right away for Pycharm, that also covers Python itself.
Splitting out into multiple files
As you grow the API, you may wish to flesh it out into multiple files. This makes it all a bit easier to manage. For example, you might want an auth.py file, tasks.py etc etc.
Examples
Examples generally live in a folder of their own, with the file titled what they actually do. See for example this repository.
Add a requirements.txt file
- This is pretty important given you are using requests, which isn't in the standard library
Documentation
Right now there isn't any. Take a look at code based documentation. Perhaps something like pdoc, which is pretty nice. Pycharm I am pretty sure supports even writing most of it...
Code specifics
You might want to look at the Python typing library. It is very easy to add type hinting to your library and it allows IDEs like Pycharm to auto predict types being passed back or into functions etc. It makes them a lot easier to work with, especially when using custom classes.
Classes for items being returned might be useful? For example, a Task class?
I am a much bigger fan of fstrings than + syntax, given auto type casting. This one is up to you.
I don't know if you have tried out Python @Property, but they can be a very clean way to return values from a class, without requiring them to be treated as functions. It is simply cleaner when you don't have a value to pass in. For example
After taking a look over the project, I can make a few suggestions @TreasonMay .
Project structure
Laying out the project as a library
PEP8 support
Add a .gitignore file
Splitting out into multiple files
auth.pyfile,tasks.pyetc etc.Examples
Add a requirements.txt file
- This is pretty important given you are using requests, which isn't in the standard library
Documentation
Code specifics
Hopefully that is enough to get your started for now.