From 79dadaef8b0739089b978287cc77d02862a33871 Mon Sep 17 00:00:00 2001 From: Kyle Stevenson Date: Sat, 11 Nov 2023 08:41:08 +0000 Subject: [PATCH 1/7] lint: CHANGELOG markdown syntax linted --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 983b3d1..abaedb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) @@ -18,7 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed -- Broken link in get_data_from_form_with_guide_spec function docs page +- Broken link in get_data_from_form_with_guide_spec function docs page ## [0.4.1] - 2020-08-12 @@ -56,4 +57,3 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - First Version - From b66ca48b237f0004dff5630afc97fa750771dc03 Mon Sep 17 00:00:00 2001 From: Kyle Stevenson Date: Sat, 11 Nov 2023 08:49:51 +0000 Subject: [PATCH 2/7] update: Added standard github python gitignore --- .gitignore | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9c3718f..c5dd66b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,136 @@ +### PROJECT SPECIFIC ### + .~lock.* -__pycache__ /.ve -/tests/data/out/*.xlsx \ No newline at end of file +/tests/data/out/*.xlsx + + +### PYTHON ### +# https://github.com/github/gitignore/blob/main/Python.gitignore + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ From 375993b5cfbe567ad0f5cbb962f9abf06a04672c Mon Sep 17 00:00:00 2001 From: Kyle Stevenson Date: Sat, 11 Nov 2023 09:18:26 +0000 Subject: [PATCH 3/7] fix: added Python version strategy to lint.yml --- .github/workflows/lint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7b6cde5..edefea6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,6 +4,9 @@ on: [push, pull_request] jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v2 - name: Setup python From 5441b0a64200a4374aa86bb8ac4bbf368a7c120c Mon Sep 17 00:00:00 2001 From: Kyle Stevenson Date: Sat, 11 Nov 2023 11:04:04 +0000 Subject: [PATCH 4/7] update: added libreoffice docker --- .gitignore | 3 ++- docker-compose.yml | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index c5dd66b..bf27dad 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,10 @@ .~lock.* /.ve +/tests/data/* +!/tests/data/*.xlsx /tests/data/out/*.xlsx - ### PYTHON ### # https://github.com/github/gitignore/blob/main/Python.gitignore diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2825514 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: "2.1" +services: + libreoffice: + image: lscr.io/linuxserver/libreoffice:latest + container_name: libreoffice + security_opt: + - seccomp:unconfined + environment: + - PUID=1000 + - PGID=1000 + - TZ=Etc/UTC + volumes: + - ./tests/data:/config + ports: + - 3000:3000 + - 3001:3001 + restart: unless-stopped From 6a7e1c0e9ea50727b5332f50cd2053269f32677c Mon Sep 17 00:00:00 2001 From: Kyle Stevenson Date: Sat, 11 Nov 2023 11:36:00 +0000 Subject: [PATCH 5/7] update: added sphinx-autobuild to dev dependencies --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 0d9ad95..2374196 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ "black==22.10.0", "sphinx", "sphinx_rtd_theme", + "sphinx-autobuild" ] }, ) From d8c4277d1bcdc6771bc40a3b31f68c01a85642e9 Mon Sep 17 00:00:00 2001 From: Kyle Stevenson Date: Sat, 11 Nov 2023 11:55:35 +0000 Subject: [PATCH 6/7] update: README.md to include package details and dev instructions --- README.md | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 113 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c39a4d4..1e50003 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,115 @@ -# spreadsheet-forms +# Spreadsheet Forms -See: +![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/OpenDataServices/spreadsheet-forms) -* https://spreadsheet-forms.readthedocs.io/en/latest/ -* https://pypi.org/project/spreadsheetforms/ -* or the docs/ directory in this repository +Spreadsheet Forms is a Python library that simplifies the process of working with data from forms in spreadsheets by converting them to and from JSON format. + +With Spreadsheet Forms, you can: + +- Generate blank spreadsheet templates for consistent data collection. +- Easily pre-fill spreadsheets with existing data for verification or updates. +- Convert structured spreadsheet data into JSON for convenient storage or processing. + +A customisable guide form spreadsheet dictates the data's structure, ensuring precision and order in your workflow. + +For more details on package distribution, visit [Spreadsheet Forms on PyPI](https://pypi.org/project/spreadsheetforms/). + +## Getting Started + +Ensure you have Python 3.7 or higher installed and then install Spreadsheet Forms using pip: + +```bash +pip install spreadsheetforms +``` + +## Example Usage + +The following example demonstrates how to use the [get_data_from_form](https://spreadsheet-forms.readthedocs.io/en/latest/api/get_data_from_form.html) function to extract data from a spreadsheet form: + +```python +from spreadsheetforms.api import get_data_from_form, GetDataFromFormMissingWorksheetAction + +data = get_data_from_form( + guide_filename, + in_filename, + date_format=None, + missing_worksheet_action=GetDataFromFormMissingWorksheetAction.RAISE_EXCEPTION +) +``` + +For detailed information on all available functions and their usage, please refer to our [comprehensive documentation](https://spreadsheet-forms.readthedocs.io/en/latest/). + +## Developer Setup + +To contribute to Spreadsheet Forms, start by cloning the repository and setting up a development environment: + +### Quick Start + +Clone the latest version of the repository: + +```bash +git clone https://github.com/OpenDataServices/spreadsheet-forms.git +cd spreadsheet-forms +``` + +Create a virtual environment and activate it: + +```bash +python3 -m venv .venv +source .venv/bin/activate +``` + +Install the package in editable mode with the development dependencies: + +```bash +pip install '.[dev]' +``` + +### Testing + +We use [pytest](https://docs.pytest.org/en/latest/) for testing. + +To run the test suite in verbose mode: + +```bash +pytest -v +``` + +### Docker + +We use [Docker](https://www.docker.com/) to run LibreOffice in a container to review document outputs. + +To build the LibreOffice container: + +```bash +docker-compose up +``` + +### Documentation Editing + +We use [Sphinx](https://www.sphinx-doc.org/en/master/) for documentation. + +To build the documentation locally: + +```bash +sphinx-build -M html ./docs ./docs/_build/html +open docs/_build/html/index.html +``` + +To hot reload the documentation locally: + +```bash +sphinx-autobuild ./docs ./docs/_build/html +``` + +## Contributing + +We welcome and encourage public contributions to Spreadsheet Forms! + +Please read our [Developer Docs](https://opendataservices.gitbook.io/developer-docs/) for more information about how we get our work done at [Open Data Services](https://opendataservices.coop/). + +You can also reach out to us on our [GitHub account](https://github.com/opendataservices). + +## License + +This project is licensed under the [MIT License](LICENSE). From 442136c127911236c153749327fd4603c12aff0d Mon Sep 17 00:00:00 2001 From: Kyle Stevenson Date: Sat, 11 Nov 2023 23:37:52 +0000 Subject: [PATCH 7/7] fix: missing comma --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2374196..edf3764 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ "black==22.10.0", "sphinx", "sphinx_rtd_theme", - "sphinx-autobuild" + "sphinx-autobuild", ] }, )