|
1 | | -# py-csv-json-cli |
2 | | -Py CSV JSON Converter CLI App |
| 1 | +# Py CSV JSON Converter CLI App |
| 2 | + |
| 3 | +CSV and JSON Converter CLI app build with [Python Fire library](https://github.com/google/python-fire) |
| 4 | + |
| 5 | +CLI app included in distribution folder (dist/py-csv-json-cli.exe) |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +## Basic Usage |
| 11 | +1. Help |
| 12 | +``` |
| 13 | +py py-csv-json-cli -- |
| 14 | +py py-csv-json-cli --help |
| 15 | +* Note: close help with key 'q' |
| 16 | +``` |
| 17 | +2. Covert CSV to JSON |
| 18 | +``` |
| 19 | +py py-csv-json-cli csvtojson car-models.csv |
| 20 | +* Note: example of csv file is car-models.csv |
| 21 | +``` |
| 22 | +3. Covert JSON to CSV |
| 23 | +``` |
| 24 | +py py-csv-json-cli jsontocsv csvtojson-1652043963.json |
| 25 | +``` |
| 26 | + |
| 27 | +## Setup for Local Development |
| 28 | + |
| 29 | +1. Creating a virtual environment |
| 30 | +``` |
| 31 | +py -m venv venv |
| 32 | +``` |
| 33 | +2. Activate the environment |
| 34 | +``` |
| 35 | +.\venv\Scripts\activate |
| 36 | +``` |
| 37 | +3. Install all of the packages using requirements.txt |
| 38 | +``` |
| 39 | +pip install -r requirements.txt |
| 40 | +``` |
| 41 | +4. Run cli application |
| 42 | +``` |
| 43 | +py py-csv-json-cli.py |
| 44 | +``` |
| 45 | +5. Build cli output (more refer to : https://pyinstaller.org/en/stable/usage.html) |
| 46 | +``` |
| 47 | +pyinstaller py-csv-json-cli.spec |
| 48 | +``` |
| 49 | +6. Export a list of all installed packages (Optional) |
| 50 | +``` |
| 51 | +pip freeze > requirements.txt |
| 52 | +``` |
| 53 | +7. Leaving the environment |
| 54 | +``` |
| 55 | +deactivate |
| 56 | +``` |
| 57 | + |
| 58 | +## Reference Links |
| 59 | +- https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/ |
| 60 | +- https://docs.python.org/3/library/index.html |
| 61 | +- https://docs.python.org/3/library/datetime.html |
| 62 | +- https://docs.python.org/3/library/json.html |
| 63 | +- https://docs.python.org/3/library/csv.html |
| 64 | +- https://github.com/google/python-fire |
| 65 | +- https://pyinstaller.org/en/stable/usage.html |
| 66 | +- https://www.geeksforgeeks.org/convert-csv-to-json-using-python/ |
| 67 | +- https://www.geeksforgeeks.org/convert-json-to-csv-in-python/?ref=lbp |
| 68 | + |
0 commit comments