A Python package to create XForms for ODK Collect.
Project description
pyxform is a Python library that makes writing XForms for ODK Collect and enketo easy by converting XLS(X) spreadsheets into XForms. It is used as a library in a number of tools including the ODK online converter, Ona and the Core Framework of the Community Health Toolkit.
XLS(X) documents used as input must follow to the XLSForm standard and the resulting output follows the ODK XForms standard.
formhub.org uses the repo here: https://github.com/modilabs/pyxform
pyxform is a major rewrite of xls2xform.
Running the latest release of pyxform
For those who want to convert forms at the command line, the latest official release of pyxform can be installed using pip:
pip install pyxform
The xls2xform command can then be used:
xls2xform path_to_XLSForm [output_path]
pyxform can be run with either Python 2 or Python 3. Continuous integration runs tests on both Python generations to ensure continued compatibility.
Running pyxform from local source
Note that you must uninstall any globally installed pyxform instance in order to use local modules. Please install java 8 or newer version.
From the command line:
python setup.py develop python pyxform/xls2xform.py path_to_XLSForm [output_path]
Consider using a virtualenv and virtualenvwrapper to make dependency management easier and keep your global site-packages directory clean:
pip install virtualenv pip install virtualenvwrapper mkvirtualenv local_pyxform # or whatever you want to name it (local_pyxform)$ python setup.py develop # install the local files (local_pyxform)$ python pyxform/xls2xform.py --help (local_pyxform)$ xls2xform --help # same effect as previous line (local_pyxform)$ which xls2xform. # ~/.virtualenvs/local_pyxform/bin/xls2xform
To leave and return to the virtual environment:
(local_pyxform)$ deactivate # leave the virtualenv $ xls2xform --help # -bash: xls2xform: command not found $ workon local_pyxform # reactivate the virtualenv (local_pyxform)$ which xls2xform # & we can access the scripts once again ~/.virtualenvs/local_pyxform/bin/xls2xform
Installing pyxform from remote source
pip can install from any GitHub repository:
pip install git+https://github.com/XLSForm/pyxform.git@master#egg=pyxform
You can then run xls2xform from the commandline:
xls2xform path_to_XLSForm [output_path]
Development
To set up for development/contributing:
pip install -r requirements.pip python setup.py develop cd your-virtual-env-dir/src/pyxform
You can run tests with:
nosetests
Before committing, make sure to format your code using black:
black pyxform
If you are using a copy of black outside your virtualenv, make sure it is the same version as listed in requirements.pip.
Documentation
To check out the documentation for pyxform do the following:
pip install Sphinx==1.0.7 cd your-virtual-env-dir/src/pyxform/docs make html
Change Log
Releasing pyxform
Checkout a release branch from latest upstream master.
Update CHANGES.txt with issues closed from the previous tagged release, e.g. https://github.com/XLSForm/pyxform/compare/v0.14.1…master.
Update README.rst, setup.py, pyxform/__init__.py with the new release version number.
Commit, push the branch, and initiate a pull request. Wait for tests to pass.
Prepare a draft release, copy the changes noted in CHANGES.txt to the draft release. Set version number and the title for the release should include the date >
When all tests are passing on the pull request, squash merge the pull request.
Checkout the master branch and pull in latest upstream master:
$ git checkout master $ git pull upstream master $ git push
Cleanup build and dist folders:
$ rm -rf build dist pyxform.egg-info
Prepare sdist and bdist_wheel distributions:
$ python setup.py sdist bdist_wheel
Publish release to PyPI with twine:
$ twine upload dist/pyxform-0.15.0-py2.py3-none-any.whl dist/pyxform-0.15.0.tar.gz
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
Hashes for pyxform-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 931ca438be42863ecb751ac5384a25be392880088ac897722dc79a8a2159bd0f |
|
MD5 | 5775f3873f83310bed5326e3776162d5 |
|
BLAKE2b-256 | 3cc674e1540a13b433035878887121ae0f3f87921d95a0798837ce92cba5cde2 |