These are chat archives for pybee/general

1st
Mar 2017
mohit-0212
@mohit-0212
Mar 01 2017 06:17
Hello developers. I read about your organization, and it would be interesting to work with you. I was particularly interested in your VOC project, converting python files to java class files, as I have always felt the need for such cross-compatibility. It would be great if anyone of you could suggest me how to begin making contributions, and get familiar with your codebase.
It would be great working with you in summers if given the opportunity.
Russell Keith-Magee
@freakboy3742
Mar 01 2017 06:50
@mohit-0212 Fantastic! Our guide for first time contributors is here: http://pybee.org/contributing/how/
If you’ve got any questions, just ask! We’re more than happy to help
@Sanjeev-S It sounds like you’re getting tied in knots over different virtual environments. The SyntaxError would be consistent with running the project under Python 2; getting “command not found” sounds like you’ve installed cricket somewhere other than your Batavia virtual environment.
Sanjeev
@Sanjeev-S
Mar 01 2017 07:09

@freakboy3742 Thanks :) . Since you confirmed that I was doing everything else right, I redid the environment setup(because I had already python3). Actually the problem was that I forgot to run npm install to install the Javascript dependencies. And now cricket is running all the tests currently.

During installing cricket, I got a "ImportError: No module named '_tkinter', please install the python3-tk package" but that was easily solved by sudo apt-get install python3-tk . I could add that to the Troubleshooting part of the documentation, if that would make sense.

leasunhy
@leasunhy
Mar 01 2017 09:55
Hi, I wonder where I can find some docs on voc internals?
Say, what does module$import does?
Sanjeev
@Sanjeev-S
Mar 01 2017 10:25
The tests finished running. I am getting failures in test_mktime_args and test_mktime_dst.
https://drive.google.com/file/d/0B9j9MJrQhCt2Y1BPVFptenhBRXc/view?usp=sharing
Oleh Kuchuk
@hzlmn
Mar 01 2017 10:55
Hi, i was wondering if there is doc on batavia internals for faster getting started?
Current link on README is broken...
Russell Keith-Magee
@freakboy3742
Mar 01 2017 11:14
@hzlmn Apologies for the confusion; the README hasn’t been updated after a bit of a re-organization of the docs.
We don’t have a good guide to the internals of Batavia; the link on the README was really a placeholder document. The content that was there is now contained in the “Using Batavia” section of the docs.
@Sanjeev-S If those two tests are failing, it suggests a problem with the timezone configuration on your computer. However, it’s difficult to tell exaclty what has gone wrong without the full trace from the two failing tests - the screenshot you’ve provided cuts off just before it gets to the interesting part of the test_mktime_dst test, and doesn’t show the test_mktime_args test.
Are you able to provide the full stack trace for those two failures?
Russell Keith-Magee
@freakboy3742
Mar 01 2017 11:20
@leasunhy Unfortunately, there isn’t much by way of documentation of VOC internals at this point. However, module$import is the method that is invoked when a class representing a Python module is imported. It’s managed separately to the Java static block so that we can retain control over the order of execution, and separate the execution of that block from the Java import process.
@Sanjeev-S Ubuntu does a bunch of odd things with TK packaging; so yes, adding a note about that requirement would be helpful. That said - in the near future, I’m hoping to move Cricket to use Toga, rather than Tk, so those problems will hopefully go away.
Sanjeev
@Sanjeev-S
Mar 01 2017 12:07

The full stack trace of both the failures
test_mktime_args
https://codeshare.io/5oQK9M

test_mktime_dst
https://codeshare.io/Gkm6BM

