Skip to content

Installation guide

This tutorial serves as a guide to getting started with the nyaml software.

What should you know before this tutorial?

Nothing! We'll guide you through the installation step-by-step.

What you will know at the end of this tutorial?

You will know

  • how to install nyaml
  • how to call the nyaml2nxdl command line tool

Setup

It is recommended to use Python 3.11+ with a dedicated virtual environment for this package. Learn how to manage Python versions and virtual environments.

There are many alternatives to managing virtual environments and package dependencies. We recommend using uv, an extremely fast Python package and project manager. In this tutorial, you will find parallel descriptions using either uv or a more classical approach using venv and pip.

Start by creating a virtual environment:

uv is capable of creating a virtual environment and installing the required Python version at the same time.

uv venv --python 3.12

Note that you will need to install the Python version manually beforehand.

python -m venv .venv

That command creates a new virtual environment in a directory called .venv.

Installation

Install the latest stable version of this package from PyPI with

uv pip install nyaml
pip install nyaml

You can also install the latest development version with

uv pip install git+https://github.com/FAIRmat-NFDI/nyaml.git
pip install git+https://github.com/FAIRmat-NFDI/nyaml.git

Testing your installation

The nyaml package installs a command line tool called nyaml2nxdl that can be used to convert between XML and YAML representations of NeXus definitions written in the NeXus Definition Language (NXDL).

Run nyaml2nxdl --help to check that the installation was successful:

nyaml2nxdl --help
Usage: nyaml2nxdl [OPTIONS] INPUT_FILE

  Main function that distinguishes the input file format and launches the
  tools.

Options:
  --output-file TEXT   Specify the output file path for the converted file.
  --check-consistency  Check whether YAML and NXDL can be recursively
                       converted, ensuring version consistency.
  --do-not-store-nxdl  Prevent the input NXDL file from being stored as a
                       comment at the end of the output YAML file.
  --verbose            Display keywords and value types in standard output to
                       assist in identifying issues in YAML files.
  --help               Show this message and exit.

Start using nyaml

That's it! You can now use nyaml.