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

Getting Started

The dev tool can be installed via pip:

pip install dev-rs

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.6.tar.gz (30.3 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.6-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.6-py3-none-musllinux_1_2_i686.whl (1.5 MB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

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

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

dev_rs-0.2.6-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.6-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.6-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.6-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.6-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.6-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.6-py3-none-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

dev_rs-0.2.6-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.6.tar.gz.

File metadata

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

File hashes

Hashes for dev_rs-0.2.6.tar.gz
Algorithm Hash digest
SHA256 58a5db0ac9dddd3b4f8669dcea2a952fa039fc8db87f616808264c6c7b5ff0f9
MD5 66e9af9e1734014b34c10f9a89bdb149
BLAKE2b-256 917985d0f81b24979286810f94eef9856ec24344b4c93c750abda011c2a4b9fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d06948c8f33bba641a4538f3a8f437bc0899c2db2e1cf8d6b2fa52e9cc947b21
MD5 5d7f54bb9236bf30cdf26c9018322661
BLAKE2b-256 41beb6b91a7a8c1c678a7036807b5b54931f64b8ad27ff21203b6ab2bb8eee84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 e100bc80e6e26ee7a4d3949927ba0c40b6114d63f3971b9c20a5135257d50fcf
MD5 fef4e4e6a01043c004d52e53272db3f5
BLAKE2b-256 f289fee25ffe8943f04118479aa27722e552863861af9a21e3f8c23480df3a61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 77b476f03235f0ed3efe89c9289ff4f312360c62a5f480cf9e91611914d95b41
MD5 1c109db089938cd63393e05f654d148e
BLAKE2b-256 7df198c4ab58cb76e3a7be0c88e30cef25e3122f5ddcf801605cf9695ddadc2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 218b8a5e99c85f5a85d768088e8846e26349d5378acc897b0efedf3e47772c39
MD5 648a623d9028b1964cb5249843b7d1cd
BLAKE2b-256 500a6be75355fce290377bbe47da4f60fb8d8572c648949b5a56d91bdb1e371c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d38920249974fb1476ebe7bee71104f1adb88fb65188cf9488cd76d3e4078a66
MD5 c7d7bf7b57520faaf48f31ad10c438af
BLAKE2b-256 b2964b3eb1242514b297f67ddee04d88eb96b30a5dfd8fe3cfe3de114095049a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 d408f8c67d302bd4ff47522dced04e302ed60e11d65ee131d9569f9440da6876
MD5 52613a7691090581fe14bcd54d87e1cc
BLAKE2b-256 89daa1711720c43ee22f215cc7a1bd945107a785839512ca6b03b3fba131c88c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 f39e93ba207cf154f387cc79ae977ea4df45e9d721523ab6613efece8cb5f317
MD5 63174a49f18480dd8d452903e8ac4497
BLAKE2b-256 90b120d43ea538de00701f93a82622cc0397b48709a9bd622f80bbe1fe279f8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 574cd03b7dc6835f40eb01c3be987692001db244596b62448fd7c1aeef2fdfdc
MD5 95dc70e1d88401f196bdc3ef34f068cf
BLAKE2b-256 f5a7c39ee40cd8686f2570956af64a10756576288aded51bd975877eb5397f17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 fa6304e83d3ae476029e53cf0e51de39fc985cb49550e1f3ea865dd681258485
MD5 663e4c777ee9f397c01676993a4d83da
BLAKE2b-256 169458928cb564d3cfb7cffcf8e1b81c9126963b6eb7b29b0d8ddd58554784df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a8c5a151ad19ae20ebdedd234f4173b72eb31d8faeb529ef0839b5fe470bd40a
MD5 30de4d3039c3fc483517830b05cbc062
BLAKE2b-256 50c5291a40fc8875fbc7d4387aaf019c20976eb6cd73bfe9aa81da85ac15fba5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa6d3367df4c3897c2de074103458326daff8db3ca85165138b970cc9103398c
MD5 973d5070608dfb05b64b435e8ae16928
BLAKE2b-256 5fa1e858497076741d633c62a538f409b41b3a8691e4ba95c62c2d49fe34193d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dev_rs-0.2.6-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 007aa0e876c5c3e6158e60df0d9cb0f8de8304fd07c32b3eb2dfb9a7c7477314
MD5 8b6a5510fcd3fc30ea280c56d3caab8d
BLAKE2b-256 9c56b065b786e397a2de917fda9605e8eed93482ea81bdccb7d56a3798b392ec

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