Skip to main content

The missing tool for 12 factor development environments

Project description

Dev tool

This tool provides a standard interface to manage 12 factor projects, regardless of the language or framework used. The main goal is to allow you to run a standard set of commands for common tasks, which just work™ is any supported repo, such as:

  • Manage encrypted environment variables
  • Run a command in an environment
  • Start up a full webserver in an environment
  • Connect to an environments database

What are environments?

When manage an application, your normally require multiple environment, normally at least production, and development. On top of that, you'll probably need some form of local environment, so that you can run and test your application, with similar settings to production.

In environments, we attempt to capture all dependencies required to have your application up and running. The two key components are environment variables and external packages. The external packages used between each environment is the same, and the only difference are the environment variables.

In order to run a command within the default local environment, you can use the following:

dev run <command>

This will make sure that all packages are automatically installed, and all environment variables are exported for your command.

Sometimes you may want to run a one-off command in your local system, but connected to other production services (such as your database), or with production settings. To do this, you can run the following:

dev run -e prd <command>

External packages

Whenever you deploy your application to production, it's good practise to lock down external package to specific versions so you're able to recreate it if required. In development environments, you are often just left following a (hopefully) documented set of instructions to get your local system (mostly) in sync with production. These can be useful on a fresh system, but get complicated quickly when working on multiple products with different versions of packages required. Even worse, you might be gradually doing upgrades between OS releases across your team, and having conflict between the new packages, and the old one.

dev allows you to use various tools to maintain external packages:

  • The Nix package manager resolves this issue with system level packages, by downloading and making programs and libraries available while within dev run or dev start. This can be used to automatically set up a certain version of nodejs, python or rust tools.
  • Your language-specific package manager, such as poetry, uv, or npm, can resolve this issue for all packages managed by the language's traditional package repository.

To set these up, you'll need to add this config to your .dev/config.toml:

[commands]
# Just use a nix environment
shell = 'nix develop -c -- "$@"'
# Just use a uv environment
shell = 'uv run -- "$@"'
# Use both nix and uv environments together
shell = 'nix develop -c -- uv run -- "$@"'

Environment variables

This is a hard one, particularly when it comes to local development. It's not uncommon to see a local .env file, manually copied between developers, across questionable mediums. If you're anything like me, you're probably getting major there must be a better way! syndrome.

In dev, we use instead manage environment variables the same way for production and local development. We create an encrypted file per environment that contains all environment variables required to run the application. This allows you to track all changes in version control, as if they were regular code changes. It also means you can include environment variable deployments into CI/CD pipelines, rather than managing them manually.

To modify your environment variables using your default, you can use the command:

dev config edit [-e env]

Getting started

To set up the dev command in you repo, run the following command and follow the prompts. This will set your .dev/config.toml with enough details to get you started.

dev init

Commands

Run a command with environment variables

dev run [-e env] <command> [args...]

Start the development environment

This runs the command configured to start up the main service for this application. If you want to run multiple services, you can try configuring it to run something like process-compose.

dev start [-e env]

Manage configuration

Edit the environment configuration:

dev config edit [-e env]

Export the configuration:

dev config export [-e env] [--format <format>]

Available formats: raw, json, docker.

Connect to a PostgreSQL database

When working on an application that requires a PostgreSQL database, you commonly need to run queries on databases across different environments. The dev tools makes this easier by allowing you to track these credentials using the DATABASE_URL environment variable. You can then use the following commands to run an interactive psql prompt without needing to manually handle database credentials across your team:

# Connect to the local environment's database
dev psql

