This article covers how to get started with enaml-native and create your first app.
The process is:
Instructions for each step is described below.
enaml-native uses the
conda package manager.
Download and run the installer from conda.io/miniconda.html.
Once installed you should be able to run
conda --version from the command line to see which version you have and make sure it was installed correctly.
Next the Android and iOS SDK's need installed.
Tools->Android->SDK Managerfrom the menu
SDK Platformstab, select the latest
SDK Toolstab, select
Android SDK Build-Tools <version>,
Android SDK Platform-Tools, and
Android SDK Tools(they should be selected by default)
iOS apps can only be built with a mac or macbook running OSX.
You must install
xcode from the App Store before continuing.
The enaml-native-cli is installed with pip
pip install enaml-native-cli
After installing, run
enaml-native --help to see the available commands.
Note: You can install the latest dev version using
pip install git+https://github.com/codelv/enaml-native-cli.git
To create a new project use the cli to init a new project.
# Within the folder of choice enaml-native create app
Now cd to the destination folder, activate the virtual env, and build the python and ndk libraries.
#: Go into project folder cd HelloWorld #: Activate the venv source activate HelloWorld
Now either start the emulator or plug in a phone and we can run with
If all went well the app should start and display your apps name. If you run into issues, you can ask for help on gitter.
Note: If you get errors, try installing the latest dev version by cloning
git clone https://github.com/codelv/enaml-native.gitand building with
conda build enam-nativethen installing it with
conda install -c local enaml-native.
You can now make changes to your source code or continue to learn the basics.
Your app's code resides in the
src directory. Any files here get installed on the app.
view.enaml contains the UI that is shown, and
main.py is the startup script.
To use 3rd-party python packages in your app they must first be built for
Android or iOS using conda-mobile.
Once built, they can simply be installed into your apps environment:
environment.ymlfile under the dependencies section
enaml-native installcommand is just a wrapper for
conda install, you can also use
Once installed you can rebuild the app and your new packages should be available on the app!
Since rebuilding the app every time you need to make a change is very slow,
enaml-native includes a few dev tools to help speed things up.
src/main.py and change the
dev= line to say
def main(): with enaml.imports(): from activity import MainActivity Application = get_application() app = Application( debug=False, # Uncomment to debug the bridge dev='server', # Set to 'server', 'remote', an IP address activity=MainActivity(), ) app.start()
Now rebuild the app with
enaml-native run-android. Find the IP of your device (over wifi) and go to that ip in your browser at port
http://192.168.x.y:8888 and it'll show an editor just like the playground app.
Note: You can also debug using port forwarding over adb with
adb forward tcp:8888 tcp:8888
For other development modes, see Debugging