Basix/packages/convert-scheme/package.nix
alfarel 6a8a32d3a8
convert-scheme: do not allow arbitrary python code execution
Probably not relevant, but there doesn't seem to be a reason
to use the full loader as far as I can tell...
2026-05-25 22:28:00 -04:00

24 lines
759 B
Nix

{pkgs, ...}:
pkgs.writers.writePython3Bin "convert-scheme" {
libraries = with pkgs.python311Packages; [pyyaml];
flakeIgnore = ["E302" "E305" "E501"];
} ''
import argparse
import yaml
import json
def yaml_to_json(yaml_file, json_file):
with open(yaml_file, 'r') as yml_file:
data = yaml.safe_load(yml_file)
with open(json_file, 'w') as json_file:
json.dump(data, json_file, indent=4)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Convert YAML to JSON")
parser.add_argument("input", help="Path to the input YAML file")
parser.add_argument("output", help="Path to the output JSON file")
args = parser.parse_args()
yaml_to_json(args.input, args.output)
''