beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.66k stars 372 forks source link

Add support for Apple watchOS #5

Open freakboy3742 opened 8 years ago

freakboy3742 commented 8 years ago

Now that the Python iOS support libraries support watchOS, Briefcase should also support that platform.

This will involve:

souravsingh commented 8 years ago

I would like to work on this issue

freakboy3742 commented 8 years ago

Awesome! Thanks for offering to help out!

The first step - fire up XCode, and create a new, blank Apple Watch project. Historically, I've called that project "Aaaa Bbbb", with an executable name of XXXXXXXX, from company YYYYYYYY.ZZZZZZZZ - having strings like that in the project make it much easier to build a template later.

You should be able to copy the bootstrap main.m from the iOS/tvOS template, and invoke a simple "hello world" Python script. It won't do anything other than print to the console, but that's enough to get a template going.

souravsingh commented 7 years ago

@freakboy3742 This is fixed now, correct?

freakboy3742 commented 7 years ago

Not really - there are stubs there for most of the pieces, but I haven't seen a "hello world" app running on an Apple Watch (or simulator).

ghost commented 7 years ago

Is this being managed? or may I help? please

freakboy3742 commented 7 years ago

@Ry10p - sure - especially if you've got access to a physical Apple Watch. I don't, so I haven't been able to test any builds.

So - if you want to look into this, the first step is to build - completely independent of Briefcase - an XCode project that includes and uses Python that will run on an Apple Watch. It doesn't have to do anything - just print "Hello world" - but that will establish what we need to template for the benefit of Briefcase.

ghost commented 7 years ago

@freakboy3742 Sir,

I unfortunately do not have access to an apple watch.

I am more than willing to emulate the "watch os".

If this is OK I would love to help out, if you would rather a REAL apple watch I will work on another issue :).

freakboy3742 commented 7 years ago

Oh, sure - you can use the emulator if you want. I figured that it wouldn't be as interesting as a problem unless you actually had a watch to use the end product. If you want to fiddle around with the emulator, that's fine, too.

ghost commented 7 years ago

LOVE IT

Ill start right away!

Thank you! -Ryan Carl

ghost commented 7 years ago

@freakboy3742

Update on the Project: Steps I have taken so far...

  1. fire up XCode, and create a new, blank Apple Watch project

  2. I've called that project "Aaaa Bbbb", with an executable name of XXXXXXXX, from company YYYYYYYY.ZZZZZZZZ.

  3. Forked the Python-iOS-template to create a copy of the bootstrap main.m.

Are the next steps to download the frameworks and create a "Hello world" app using the frameworks that have found at this location https://github.com/pybee/Python-iOS-template/tree/3.5?

freakboy3742 commented 7 years ago

@Ry10p Correct - A Hello World app is the next step.

meichthys commented 6 years ago

@Ry10p Have you made any progress on this? I'd be interested in working with you to move this issue forward. (I have a physical Apple Watch that i can use to test things out.)

ghost commented 6 years ago

@meichthys

You can for sure take this one, I am attempting to emulate the watchOS but my computer has been not allowing the emulation of the macOS system. I have been attempting to fix this with VirtualBox.

Fire up XCode, and create a new, blank Apple Watch project

Call that project "Aaaa Bbbb", with an executable name of XXXXXXXX, from company YYYYYYYY.ZZZZZZZZ.

If you have any problems please feel free to ask and I will attempt to help out, I have completed the build on:Android, Linux, my friends macOS, and Windows... So I can help out a little.

ghost commented 6 years ago

@meichthys

issuexcode
meichthys commented 6 years ago

@Ry10p Ok. I'll see what I can do and will be in touch if (when) i run into some roadblocks.

meichthys commented 6 years ago

@Ry10p I'm able to build a iOS app with a watchOS target, but i'm not sure where to add the python code. What are we trying to accomplish here?

meichthys commented 6 years ago

I can build a HelloWorld app in Xcode without much problem, but that doesn't seem to help much if we're not using python for the app...

ghost commented 6 years ago

@meichthys

Could you possibly detail your process?

Are you building for tvOS with Beeware Breifcase, then importing the resulting build into Xcode to run?

meichthys commented 6 years ago

@Ry10p

