# prettify-xml
[](https://www.gnu.org/licenses/gpl-3.0)


[](https://chembee.readthedocs.io/en/latest/?badge=latest)
[](https://ci.codeberg.org/sail.black/chembee)
# Why
Pretty xml output is necessary for debugging xml-based communications and other operations involving XML
# What
It is a simple command-line application formatting XML files written in Python
# Usage
```bash
xml-formatter -i sample.xml -o formatted_test.xml
```
# Installation
## Production Build
```bash
pip install xml-formatter
```
## Dev Build
### Linux
Run with one of the follwing:
```bash
bash install.sh
./install.sh
sh install.sh
```
### Windows
Double click on `install.bat` or run
```bash
install.bat
```
# Usage
```bash
python .\xml-format.py -i .\sample.xml -o formatted_test.xml
```
# Register a shell command
The section is about registering shell commands using the `Click` library. Maybe you are curious, about crafting your own OS? Go for it! I do it
and it is a lot of fun :)
The best way to have a system wide executable command on both, Windows and Linux systems is to use setuputools.
There is a description in the click package about [how to do it](https://click.palletsprojects.com/en/8.1.x/setuptools/#setuptools-integration)
In a nutshell, the setup.py file has to follow a certain pattern, e.g.
```python
from setuptools import setup, find_packages
setup(
name='prettify_xml',
version='0.4.3',
packages=find_packages(),
include_package_data=True,
install_requires=[
'Click',
],
entry_points={
'console_scripts': [
'formatter = prettify_xml.formatter:format',
],
},
)
```
Then, you can run on Windows:
```bash
python -m venv venv
venv/Scripts/activate
pip install --editable .
```
And on Linux you can run:
```bash
python -m venv venv
source venv/bin/activate
pip install --editable .
```
Then, test the application with:
```bash
xml-formatter -i sample.xml -o formatted_test.xml
```
Raw data
{
"_id": null,
"home_page": "http://www.codeberg/cap_jmk/xml-formatter",
"name": "prettify-xml",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "",
"author": "Julian M. Kleber",
"author_email": "julian.kleber@sail.black",
"download_url": "https://files.pythonhosted.org/packages/6f/d0/f822d826ed1668877f3ace1be7724bbf144b89c7c71501ad2871fdc4c321/prettify-xml-0.4.5.tar.gz",
"platform": null,
"description": "# prettify-xml\n\n[](https://www.gnu.org/licenses/gpl-3.0)\n \n \n[](https://chembee.readthedocs.io/en/latest/?badge=latest)\n[](https://ci.codeberg.org/sail.black/chembee)\n\n# Why \n\nPretty xml output is necessary for debugging xml-based communications and other operations involving XML\n\n# What \n\nIt is a simple command-line application formatting XML files written in Python\n\n# Usage \n\n```bash\nxml-formatter -i sample.xml -o formatted_test.xml\n```\n\n\n# Installation\n\n## Production Build \n\n```bash \npip install xml-formatter\n```\n\n## Dev Build\n### Linux \n\nRun with one of the follwing: \n```bash\nbash install.sh\n./install.sh\nsh install.sh\n```\n\n\n### Windows\n\nDouble click on `install.bat` or run\n\n```bash\ninstall.bat\n```\n\n\n\n# Usage \n\n\n\n\n```bash\npython .\\xml-format.py -i .\\sample.xml -o formatted_test.xml\n```\n\n# Register a shell command \n\nThe section is about registering shell commands using the `Click` library. Maybe you are curious, about crafting your own OS? Go for it! I do it \nand it is a lot of fun :)\n\n\nThe best way to have a system wide executable command on both, Windows and Linux systems is to use setuputools.\n\nThere is a description in the click package about [how to do it](https://click.palletsprojects.com/en/8.1.x/setuptools/#setuptools-integration)\n\nIn a nutshell, the setup.py file has to follow a certain pattern, e.g.\n\n```python \nfrom setuptools import setup, find_packages\n\nsetup(\n name='prettify_xml',\n version='0.4.3',\n packages=find_packages(),\n include_package_data=True,\n install_requires=[\n 'Click',\n ],\n entry_points={\n 'console_scripts': [\n 'formatter = prettify_xml.formatter:format',\n ],\n },\n)\n```\n\nThen, you can run on Windows: \n\n```bash \npython -m venv venv \nvenv/Scripts/activate\npip install --editable .\n```\n\nAnd on Linux you can run: \n\n```bash \npython -m venv venv \nsource venv/bin/activate\npip install --editable .\n```\n\nThen, test the application with: \n\n```bash\nxml-formatter -i sample.xml -o formatted_test.xml\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "CLI for prettifying XML",
"version": "0.4.5",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "ff0df4044fcfa42efb8d1d011c1dddf0",
"sha256": "881a7602882536d93fd76b874b47e08166fe093083ef2302afa50150013f6229"
},
"downloads": -1,
"filename": "prettify_xml-0.4.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ff0df4044fcfa42efb8d1d011c1dddf0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 15234,
"upload_time": "2022-12-22T19:03:11",
"upload_time_iso_8601": "2022-12-22T19:03:11.247733Z",
"url": "https://files.pythonhosted.org/packages/42/5f/37f20892dcfe8ce54a3ee2eab30c64418ae7707a24e571288da4db063d58/prettify_xml-0.4.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "45f40fc1a531f3e9c875a39fad952a4c",
"sha256": "b332c899f1e51352c783c30f750c609de801e6f99a94ef865aa58b80757820a3"
},
"downloads": -1,
"filename": "prettify-xml-0.4.5.tar.gz",
"has_sig": false,
"md5_digest": "45f40fc1a531f3e9c875a39fad952a4c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 14903,
"upload_time": "2022-12-22T19:03:13",
"upload_time_iso_8601": "2022-12-22T19:03:13.094522Z",
"url": "https://files.pythonhosted.org/packages/6f/d0/f822d826ed1668877f3ace1be7724bbf144b89c7c71501ad2871fdc4c321/prettify-xml-0.4.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-22 19:03:13",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "prettify-xml"
}