Skip to content

Command-line interface for managing and developing ViUR

License

Notifications You must be signed in to change notification settings

viur-framework/viur-cli

Repository files navigation

A hexagonal logo of the viur-cli

viur-cli

Badge showing current PyPI version Badge displaying the license
Command-line interface for ViUR framework project maintenance.

What does it do?

viur-cli allows to control, maintain and develop a ViUR project from one central location by using the viur command.

Installation

To use viur-cli in your ViUR projects, install the PyPI package viur-cli.

$ pipenv install --dev viur-cli

Usage

$ viur --help

will show all the commands that are currently supported by viur-cli

$ viur create myapp

this will create a new project folder, clone the base project and then call viur init to prepare a project.json you can use this to get started quickly with a new viur project from scratch.

$ viur init

this will initialize a new project in the current folder, you will be asked a couple of questions like if you would like to create a new project.json file, what components should be preinstalled and what the projectID of your application will be.

$ viur run [target]

run the appserver and start your app locally. You may specify a target projectID.

$ viur check {--dev}

Runs a security check for the python environment and for each npm project registered under builds.

$ viur deploy {app|index} [target]

you can deploy the app or the index.yaml to a google cloud project target of your choice, though the target is optional. By default this would be the projectID you gave when initializing the project, but you can add targets to the project.json if you would like to have an additional system for testing for example.

$ viur install {vi|scriptor}

ask viur-cli to install either vi or the scriptor into your project

$ viur flare {release|debug|watch} [appname]

if you have a flare component in your project you can build a release, start a debug helper or watch the flare app for code changes which will automatically rebuild it when you save your changes.

$ viur flare watch vi

this would watch the vi flare app for changes and automatically rebuild it in case of changes.

$ viur build release

build all flare and npm apps and produce a release that can be deployed

$ viur build app [appname]

build a specific app

$ viur env

check the environment you are in right now, show versions of viur-cli, viur-core and vi etc.

$ viur project {add|remove|list|addFlare|scanNpm}

with this you can manage your project.json or generate a new one. You can add or remove targets to/from the project.json, list what has been added to the project.json, add a flare application with addFlare to be built when running viur build release or walk through the projects sources with scanNpm and identify all npm applications to be added

Viur scripting interface

There is a new core component that enables us to pull and push python scripts from/to a deployed application and run these in a sandbox or even locally. The GUI version is called scriptor and can be accessed via a webinterface, but viur-cli also has a cli for this:

$ viur script {configure|pull|push|run|setup}

Commands:

  • configure Manage configuration settings.
  • pull Pull contents from server to working_dir.
  • push Push contents of working_dir to server.
  • run Locally run a script located in the working_dir.
  • setup Setup user session with a given username and...

Packaged tools

In order to use the packaged tools, you can run:

$ viur tool {2to3|flare|pyodide|ssl-fix}

Scripts:

  • 2to3 viur porting script
  • flare flare build script
  • pyodide run the get_pyodide command
  • ssl-fix ssl fix for MacOS

for example the 2to3 script helps porting viur2 project to viur3, it can be used to automatically rename some things that are deprecated in viur3 as well, so you can use it whenever a new core version is released for viur3 projects as well:

$ viur tool 2to3 -d .

will dry-run the script in the current directory and not make any changes, only suggestions. If you want to make the changes, leave out the -d argument and if you are a daring go-getter and like to live dangerously, replace the -d with -x, which will write the suggested changes without making a backup of the changed files.

Development

If you want to hack viur-cli, clone this repository next to the folder of your ViUR project.

$ git clone git@github.com:viur-framework/viur-cli.git
$ ls -1
viur-cli
your-project

Then, add it to your project as an editable dependency using

$ cd your-project
$ pipenv install --dev --editable ../viur-cli

Dependencies

viur-cli depends on

License

Copyright © 2023 by Mausbrand Informationssysteme GmbH.
Mausbrand and ViUR are registered trademarks of Mausbrand Informationssysteme GmbH.

This project is free software under the MIT license.
Please see the LICENSE file for details.