Fifthtry

Doit

In software we often have to “build” things, say in case of realm projects, we will be building javascript from elm files.

Now elm compiler can do the building portion, but we often have to do much more than simply building.

Absolutely Essential Mini Tutorial on Doit

Doit is a tool that runs commands for you, if some files have changed. It operates on a file called “dodo.py”, where we define “tasks”, eg:

def task_pip():
    return {
        "actions": [
            "pip-compile --output-file=requirements.txt requirements.in",
            "pip-sync",
            "sed -i -e '/macfsevents/d' requirements.txt",
        ],
        "file_dep": ["requirements.in", "dodo.py"],
        "targets": ["requirements.txt"],
    }

We have created a “task” called pip (via task_taskname function).

We can run this task on command line using doit pip.

What doit does it, it checks if the task is “out of date”, in our case task would be out of date if any file listed in file_dep is modified since last run, or if files listed in targets are missing.

If things are out of date, then all commands listed in “actions” are executed.

We can create “task” dependencies by making the targets of one task a file_dep of another.

Bootstrapping Our requirements.txt File

If you look at our setup function, it tries to use requirements.txt file, but we have not yet created it.

Install doit manually: this is needed only the first time when you are creating the project, subsequently our setup function will take care of settings things up.

echo doit==0.31.1 > requirements.in
echo pre-commit==1.10 >> requirements.in
echo pip-tools >> requirements.in

python3 -m venv venv
./venv/bin/pip install -r requirements.in

Now you can come out of nix-shell using Ctrl-D, and re-enter the shell to let nix-shell install things.

You will see doit “working”, it will print a line . pip, here . means things were out of date and it is taking actions. On subsequent runs it will print -- pip, which means everything is up to date.

You will see now you have a requirements.txt file in current directory. This fill will have exact version of all python dependencies.

To install any python dependency we will add it to requirements.in file, and let doit generate requirements.txt out of it, and requirements.txt will be used on server etc to install dependencies.

We are doing this to version pin all python dependencies.

DOIT_CONFIG

When we run doit without any options, doit runs all the tasks defined in dodo.py.

We can define a variable named DOIT_CONFIG to decide what should be run by default, by putting this somewhere (preferably near the top) in dodo.py:

DOIT_CONFIG = {"default_tasks": ["pip"]}

Before we proceed, lets create a .gitignore file:

.doit.db
.zsh_history
__pycache__
requirements.txt-e
venv

Also a good time to checkin everything we have done so far:

git add .
git commit -m "before hello-rust"

We will be looking at more tasks later. Let’s move on to creating our rust project.

Table Of Content

What is Realm?

A Bit On Motivation

Routing is Hard

What does Realm do?

Backend Data And Type Safety

Tutorial

Quick Start Realm Tutorial

In Depth Tutorial (not ready)

Nix
Shell
Doit
Hello Rust
Hello Elm
Hello Static Files
Hello Server Side Rendering
Pre-Commit Hooks

Routing, Request And Response

Frontend, Data, Navigation, And APIs

How To Guides

File Upload

Backend: S3 File Upload
Authenticated File Serving
Frontend: Uploading Files From Elm

How to use storybook?

How to implement “loading..”?

Docs

Realm.In

Realm.Storybook.Story

realm::In

realm::Context

realm::Result

realm.magicSlice

realm::RequestConfig

Environment Variables

Internals - Only for Realm Developers, not Users

“Realm DATA”
iFrame Controller
Shutdown Routine
Testing Internals

Change Log

Get Realm Starter Working

Transparent Offline Feature

How to make http requests in Realm?

Development

Tutorial: ToDo App

Realm Testing

Enhance Realm Starter

Double Load Issue

Deploy To Heroku Button

End failure

Realm-Starter Github Template

Proposal: Tracker And Visit

Proposal: Activity Store

Proposal: Bundling

Proposal: Retry On Network Error

Storybook: Editable JSON

Storybook: Notes

Storybook: Reference

Backlog

Readings

Change Log

How to Publish

Testing

Code Snippets

Skip rustfmt For Some Section

Close Modal Dialog When Clicked Outside

Ignoring Lints In Python

Ignoring Lints (clippy and rustc warnings) In Rust

Handle DateTime in Rust & Elm

Handle CiText value read in Rust

Transport Enum Type to and fro Rust/Elm through JSON