Marcel

Latest version: v0.30.3

Safety actively analyzes 682487 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 7

0.27.2

Change in env.pickle format

0.27.0

Fix for bug 254 necessitates a change to the env.pickle format.

0.25.0

I've slacked off on releases, and there have been some visible changes. So here we are, new release 0.25.0.

0.22.2

I've been neglecting GitHub releases, mistakenly believing that creating tags was sufficient. I will be more vigilant about this from now on.

This addresses issue 27

0.18.0

Overhaul of how the marcel Environment is transmitted to pipelines and ops. It is no longer held onto by an Op, which means it will not be transmitted remotely. This fixes bug212, and should generally make remote invocations lighterweight.

0.17.0

Marcel now supports JSON input and output.

To convert a JSON document into a Python structure, use the `parse_json()` function.
A contrived example:

shell
bash ps | jc --ps | (p: json_parse(p)) | expand | (j: (j.pid, j.cmd))

* `bash ps | jc --ps` runs the bash `ps` command and then uses `jc --ps` to convert the output into a JSON document.
* `(p: json_parse(p))` converts the JSON into a Python structure.
* `expand` is a marcel operator that breaks a list into its elements. I.e., the input stream has one list with all the process info, and the output stream has a stream of structures each describing one process. Each structure has an object with fields describing process properties, e.g. `pid` and `cmd`.
* `(j: (j.pid, j.cmd))` extracts the `pid` and `cmd` of each process.

(This example is contrived because it can be done far more simply in marcel without JSON,
e.g. `ps | (p: (p.pid, p.command))`)

The mapping from JSON to Python is done by the Python `json` module. Consult documentation on
that module for details of the mapping.

Conversion of Python structures to JSON is done by the `json_format()` function. In this example,
maps of the form `{x: [x, x, x]}` are generated, for x = 0 ... 4. The structure is converted to a
JSON-formatted string by passing the stream, as a single list, to `json_format`. (By declaring the
parameter as `*m` instead of `m`, the stream of dicts is concatenated into a list of dicts.)

shell
({x: [x, x, x] for x in range(5)}) | (*m: json_format(m))

Page 2 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.