Hackathon Challenge set by ccc (started new thread)
-
@ccc, I have some questions. I hope you don't mind I started a new thread here. Was not sure we're to put it, Pythonista or General. So to be safer I put it here.
Hackathon Challange: write code that uses the Python inspect module to find all the functions and methods in the ui module and auto generate a ui.py file that has those same functions and modules stubbed out (with pass statement) such that an editor like sublime or PyCharm on Windoze or a real computer (e.g. Mac) will do autocompletion on all functions and methods of Pythonista ui code. All winning entries must 1) deliver correct code completion for all ui methods and functions, 2) pass all PyCharm PEP8 compliance tests (esp. line length) and 3) be posted in a GitHub repo by 8am Eastern time on Monday 14 Dec 2015 time. If there are multiple entries that pass the above tests then the shortest number of (nonblank) lines of code wins.
Can you complete the challenge?!?
-
last edited by
-
Ok, my one is here
I didn't exactly follow the challenge. But I am glad it's finished, can look at the other ones now.
-
@omz , the -2 is not about your submission, but about the edge cases in ui.py etc.... 😜
But out of interest, is the convert tabs tools menu item a call to inspect.cleandoc()?
In an ideal world, would you run that over your modules such as ui and dialogs when you publish, or do you do something else?
-
@Phuket2 I believe convert tabs uses this:
editor.open_file(os.path.abspath(os.path.join(sys.executable,'../pythonista_reindent.py')))
-
@JonB, ok thanks. Just doing this challenge got me thinking. I guess the best is not to think too much 😁 I learnt along time ago never to trust your input. But I had sort had forgotten that lesson. Learning and re-learning 👍
-
@JonB , sorry was a stupid question. I see now inspect.cleandoc() works on docstrings not the document/module
-
out of interest, is the convert tabs tools menu item a call to inspect.cleandoc()?
It's more or less what @JonB said.
In an ideal world, would you run that over your modules such as ui and dialogs when you publish, or do you do something else?
I don't really use anything to auto-format my code, I just try to make it look nice while I write it. I don't think any of my own Python code is PEP-8-compliant (I prefer tabs instead of spaces, and don't care that much about line length).
-
@omz said:
I don't really use anything to auto-format my code, I just try to make it look nice while I write it. I don't think any of my own Python code is PEP-8-compliant (I prefer tabs instead of spaces, and don't care that much about line length).
I break the exact same rules as you do in my code :) @ccc sometimes creates pull requests on my code just to shorten line lengths
-
LOL... https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds I have a little mind.
Remember, as the repo owner, you are always free to reject pull requests. ;-)
-
@Webmaster4o , you have to love it though 😀 @ccc beats me up on all sorts of what I thought was small stuff. But in the end it really has helped me. Well let's say helping....
-
@ccc but they're almost always things I want but didn't bother to do.
-
@ccc we need to see your repo within the next hour and half 😱
-
@ccc , do we get to see your repo?
-
So... I was not able to complete the hackathon myself. Year end at work is keeping me totally occupied so I got the first 30% done but had to abandon the effort. I will try to create another hackathon topic in the new year when I have more time to devote to it.
-
@ccc , that's a shame. But I understand. Was looking fwd to see what you had done. I know, I lost the plot somewhere 😁 It was still fun doing it though.
Look fwd to the next one in the new year
-
@ccc New hackathon topic: a fake
ui
module that actually makesTkinter
calls, but allows you to run UI scripts on a desktop computer! (This is unrealistic, but I'd love this support)
-
@Webmaster4o , I am sure it would been a challenging and may daunting for the best of the guys here. And a bit more than a part time thing. At least I think. But I think with the inclusion of the objc_util that ship has well and truly sailed.
But I used to think the same. Would so cool to have this ui on the Mac. I understand the cross platform needs, but from what I have seen briefly playing with TKinter, it's ugly. Not inspiring at all to build an interface. And compared to the ui module it's so convoluted.
I think if ui was available on macs as we see it here, would be a huge hit given that it didn't have to be cross platform. Even on Pcs for that matter. I just think that if was ever done, should be seperate projects with a shared interface. Not all these compromises to have a shared code base. They just don't seem to turn out right. Maybe there others on the market that are more elegant than I have seen.
But with a ui module style interface, I think it would be a death blow for AppleScript. It's amazing Python is sitting there in the background on macs and people resort to AppleScript.
Oh well, that's my 2 cents worth. So not just running Pythonista scripts on the Mac, but to give the Mac users a reason to want to use and learn Python without thinking they are stuck in a console . Very in appealing thought, also makes Python seem old and antiqued and should be only used by techie guys.
-
Tkinter doesn't look too bad on mac, I think it just looks crappy on a Windows/linux machine.
-
The way to get started is to pick just one class out of the UI module and implement that. Afterward, you will have a much better sense of the degree of difficulty and you will also have a demo to convince others to join your effort.
-
yeah. Right now I've got two other projects that are as much as I can handle (A chatbot, and an PHP API for retrieving my grades from my school's servers), but I'll consider this once I finish with these projects.