Rachit Kansal
@RachitKansal
Mar 01 2017 13:39
Hi everyone, found PyBee in GSoC. I'm really interested in contributing for the Ouroboros project. Can someone please help me to get started?
Cody Scott
@Siecje
Mar 01 2017 13:40
I didn't even know about Ouroboros
@RachitKansal Have you setup a development environment and run the tests?
Rachit Kansal
@RachitKansal
Mar 01 2017 13:54
no I haven't set it up yet. I'll be doing it now.
shim1998
@shim1998
Mar 01 2017 14:36
my VOC is not working
Manish Kushwaha
@mohit0749
Mar 01 2017 15:17
hi
I'm interested in VOC project. Can someone help me to get start with it?
Sanjeev
@Sanjeev-S
Mar 01 2017 15:20
@mohit0749 Did you read the first time contribution guide? :)
https://github.com/pybee/voc/wiki/Your-first-VOC-contribution
Manish Kushwaha
@mohit0749
Mar 01 2017 15:20
yes
Sanjeev
@Sanjeev-S
Mar 01 2017 15:21
@shim1998 Where did you get stuck?
Manish Kushwaha
@mohit0749
Mar 01 2017 15:22
i'm just the beginner in java. is it enough?
Lakshay Chotiya
@Lakshayk
Mar 01 2017 15:45
hi
Abhidnya Andraskar
@gEt-rIgHt-jR
Mar 01 2017 15:48
Hello, I'm Abhidnya.
I'm experienced in Java and Android app development
Can anyone help me to get started? And where should I focus? :)
Cody Scott
@Siecje
Mar 01 2017 16:22
@gEt-rIgHt-jR Have you seen https://github.com/pybee/voc?
Abhidnya Andraskar
@gEt-rIgHt-jR
Mar 01 2017 16:32
Yes
I've forked it as well, now I'm testing it
Chiang Fong Lee
@cflee
Mar 01 2017 16:38
Oleh Kuchuk
@hzlmn
Mar 01 2017 16:54
@freakboy3742 I was thinking about starting translation docs to Russian. Do your interested in it, and what parts do you think must be translated earlier if so? Thanks
for Batavia project
Deepankar Agrawal
@deep110
Mar 01 2017 16:59
@cflee Hi, I have submitted a PR pybee/voc#371, since this is first PR in this org, can you point out any mistakes I have made. Thanks in Advance :)
Chiang Fong Lee
@cflee
Mar 01 2017 17:07
@deep110 great to see your first PR! now we have to wait for the tests to run on Travis CI, I think it takes about an hour plus if there’s nothing else queued, but you can check on it at anytime
if your implementation of the methods are correct, then some tests should begin passing! in this case, probably test_complex inside test_abs.py, and so on
the test suite, whether you run it locally or on Travis CI, should report those as “unexpected success”. you’ll have to remove the specified tests from their respective not_implemented array inside the test cases to tell the test suite that those tests are supposed to pass
Deepankar Agrawal
@deep110
Mar 01 2017 17:10
Thanks!! And one more thing, I wanted to write tests of methods I have written, but couldn't find a proper example, so I don't think travis CI would be passing. Can u point me point some useful resource.
Chiang Fong Lee
@cflee
Mar 01 2017 17:11
in this case I think the __abs__() method is being called by the abs() builtin method
Deepankar Agrawal
@deep110
Mar 01 2017 17:11
yes
Chiang Fong Lee
@cflee
Mar 01 2017 17:11
there should be something under tests/builtinsfolder
for conjugate() since it’s a method only for the complex type, you’ll probably want to put the test in those for the type. so tests/datatypes/test_complex.py
Deepankar Agrawal
@deep110
Mar 01 2017 17:13
okay, got the distinction
Chiang Fong Lee
@cflee
Mar 01 2017 17:13
if you look around inside their respective folders you’ll find some other datatypes/builtins already have tests written
i think int, float, list are pretty well tested by now, but best to just poke around there
Deepankar Agrawal
@deep110
Mar 01 2017 17:13
cool, I will look into those and update my PR, Thanks!!
Chiang Fong Lee
@cflee
Mar 01 2017 17:14
great! we all look forward to that!
oh, and just some really minor code style things – we usually have spaces around operators like * and +, and also a space after the cast parentheses (Float) this.imag…. :)
Deepankar Agrawal
@deep110
Mar 01 2017 17:17
okay, and btw any IDE prefrence or any1 you would recommend, I mostly use eclipse for java
Chiang Fong Lee
@cflee
Mar 01 2017 17:20
shrug, I think that’s mostly a personal preference. I just use a text editor. maybe other folks here will have recommendations!
Rachit Kansal
@RachitKansal
Mar 01 2017 18:40
while setting up environment for Ouroboros, there is no file named requirements_dev.txt, can someone guide me what to do?
Cody Scott
@Siecje
Mar 01 2017 19:25
@RachitKansal Maybe you don't need to install any additional requirements just continue and see if it works
Oleh Kuchuk
@hzlmn
Mar 01 2017 19:31
Read issues please pybee/ouroboros#8
Elias Dorneles
@eliasdorneles
Mar 01 2017 21:42
@mohit0749 of course the more about Java you know, the better, but if you're willing to learn on your own, it's perfectly possible
Also, there are many contributions that can be done that don't require writing code: for example, testing with different inputs and reporting problems. :)
So, I'm trying to use a button in my Android Python app
This is my code:
from android.view import View


