Comment on page
dev
dev
requires shell integration.pkgx integrate --dry-run
dev
is a tool for utilizing developer environments. It is built on top of pkgx
and the pkgx pkging primitives and automatically determines the packages you need based on your project’s keyfiles.dev
requires pkgx
to be integrated with your shell.pkgx integrate
$ node --version
command not found: node
$ ls
package.json …
$ dev
found package.json; adding `node` to the environment
(+node) $ node --version
v20.5.0
Because there’s a
package.json
we know you want node
.If there’s a
.node-version
file we read that:$ cat .node-version
v18
$ dev
(+node=18.16) $ node --version
v18.16.0
We understand almost all keyfile conventions. If we don’t understand one you use let us know and we’ll add it.
The environment is only active while your terminal is inside that directory.
This is persisted across terminal sessions.
If you want to disable this behavior, deactivate it inside the project directory:
(+node) $ dev off
We even add version control systems like
git
, svn
and hg
.Because we read the keyfiles of different project types, use of
dev
is entirely optional for your users and coworkers. They can either use dev
, manually construct the environment with pkgx
or source their deps themselves.Projects require specific versions. To facilitate this we allow you to supplement the project files that indicate tooling. For example in a
package.json
file:In files that support comments we use YAML front matter:
Our preference is comments, JSON doesn’t support comments so we have to stick a
pkgx
node in there.We read all the files in your project, but only at the root level. If you move up a level and it has its own environment you will need to activate that separately.
Multiple projects can read
package.json
. If you want to use bun
rather than node
just specify that in your package.json
(or pkgx.yaml
):We supplement the existing files to be less intrusive, but if you prefer you can instead add a
pkgx.yaml
(or .pkgx.yaml
) file to your repo.The format is the same as that of YAML front matter, thus for example:
It can be convenient to control shell environment variables for work projects.
$ cat pyproject.toml
#---
# dependencies:
# env:
# DENO_DIR: ./deno
# VERSION: 1.2.3
#---
$ dev
(+deno+python) $ echo $VERSION
1.2.3
You can either prefix the YAML with a root `pkgx` node as above or drop that considering our metadata is universal this seems acceptable, but using a `pkgx` root is safer. If you use a `pkgx` and you only have deps you can specify just the deps. We support specification as strings, arrays or dictionaries so pick the one that feels right to you. { endhint %}
Edit the relevant files and
cd .
to trigger the environment to reload.Generally programmer editors should see tools if the environments are activated. If no, let us know and we’ll fix it.
$ dev off
Last modified 19d ago