Req is a spiritual successor or Python's requirement.txt
files, but for Racket.
The biggest problem with requirement.txt
was that dependency listing was
duplicated in that file and setup.py
's install_requires
.
In Req You list sub-packages of your projects and the dependencies are extracted from info.rkt
files.
Also, because we already have a config file we can put it to use and use it as a mini-configuration for other project's areas, so we can list the catalogs the project should use as well as extra dependencies used for repository maintenance.
Req offers a convenient way to manage dependencies of large Racket packages.
Using the raco req command You can, for example:
- install only external dependencies,
- install all local packages at once,
- use a special catalogs repository for the project,
- save the extra packages You use for repository maintenance.
This is the Req-file of Req itself:
{
"catalogs": [],
"root": "./src",
"local": [
"req*"
],
"dev": [
"ziptie-monorepo"
]
}
Going though this config line by line:
-
catalogs
can specify alternative catalogs to be used for external dependency download,
if it is not set or is an empty list, then the default catalogs are used, -
root
specifies a root directory to findlocal
packages in, -
local
specifies what are the local packages,
it takes either a path or a list composed of a path and a package name,
it also accepts globs (if given a string),
packages from this section can be installed one-by-one with--local <pkg-name>
or all together with--locals
,
so, if I would executeraco req --locals
Req will installreq
,req-lib
,req-doc
andreq-test
(because of glob expansion), - finally any key that is not
catalogs
,local
norroot
is treated as aextras
set,
it defines a set name and external package associated with this set,
for example adev
set can be defined hat will contain packages uses by project developers,
to install a specific defined set execute--extra <set-name>
or install all extra sets with--extras
so, if I would executeraco req --extra dev
the packageziptie-monorepo
woudl be installed.
Current command line interface:
$ raco req -h
usage: req [ <option> ... ]
<option> is one of
/ -s, --show
| Show Req setting of the current project (default action)
| -d, --deps
| Install external dependencies of project's local packages
| -l <local-package-name>, --local <local-package-name>
| Install a local package
| -L, --locals
| Install all local packages
| -a, --all
| Install "deps" and "locals"
| -e <extra-set-name>, --extra <extra-set-name>
| Install an extra set (i.e. dev)
| -E, --extras
| Install all extra sets
| -A, --everything
\ Install "all" and "extras"
-p <dir-path>, --project <dir-path>
Path to the project directory
-f <file-path>, --file <file-path>
Path to the project's Req file in a supported format
-v, --verbose
Be verbose (detailed console output)
-V, --version
Show the version of this program and exit
--help, -h
Show this help
Install Req with raco: raco pkg install --skip-installed --user req
Upstream: Maciej Barć / racket-req · GitLab