class ButtonClick(implements=View.OnClickListener):
    def onClick(self, view):
        print('view', view)

# ...
    button.setOnClickListener(ButtonClick())
Elias Dorneles
@eliasdorneles
Mar 01 2017 21:48
but I'm having a runtime error:
RuntimeError: Failed resolution of: Lorg/eliasdorneles/tictactoe/app/ButtonClick;
Russell Keith-Magee
@freakboy3742
Mar 01 2017 21:48
@eliasdorneles IIRC you’ll need to reference the implements= class directly - VOC currently uses the string directly, rather than loading the symbol.
Elias Dorneles
@eliasdorneles
Mar 01 2017 21:49
you mean, ButtonClick(implements='View.OnClickListener') ?
Russell Keith-Magee
@freakboy3742
Mar 01 2017 21:49
i.e., implements=android.view.View[OnClickListener]
Elias Dorneles
@eliasdorneles
Mar 01 2017 21:49
ohh, I see
Russell Keith-Magee
@freakboy3742
Mar 01 2017 21:50
Because OnClickListener is an inner class (hence the subscript notation); and even though you’ve imported android.view, VOC doesn’t know about that namespace when it’s resolving implements and extends statements.
Elias Dorneles
@eliasdorneles
Mar 01 2017 21:51
hmm, good to know.
but that didn't help, still getting the same error :/
ohh, wait
I wasn't using the subscript, hang on
okay, worked now, thanks! :smile:
now I get an interesting error when I click the button:
E/AndroidRuntime( 4944): AttributeError: 'ButtonClick' object has no attribute '__float__'
E/AndroidRuntime( 4944):     at android.view.View.performClick(View.java:4780)
Russell Keith-Magee
@freakboy3742
Mar 01 2017 21:53
Huh… that’s a new one for me...
your onClick method in the handler - have you annotated it?
Elias Dorneles
@eliasdorneles
Mar 01 2017 21:55
nope, this is what I have:
class ButtonClick(implements=android.view.View[OnClickListener]):
    def onClick(self, view):
        print('view', view)