I've tried it multiple ways:

  1. Using Briefcase (i don't think this is what we want to do at this point as per @freakboy3742) a. Use Briefcase tutorial (https://briefcase.readthedocs.io/en/latest/tutorial/tutorial-1.html) b. Package using python setup.py ios -s c. Open resulting project in Xcode i. Add a WatchOS target (File -> New -> Target... -> Choose WatchOS App ii. Run Simulator: iOS app runs as expected with gui from Briefcase tutorial. WatchOS app opens but is blank.

  2. Using Xcode (i believe this is what we're trying to do at this point) a. Fire up XCode, and create a new, blank Apple Watch project i. Call that project "Aaaa Bbbb", with an executable name of XXXXXXXX, from company YYYYYYYY.ZZZZZZZZ. b. Not sure what to do from here. It seems like we should be adding some python code somewhere, but i'm not sure where.

I think part of the confusion for me is that watchOS apps aren't stand-alone like iOS and tvOS apps are. WatchOS apps are some kind of extension (to an iOS or tvOS app) which doesn't seem to have a main.m file.

meichthys commented 6 years ago

@freakboy3742 @Ry10p
Bump.

ghost commented 6 years ago

@meichthys Im doing some asking around, sorry about the wait ill try to figure it out also.

I think I have access to a physical watch tomorrow and will git it a try.

Could you please provide a picture of the error or the error code?

meichthys commented 6 years ago

@Ry10p Ok, no problem.

I'm not getting an error or error code. I'm able to build the applications fine, I'm just not sure where to put the python code for the watch app.

When you get your AppleWatch and start working on this, let me know, maybe we can chat on Gitter or irc to tag team the issue.

meichthys commented 6 years ago

@Ry10p Did you get a chance to play around with the Apple Watch today - just curious.

meichthys commented 6 years ago

@Ry10p Just wanted to check in to see if you had a chance to make any progress on this issue.

If I'm being to much of a bother, just let me know and i can buzz off and look for help elsewhere.

glyph commented 5 years ago

Is anyone still working on this?

freakboy3742 commented 5 years ago

@glyph I'm not aware of a anyone actively working on this at the moment.

meichthys commented 5 years ago

@Glyph I haven’t had time recently to work on it, but if you wanted to tag team it, I’d still like to help out in whatever way I can.

glyph commented 5 years ago

Thanks for the updates! Unfortunately I don't think I have the relevant expertise to start this from scratch :(

meichthys commented 4 years ago

@freakboy3742 In your initial comment on this issue you mentioned that:

the Python iOS support libraries support watchOS

Do you know if the 32 bit architecture is supported in those libraries? @paulproteus was helping me take a look at this and it appears that pyconfig-i386.h is required but missing from the iOS support files (at least the files that are bundled with the iOS xcode project that is generated by briefcase).

freakboy3742 commented 4 years ago

@meichthys The watchOS build should have support for i386 and armv7k. pyconfig-i386.h won't be part of the briefcase template, though - it will be part of the watchOS support package (e.g., this one for Python 3.7).

The iOS project doesn't support i386 any more, because the only supported devices using 32-bit platforms are from the iPhone 5s era. iPhone 6 onwards use arm64.

meichthys commented 4 years ago

@freakboy3742 Thanks for the link to the WatchOS support package. That's what i was looking for.

mobile-appz commented 4 years ago

@freakboy3742 Thanks for the link to the WatchOS support package. That's what i was looking for.

Any luck with this @meichthys ?

meichthys commented 4 years ago

@mobile-appz I felt like I was making some progress but it was a little over my head. I was never able to get a watchOS app to compile and run python.

mobile-appz commented 4 years ago

@mobile-appz I felt like I was making some progress but it was a little over my head. I was never able to get a watchOS app to compile and run python.

@meichthys thanks very much for the update. Just in case you haven't seen this already have had a response from @freakboy3742 here too: https://github.com/beeware/Python-Apple-support/issues/87

meichthys commented 4 years ago

@mobile-appz, @freakboy3742's response in #87 is spot on. The watchOS projects in Xcode are different than iOS. Initially in XCode you could only build a watchOS app as an iOS app 'extension', but recently (i think since watchOS6) it is possible to build standalone watchOS apps which should make integration with beeware\briefcase somewhat more straightforward. My issue was that I had little previous experience with building watchOS apps and am not familiar enough with the structure of XCode projects to figure out where to put things and how to configure the XCode project settings. If you have some prior experience, keep the ball rolling on this! It would be super cool to see python running on an AppleWatch!

mobile-appz commented 4 years ago

Hi @meichthys pleased to confirm a basic "hello world" app with Python is working on Apple Watch series 3. It simply prints "Hello World" to the console. Please see some more info here about how this was set up in Xcode. The main thing was linking the .a files of the binaries correctly in Xcode, and setting up the header search paths correctly in order that Xcode is able to find python. https://github.com/beeware/Python-Apple-support/issues/87#issuecomment-633051207

meichthys commented 4 years ago

Great news! I tried liking the .a files and mapping the headers but I must have missed some! I’ll take a look at your write up in the other issue and give it a shot later today.