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.2.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.2-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.2-py3-none-musllinux_1_2_i686.whl (1.4 MB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

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

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

dev_rs-0.2.2-py3-none-musllinux_1_2_aarch64.whl (1.4 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

dev_rs-0.2.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

dev_rs-0.2.2-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.2-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.2-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.2-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.2-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.2-py3-none-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

dev_rs-0.2.2-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.2.tar.gz.

File metadata

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

File hashes

Hashes for dev_rs-0.2.2.tar.gz
Algorithm Hash digest
SHA256 96856c3b5658c6b07b25486f2131f9a445a3f9413c764f742b2e7b99a0ed8c63
MD5 c65ec514a188e4689ab982f7a5e2ba7b
BLAKE2b-256 781e7f5a15706e6b2fbbdb07c01a99ae86dc7c75816524ee92328fce122e2a3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 700a30f6cec3d3d69b7e7e070f0faca4943192f8201a531e3c9060ac572b00af
MD5 721702a23a13ef21bb10a37ac7e3f56b
BLAKE2b-256 bfb665a4298b394c18a8eeda336c3891737420645395b114a2d2b0cf246ef126

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 7dd7437290b36781cba4a9c129692515b2ca12e018b1093345684c2ee77c5702
MD5 36c28b7ace6a72bb2367ffd67f38a578
BLAKE2b-256 e96946288ca91ce91ab1b2f70c453b1f76757283b5790615c0dc6aad563c4dd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 fec34f8bfa7041db79b345788863db0b459da5e5381e0ea8e09bc4684757b826
MD5 a943e02a432384fbb3951f785d9a0f91
BLAKE2b-256 bdbded4b788532183e829e9500384dcc6efea0964acfbd13d230a12c06419db0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6681a34a48f2c107e662beab3269d18958feefbe274de0e35a9e3a7e119fcb6f
MD5 6aa1f4ea132688a8eb612edf502f1d78
BLAKE2b-256 8f7dc75dcec926ab389b96c0308d75894423c7623895951ee6bb91b913495dde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17360e69c0aea9116aa5afb4e9b5fb5dfd5d10f20bcc1676c944d4d5bd07fd0a
MD5 22da38b0b6a66bac539baec43226b9be
BLAKE2b-256 e677a84ce17b9e00f21f28b8608b9094e1f32fcb2d219fe84b628b3d87445902

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 96df7f4914bf973020aadc137cf3f4a038f22afab98fee6f3d85e1d334330ca5
MD5 439d74c337d3ba1a93a7c21bad9e7ee0
BLAKE2b-256 6074a68c5fc11befb87f713e012963b1eef09d5539c278b532a0a2fa8cadf671

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 fc5f18d7e2977d1d212b7e1867d8dc170e4b5686397174ff72056d60bb9e0bb3
MD5 3b90c973c7c0ae1834dc8a72e9decadd
BLAKE2b-256 ef629a1779aa5477ee354d8206599b1a6bfcca7a980090daf0a4b08208c993c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 a949010106a90e474da9a8e760abe04e63fa7c5b9548cfb892401804995ef30d
MD5 05dd7bae9fa2c2665b0f18e2f481882a
BLAKE2b-256 97e3352ebe5652d81afb68b07338b4a6891a9889571fc3786e2f5243b08ac797

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 aeadc1652f07f7d0df16e4cc5227b22a6a3d8b12d88397d1bd07d87449e8b805
MD5 43cd565e571e7b952516a5dceb52f73d
BLAKE2b-256 ca815287b0558dd9be4e1be0cb9d5492b68aa087995dc77e87c5a4d655d4806a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 db88c605716813a3308525465b75405f3021e3304a37f2f4eabab3f1bd6f1e87
MD5 7a7df884471295c91d360b30690c6e70
BLAKE2b-256 16896456e4d3d474e6fe7c87aa6259226e652c2cc0faac9319c8a23068e0d5c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 addcde52b3513ef44f7be76e1ee248c96e336c24a2a70e39120b73390cfb71de
MD5 760655c79b2f88990e3d3ea09cbfb2d0
BLAKE2b-256 0a4f8d58d0a28c2e303257e6483353da345d85ee21f8a3ddeb1b11a7cd1c78ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.2-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 314d15ad0703f9f5d1e4afbd91e5cce5038755656eab8ae83c9f9b4499e2c2a5
MD5 90ad3cef7f61ee3e3285673b916c36ff
BLAKE2b-256 05aa9d356855faa2591b2696cdd4473afc17105cf39c7d1bd03eda42c2b4818a

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