Russell Keith-Magee
@freakboy3742
Mar 01 2017 21:56
ok - so that should be onClick(self, view: android.view.View): -> void
Oleh Kuchuk
@hzlmn
Mar 01 2017 21:57
Guys, is there are any way for speed up test executions for Batavia? It takes at least 30 min to run all ? (
Russell Keith-Magee
@freakboy3742
Mar 01 2017 21:58
@hzlmn Unfortunately not. It’s just slow. If you’ve got a multicore CPU, you can use py.test to parallelise the test suite - but it’s still going to take 10-15 minutes.
Any suggestions on how to speed things up would be greatfully accepted.
Elias Dorneles
@eliasdorneles
Mar 01 2017 22:02
Awesome, it works now! Thanks for the help! :bow:
Russell Keith-Magee
@freakboy3742
Mar 01 2017 22:02
Most welcome!
Elias Dorneles
@eliasdorneles
Mar 01 2017 22:02
I assume the annotation is needed whenever I need to call Python methods from Java, right?
it makes sense, I was curious how it would choose the method
Russell Keith-Magee
@freakboy3742
Mar 01 2017 22:02
BTW: The annotation is needed so that the right method prototype is rolled out in the bytecode. Without annotations, VOC assumes everything is an org.python.Object, which won’t meet the interface requirements.
Elias Dorneles
@eliasdorneles
Mar 01 2017 22:07
ahh, gotcha!
Russell Keith-Magee
@freakboy3742
Mar 01 2017 22:07
Not sure why that manifests as __float__ not existing, though...
Oleh Kuchuk
@hzlmn
Mar 01 2017 22:16
@freakboy3742 I don't know are there are any test tools, that can use benefits of asyncio for running tests asynchronously?
Also maybe I am wrong, but as i can see, there are no code that heavily rely on python in current tests so I can provide little sample by writting some tests in js/node . It should improve speed as it async by nature and there many io operations.
What do you think?
Russell Keith-Magee
@freakboy3742
Mar 01 2017 22:17
@hzlmn asyncio isn’t magic fairy dust that makes things faster - you have to have a scenario that is IO bound and can be decomposed into non-blocking operations.
Batavia’s test suite doesn’t meet the second requirement.
and I can’t see any easy way to convert it so that it would.
The bulk of the speed problem is caused because starting Node.js Just Takes Time.
and it’s started 10k times over the entire Batavia test suite.
Elias Dorneles
@eliasdorneles
Mar 01 2017 23:21
namely, essentially the same problems for VOC (except Java compilation and JVM instead of node)
Russell Keith-Magee
@freakboy3742
Mar 01 2017 23:21
Exactly.
I completely agree that the test suite takes way too long to run (on both projects), but I’m not sure I have any ideas on how to run it faster.
Sanjeev
@Sanjeev-S
Mar 01 2017 23:26

@freakboy3742
The full stack trace of both the (possibly timezone related) failures I am getting
test_mktime_args
https://codeshare.io/5oQK9M

test_mktime_dst
https://codeshare.io/Gkm6BM

Russell Keith-Magee
@freakboy3742
Mar 01 2017 23:27
@Sanjeev-S Ok - and what does your computer report as your timezone?
(and, I suppose- what is your actual timezone)
Sanjeev
@Sanjeev-S
Mar 01 2017 23:29
Time zone is Kolkata
India timezone
Russell Keith-Magee
@freakboy3742
Mar 01 2017 23:31
Ok - so IST, which is UTC+0530, with no DST?
Sanjeev
@Sanjeev-S
Mar 01 2017 23:31
Yepp
Russell Keith-Magee
@freakboy3742
Mar 01 2017 23:32
Ok. So, at this point, we need your help to diagnose this, because it’s very difficult for anyone who isn’t in IST to reproduce the problem.
Sanjeev
@Sanjeev-S
Mar 01 2017 23:33
Alright.
Russell Keith-Magee
@freakboy3742
Mar 01 2017 23:33
What we need you to do is open up the code in the browser testbed, and set a break point here: https://github.com/pybee/batavia/blob/master/batavia/modules/time.js#L146
then walk through the code, and see if you can work out where it’s going wrong.
Essentially, your’e getting answers that are 3600s out from expected values
Which is exactly 1 hour.
So it looks like the mktime code is applying DST when it shouldn’t.
Sanjeev
@Sanjeev-S
Mar 01 2017 23:34
Alright, I'll take a look
Russell Keith-Magee
@freakboy3742
Mar 01 2017 23:34
This might be because our DST database is incorrect; or there might be something else going on.
Sanjeev
@Sanjeev-S
Mar 01 2017 23:35
So basically both the functions are trying/using the time from my computer and it is off by one hour?
Russell Keith-Magee
@freakboy3742
Mar 01 2017 23:36
Essentially, yes - it’s getting a time, and it’s adjusting it based on what it thinks DST adjustment should be… and it’s getting it wrong.
Now, I know that this code works in AWST (UTC+8, no DST). AEDT (UTC+11, with DST), BST (UTC-5, No DST), EST (UTC-4 in a location that has DST, but isn’t currently active).
I don’t know what combination of things is going wrong with IST, but clearly something is off.
Sanjeev
@Sanjeev-S
Mar 01 2017 23:39
Maybe it's the problem with DST database? Where are you getting it from?
Sanjeev
@Sanjeev-S
Mar 01 2017 23:49
Browser testbed is for running python scripts, right?
Russell Keith-Magee
@freakboy3742
Mar 01 2017 23:49
Sort of. It’s a sample project that actually uses Batavia; it allows you to type in Python code and see it running in the browser.
It’s the simplest possible demo of “look, Batavia works” that you could build.
But it also happens to be very helpful for debugging, becase you can just plug in your code and watch it run.
Sanjeev
@Sanjeev-S
Mar 01 2017 23:51
But time.js is a javascript file. Do you mean set the break point locally in my system and debugg by running sample.py and seeing the effect?
Russell Keith-Magee
@freakboy3742
Mar 01 2017 23:52
You’re running Python code, but it runs as Javascript (because it’s in the browser). That means you can set a Javascript breakpoint and watch time.js run, and debug it’s operation.
Sanjeev
@Sanjeev-S
Mar 01 2017 23:58
I'm clearly missing something, I dont think you meant like this:
https://drive.google.com/file/d/0B9j9MJrQhCt2U25jSjlUT2xrMnc/view?usp=sharing
Russell Keith-Magee
@freakboy3742
Mar 01 2017 23:59
Ok - that text box should be python code
Just type some python code, and hit Run
then set a breakpoint in the web inspector.