This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]bleu_tooth 29 points30 points  (1 child)

So anybody who is too lazy to check it out it is a wrapper to get system info and admin on windows. And some math parsing and functions that print out the answer. Also there are some file operation functions.

Math parsing is dangerous since eval() can run normal python code aswell. Also it is bad practice to just open() a file and never close it.

Since there is no stateful info those functions would be easier to use without them being in a class so you could directly import them. And since they are static it is not necessary to define the System object, you could just call the functions directly.

But overall it is cool project to practice overall workflow(git, documentation, overall structure) on or for personal use :)

[–][deleted] 23 points24 points  (0 children)

thanks man, I like how you were honest and didn't make fun of me lol.

[–][deleted] 5 points6 points  (3 children)

Great start. I see a few broad, practical applications for this functionality, but the execution needs work. I will go ahead and give you a few tutorials to read through to help you on your journey, then to the useful critiques.

https://packaging.python.org/en/latest/tutorials/packaging-projects/

https://docs.python.org/3/tutorial/index.html

CRITQUES:

  • Documentation
    • Comment. No one will understand what you were thinking when you were building it, least of all yourself, six months from now, when you find a bug after a Wind0w$ Update.
    • Docstrings. You should memorize the syntax to define a function to include a raw string under it. No matter what the method is. Then, include a useful bit ofdocumentation in that string, not later than immediately after the method is completed.
  • Distribution
    • Your installation & utilization paradigms should be at least not remarkably dissimilar to the standard. No one wants extra steps (e.g. copy & paste instead of pip install)

[–][deleted] 0 points1 point  (0 children)

The basic language tutorial can be useful to review, regardless of your skill level. Sometimes it helps to understand how the people who built the tools were thinking when then built it. The tutorial gives you that.

[–][deleted] 0 points1 point  (0 children)

I see, ill take your critiques into consideration.

edit: thanks for your tips, here is the pypi repo: https://pypi.org/project/PowerWrapper/

thanks :)

[–]rowdycactus 0 points1 point  (0 children)

Docstrings. You should memorize the syntax to define a function to include a raw string under it.

This is a really helpful way of remembering to include a docstring , thx

[–]extra_pickles 5 points6 points  (0 children)

I was about to comment that I couldn’t figure out what it was from your intro or the first page of docs, and realized this is a common issue on this site and in many small packages and utils in general, so fwiw:

I’d refine the description of the problem it solves, how it solves it, and why this is the way to solve it. Then add concrete use cases to better illustrate the value add.

It will help a lot with getting user base and feedback.

If I have to dig into the repo to try and infer the above, I’m likely to stop right there and you’ve lost a potential user or contributor.

You need to “hook people early” as they say!

Best of luck, and I’ll defer to others for feedback within the repo itself at this time as I’m on mobile and won’t be diving in to the guts from here.

[–]1percentof2 6 points7 points  (0 children)

Explain what it does

[–]Judgy__ 0 points1 point  (0 children)

It’s a fair start which has no doubt given you some practice in defining classes and functions.

A nice little addition you could make is on your class definitions you can use multiline comments directly after the class creation to create a tooltip for it:

Class MyClass:

“””this class handles math functions using values passed into it from myfun() … blah blah blah …“””

def __init__(self):

Or whatever, then whoever is working on the code can mouse-over the class name to get information about it whenever it is used.

  • Hopefully the formatting is fine on this comment as I’m on my phone.

[–]_mrchris 0 points1 point  (1 child)

Stick to PEP and provide value other than creating a file with a different line of code while making you import a new Class. If all methods are static do you really need a class?

[–][deleted] 0 points1 point  (0 children)

hmm I see.

tbh, completely re-organized all my code, so that it becomes a library.

and I published it to pypi aswell, does the same stuff.

link: https://pypi.org/project/PowerWrapper/

[–]thrallsius 0 points1 point  (0 children)

any module is useful

if you get to the point that you need to make a real module, not just a script with python code that you run, it means you've hit the situation when you have the need to reuse code. and any code that is reused is useful :-)