# Connect to the dev environment's databse
dev psql -e dev

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dev_rs-0.2.3.tar.gz (29.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dev_rs-0.2.3-py3-none-musllinux_1_2_x86_64.whl (1.4 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

dev_rs-0.2.3-py3-none-musllinux_1_2_i686.whl (1.5 MB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

dev_rs-0.2.3-py3-none-musllinux_1_2_armv7l.whl (1.4 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

dev_rs-0.2.3-py3-none-musllinux_1_2_aarch64.whl (1.3 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

dev_rs-0.2.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

dev_rs-0.2.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.4 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ s390x

dev_rs-0.2.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

dev_rs-0.2.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (1.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

dev_rs-0.2.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

dev_rs-0.2.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

dev_rs-0.2.3-py3-none-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

dev_rs-0.2.3-py3-none-macosx_10_12_x86_64.whl (1.3 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file dev_rs-0.2.3.tar.gz.

File metadata

  • Download URL: dev_rs-0.2.3.tar.gz
  • Upload date:
  • Size: 29.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.9.0

File hashes

Hashes for dev_rs-0.2.3.tar.gz
Algorithm Hash digest
SHA256 cd7074d527523b5d69e91b8f5a7f2b201f80eac99c60b614769a94d0d1f4fe4a
MD5 00ce72922845150b9edd6995173a864f
BLAKE2b-256 3bc3777346ff8cb3d5bbebb692d9af63aeca6b83b8c8d96e3ed91d7750c52787

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dd1c8b820fc1c52e803c2a091e2d43fcd324b78301c9594e54cbdc0709570e54
MD5 db827ae994f7acb280ad3ecd24f541b2
BLAKE2b-256 190e852216074927eda640190040cd84bbb98dc73785ced35c50b5177b397891

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 e60f62e48c7f35a61e660ea67f5c11adfc1899dcfa9670dd68f796a80abce609
MD5 24d79e0cc1454d0054fb15e8ea9c0704
BLAKE2b-256 287a29f400b5d88e00786139bc36cc087208d7812bc426327a16b5e1c69ab03d

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 14afaef42785dbe09d68e1f9390beabe35316248f2f6efaafbd116a48c93d23e
MD5 c73025b397d11a8e20ba098808be1a3f
BLAKE2b-256 3006ee7d27bb1adb43330a1e34b3fae824cdcef0c7e831517a6d3efefe1aba90

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 66b0f1e7376aadd4265857efe37ad0733a5eddc88f6a0dda2c42190f8836020a
MD5 55bbcc7539377edd7fa1d7b09bf4edd3
BLAKE2b-256 4fac5623d0c4b0f50a67570da664b48174322024520d88a463e8d3a2af5f1972

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b3aef0d2b4fc3ca126c0588b73c6937a6667bbf44d7b007960ae88839785b53f
MD5 6a925848a946b02b856b128ebf9b617d
BLAKE2b-256 35b8529e14255270da6c21debd3cef8d834df803a0e6befcfe534130ef1378fe

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 8bee7660a57b5ddeeb0fd419d5f7c570503ef32578d96cedc5646b1feace3215
MD5 bac32ad91e81ac2e53d0995e98542649
BLAKE2b-256 e1024e6363897ff424ad705e6956aaaf363a5f8b4338ae0dff55f099f8698589

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 488584a7a42c9782f9e3f185dccfa4a28116e6235932ecadf4e905bcb945c86c
MD5 b51936d34fd0dfec1c45be4854b0bfe0
BLAKE2b-256 e097462893b2f41aa277e990cf1345aa2029a7aca3caeebd82a06f1d805568d3

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 188e2bed81787c66adeb129ce488074139dafd70bf7ca4b9110e94026bd2f238
MD5 20139bc8dd06b9c056329ddef55b90f4
BLAKE2b-256 1e8b0550f653edc4db698eb8fb3ca69915a1b7a36857db1210eb933d393f7348

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 050cee91026ac48d604e6d460e779934958f8ce39f9f6654647e659ae7a3a3b2
MD5 3cc411bd3f79bbb50c91b961dea81e58
BLAKE2b-256 b7437542bed1cb15b06a051fd2d70efa15e99032256137945d3cb014a25b1edf

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bb453f7e9cfdbacd7faad26fadd3d6a78a9cb4e9abf9b780fa6e9f427541aa7c
MD5 f9a815f9eea29b6b2144d9132a4e6cab
BLAKE2b-256 8146fa8a60a435c5a11475d1b6041c69df357c55c5894b14dddb25207aad55eb

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fb25c6e14f957e8fae714006ddae49eb4e7423d4b413c6ac1b4fdb1c8dd37313
MD5 0b76c44648b06f1b1425138ad5acf07c
BLAKE2b-256 dd91c22d3de7204953ff6442e3acbc2c96f56bc9fcaa0c44b1012233d7b29920

See more details on using hashes here.

File details

Details for the file dev_rs-0.2.3-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for dev_rs-0.2.3-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7b4dbd8a1fadee187343297570ae32e1488d36dc8c6a0a1572b1c679c1de1a75
MD5 98abc286979ef150b8f28da33967ec64
BLAKE2b-256 5376e37ec4c1652e8c29b736247908d57d0352bcbd6b67b5cd7c2acd8c702ba8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page