Convert from XLSForm to YAML and back
Project description
Convert from XLSForm to YAML and back
yxf (short for YAML XLSForms) is a converter between XLSForms and YAML files. With yxf, you can store forms as text-files. This brings a number of advantages to managing many forms. For example, you can store forms in version control, view differences between two forms, and easily share updates between multiple forms.
Usage
To convert an XLSForm to a YAML file: python -m yxf form.xlsx.
By default, the result will be called form.yaml, in other words, the same name
as the input file with the extension changed to .yaml. You can specify a
different output file name using the --output othername.yaml option.
To convert a YAML file to an XLSForm: python -m yxf form.yaml.
Here's a screenshot showing the YAML and XLSForm version of a form side-by-side:
Using Markdown
yxf can generate and read Markdown instead of YAML. The format is taken from md2xlsform. This can be useful if you would like something more compact than YAML, e.g., to paste into a community forum.
To use Markdown, add a --markdown argument to the yxf invocation:
# Will generate form.md
python -m yxf --markdown form.xlsx
Installation
Get the latest version from the GitHub repo:
python -m pip install yxf
Features
Comments in forms
yxf encourages adding comments to XLSForms. It uses a special column labeled #
to that end. Other tools ignore this column, so that it can be used for
explanations that are useful to the readers of the .xlsx or .yaml files.
Pretty spreadsheets
yxf tries hard to make the XLSForm files look pretty. It is possible to use yxf just for that purpose, without intending to store forms as YAML files. To do so, simply convert a form to YAML and back:
python -m yxf form.xlsx
python -m yxf -o form-pretty.xlsx form.yaml
Validating the form
yxf does not deeply validate forms. If you'd like to make sure that a form is
semantically valid, you can use the xls2xform command from the pyxform
package:
python -m pip install pyxform
xls2xform form.xlsx
Development
yxf is still being developed. Feedback and contributions are welcome. Please open issues in the issue tracker.
Please run all of the following before committing:
- Format the code:
black . - Run unit tests:
pytest - See lint warnings (and please fix them :)):
pylint yxf
To publish on PyPI:
- Increment the version number in
pyproject.toml. - Run
uv build. - Upload using
python -m twine upload dist/*.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yxf-1.0.0.tar.gz.
File metadata
- Download URL: yxf-1.0.0.tar.gz
- Upload date:
- Size: 149.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e33b77a6a0ca79c69e2917beb7e32424c8d754cb13b3c1bd2690338df7616df5
|
|
| MD5 |
7a81606c3058f573ac305cba9f46df60
|
|
| BLAKE2b-256 |
1e22c746dc487cf4fe53832658f85dbb17e9b54bebc08f1d94d1d9b8e33f7bf3
|
File details
Details for the file yxf-1.0.0-py3-none-any.whl.
File metadata
- Download URL: yxf-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eab0b3121dbaf970799cd192d223254c1029a5c6fe5390006dfabdfe0b90da6a
|
|
| MD5 |
1a656a23b854dd991bcf0041f4cecb21
|
|
| BLAKE2b-256 |
c0984e4dbc571f3c44028198f05d72a0b6d745c72eef3bf4e0f8f1159380062a
|