[ python: providing YAML support in a released set of files, without requiring users to manually install PyYAML or libYAML ]
I am trying to find a way to parse YAML in a small set of Python scripts I am releasing to some colleagues of mine.
These are users who are smart but experts in electrical engineering, and their expertise in programming or software installation is minimal, so I need to make it as easy as possible for them to use my script.
Their Python environment will be either the plain Python 2.7 distribution that is downloaded from python.org, or the free version of the Enthought Python Distribution. Neither comes with PyYAML or libYAML installed.
So my dilemma is how to include YAML support in the scripts I am distributing.
I do not want to have my end users go through easy_install or pip; it's fairly easy for me but they could run into problems, as I did the first time I tried to find setuptools.py. Also they may not have root/Administrator access to install additional system packages (python may be pre-installed by an IT person on their computer) as mentioned in this SO question.
Do you have suggestions on how I can parse YAML files under these circumstances?
Answer 1
Is there some reason you can't just include the Python sources for the YAML parser in the files you distribute?
PyYAML claims to include a pure Python implementation, so it should be fairly trivial to bundle that in with your package.
If you're just parsing YAML files included in your distribution file, then another option might be to pre-convert them to some other format which Python's base library can cope with.
Answer 2
From Aya's suggestion I copied the /lib/yaml
directory from the PyYaml release (https://bitbucket.org/xi/pyyaml/src ) into my script directory:
+ my-python-scripts
|
+-- myScript.py
|
+-+ yaml
|
+-- __init__.py
+-- composer.py
+-- constructor.py
.
.
.
Then I can use import yaml
in my script and it works fine. No global install necessary.