Plugin Style
So you want to provide some functionality for Arkitekt?
THANK YOU! We are always looking for new Apps and Nodes to be added to the Arkitekt Ecosystem. This guide will help you get started with creating your first App and Node.
This tutorial assumes you have a basic (really basic) understanding of the command line and have arkitekt installed on your computer. If you don't have arkitekt installed, check out the installation guide.
Creating a new Apps
The integrated Style revolves around the concepts of Apps. So lets create one. Open up your terminal in a new folder, where you want to create your new app and run :
arkitekt init
This should start an installation wizard, which will guide you through the process of creating a new app and will ask you a few questions about your app. Your Manifest.
A few words about the questions asked in the wizard, no worries you can always change them later.
-
App Identifier - This is the name of your app. This should be a unique name, which identifies your app. Think of something cool, like
stardist
orkalkulator
. It should be something that your users will remember. -
App Description - This is a short description of your app. It should be a short sentence, which describes what your app is best at. No need to describe your functionality here (thats what Nodes are for), but rather why you designed your app.
-
Scopes - Scopes, will give your apps certain rights to do things on your behalve ( like accessing your images), so you should only give your app the scopes it really needs right now. You can always add more scopes later. These scopes will be also asked when others will want to install your app. So make sure you only ask for the scopes you really need.
-
Logo - This is the logo of your app. You can either choose a local path relative to your app folder or a url to an image. The image will be displayed in the (soon to come) app store and when others use your app.
-
Author - This is the author of your app. This can be your name or the name of your company. By default it will use your username, but you can change it to whatever you want.
Once you are done, you should see a new folder called .arkitekt
in your current directory. As well as a new file called app.py
.
These are the main files that make your app. Lets inspect them both.
The .arkitekt folder
The .arkitekt
folder contains all the configuration files for your app. It will grow some more files once you build and publish your app,
but for now it should only contain a file called manifest.yaml
, the Manifest of your app. Once you delete your
.arkitekt
folder, your app will be gone. So make sure you don't do that !
The app.py file
This is the main file of your app. And the entrypoint that the CLI will call when running your App. It is a python file, that contains all the Nodes of your app. Lets open it up
from arkitekt import register
@register
def hello_world(name: str) -> str:
"""Hello World
This is a simple Hello World Node, that will greet you by your name.
and print it to the console.
Args:
name (str): Your name
Returns:
str: A greeting
"""
greeting = f"Hello {name}"
print(greeting)
return greeting
This is the default code that is generated for you. It contains a single function that defines and implement the "Hello World" Node Node. Its pretty straigtforward but lets break it down:
from arkitekt import register
This is defining import that make this python code an Arkitekt. register
is a decorator that can mark any function in your app, as a Node.
You can have as many Nodes as you want in your app, and once you run your app, they will become available on the Arkitekt Server and
can be used by others.
Lets do just that, lets run our app.
Interlude
Before we can run our app, we will need to start our Arkitekt Server and make sure our app can connect to it. Please make sure you installed an Arkitekt Server and have it running. For strategies of how to do that, check out the installation guide.
Running your app
Open up your terminal and run:
arkitekt run dev --url localhost:8000
This will start your app in development mode and connect it to your local Arkitekt Server. You should see something like this:
If you are running your Arkitekt Server on a different port or host, you will need to change the --url
parameter accordingly.
You don't need to specify any protocol, as the CLI will try to autodetect it. If you omit the --url
parameter, it will default to localhost:8000
the default port of the Arkitekt Server.
And thats is. Your app is now running and you can start using it. Lets try it out. For that we can open up the Orkestrator App and reserve our app. And that's it You can now start using your app. Lets try it out.