Run server-side code independent of an Anvil app

I tried xonsh, and I loved the few things I could do with it. But I work on Windows, where some of the shortcuts don’t work and if you press the wrong key, for example any arrow key, the terminal gets corrupted and, if you keep working without seeing what you do, it crashes after a few commands.

I first failed to configure neovim, now xonsh.

Linux is creeping more and more inside Windows with wsl2, but my Python environments interact with Excel and other software via COM, so I can’t jump the fence.

Oh well…

1 Like

Hi @owen.campbell

I’m revisiting and contemplating amoni now.

Why? I’m finding the cloud-UI development experience to be a bit nervous for my tastes and, as well, prefer to signal changes via vim(1)'s <ESC> :w! (not automatically saved by the UI). And other oddities.

So,…

Can I use amoni to perform most (or as much as possible) of my development coding locally (frontend, backend, Data Tables, with auto-completes, etc), and then be able to upload final assets to anvil.works cloud servers once complete?

This is my first Anvil.Works app, so it wouldn’t depend on any existing app on the cloud.

Note: I have one amoni environment running on my PC (per these instructions)

Is what I’m describing possible with amoni? Thank you.

You can do pretty much all of that simply by cloning your app using git, working on it locally and pushing the result back to Anvil.

Amoni just attempts to make somethings easier (like running a pre configured app server locally).

1 Like

I see. I missed that part of the Anvil documentation, but found it after you mentioned “Git” above. (Thank you).

Not having cloned any yet (I’m currently on the road), besides pushing changes back to Anvil frequently - perhaps to economize on successive pushes - can amoni be used to preview changes locally (mimicking how the App would ultimately appear on Anvil), and then a “mega push” be performed, say at end of day (or whatever)?

How might the setup sequence for that go:

  • git(1) clone […] MyAnvilApp
  • cd ./MyAnvilApp
  • amoni(1) init

Well, probably not exactly the nesting I created, but you probably understand what I’m driving at… How to integrate amoni with a git cloned Anvil App.

Thank you.

Yep. You can run the app server locally. Amoni just makes that easier using a docker container.

1 Like

Thank you.

Down the road perhaps I’ll contribute a podman-config.yaml(5) file. :relaxed: I don’t install docker-ce by default anymore because I use podman(1) atop Fedora (a drop-in replacement for docker(1), but sans a daemon).

Copying docker-config.yaml(5) to podman-config.yaml(5) may work without change depending on it’s structure, but may need a little tweaking. I’ve had to do that occasionally.

An any case, I look forward to app cloning and development atop the local amoni stack.

I decided against using podman for amoni. There are plenty of windows users on here and podman is Linux only.

It isn’t. Podman Installation
But if opposed in general, I’ll shelve the offer.

Nice. I didn’t know they’d done that. Been a while since I last looked at it.

1 Like

Yeah, things happen so darn quickly in our Zeitgeist. When I’m in MS-Windows these days, I notice the development differences less and less (once wsl2 is running). RedHat/Fedora (the creator of Podman) helped with the integration, and have been really pushing boundaries. Fedora, for example, has the Immutable filesystem but much more, too. This was off-topic, but figured I’d offer the contribution.

Back to the thread subject, later today I’m going to start a fresh App, git clone it, then try to determine how to get it to run atop amoni (I’m still unsure how to, but I haven’t tried anything yet :slight_smile: ).

If you’re planning to use amoni, don’t git clone your app first. Use amoni init to start your project and then amoni app add.

2 Likes

Excellent. I was just wondering about that. Thank you!

Hi Owen – @owen.campbell

I followed the amoni Readme and performed the following steps. I’m getting the exception at the very bottom (after adding some context for you).

/home/nmvega/DOCKER.d/ANVIL.AMONI.SANDBOX.d/ # AFTER: amoni init <thisDir>

(pyvenv.d) nmvega@fedora$ ls -la
drwxr-xr-x 9 nmvega nmvega 4096 Jun 18 15:01 .
drwxr-xr-x 3 nmvega nmvega 4096 Jun 18 14:53 ..
drwxr-xr-x 3 nmvega nmvega 4096 Jun 18 14:53 anvil-stubs
drwxr-xr-x 4 nmvega nmvega 4096 Jun 18 15:01 app
drwxr-xr-x 4 nmvega nmvega 4096 Jun 18 14:53 docker
-rw-r--r-- 1 nmvega nmvega 1191 Jun 18 14:53 docker-compose.yaml
drwxr-xr-x 8 nmvega nmvega 4096 Jun 18 15:01 .git
-rw-r--r-- 1 nmvega nmvega 1823 Jun 18 14:53 .gitignore
-rw-r--r-- 1 nmvega nmvega  248 Jun 18 15:01 .gitmodules
drwxr-xr-x 2 nmvega nmvega 4096 Jun 18 14:55 logs
drwxr-xr-x 3 nmvega nmvega 4096 Jun 18 14:56 tests
drwxr-xr-x 2 nmvega nmvega 4096 Jun 18 14:53 theme

(pyvenv.d) nmvega@fedora$ ls -la ./app  # AFTER: amoni install app ssh://[...]
drwxr-xr-x 4 nmvega nmvega 4096 Jun 18 15:01 .
drwxr-xr-x 9 nmvega nmvega 4096 Jun 18 15:01 ..
-rw-r--r-- 1 nmvega nmvega  192 Jun 18 15:01 config.yaml
drwxr-xr-x 4 nmvega nmvega 4096 Jun 18 14:53 hello_world
drwxr-xr-x 4 nmvega nmvega 4096 Jun 18 15:01 MY_ANVIL_APP  <--ADDED--
-rw-r--r-- 1 nmvega nmvega    0 Jun 18 14:53 requirements.txt

(pyvenv.d) nmvega@fedora$ python -V
Python 3.10.4

(pyvenv.d) nmvega@fedora$ pip --version
pip 22.1.2 from /home/nmvega/PYVENVS.and.JUPYTER.d/pyvenv.d/lib64/python3.10/site-packages/pip (python 3.10)

(pyvenv.d) nmvega@fedora$ pip freeze | grep -i anvil
anvil-app-server==1.7.3
anvil-uplink==0.3.42

(pyvenv.d) nmvega@fedora$ pip install anvil-stubs
ERROR: Could not find a version that satisfies the requirement anvil-stubs (from versions: none)
ERROR: No matching distribution found for anvil-stubs

(pyvenv.d) nmvega@fedora$ cd /tmp # cd /tmp -- just in case.
(pyvenv.d) nmvega@fedora$ ls -la
total 12
-r--r--r--   1 root   root     11 Jun 13 23:48 .X0-lock
drwxrwxrwt   2 root   root     60 Jun 13 23:48 .X11-unix
drwxrwxrwt   2 root   root     40 Jun 13 23:48 .XIM-unix

(pyvenv.d) nmvega@fedora$ pip install anvil-stubs
ERROR: Could not find a version that satisfies the requirement anvil-stubs (from versions: none)
ERROR: No matching distribution found for anvil-stubs

Any ideas? Thank you!

PS: I’m hoping that this will provide code-completion for client-side and server-side statements. :slight_smile:

Could you raise this as an issue at github instead of on here?

1 Like

Will do (soon). Thank you.

Edit: Future visitors can find the issue here.