diff --git a/CHANGES.txt b/CHANGES.txt index 2bf36685..417d820d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,12 @@ Pyxform Changelog +v2.1.0, 2024-09-05 +* Require Python 3.10, 3.11 or 3.12 by @lindsay-stevens in https://github.com/XLSForm/pyxform/pull/706 +* Detect instance expressions with double quotes by @lindsay-stevens in https://github.com/XLSForm/pyxform/pull/709 +* Library API for non-path input, accept markdown and dict input by @lindsay-stevens in https://github.com/XLSForm/pyxform/pull/712 +* Allow whitespace on either side of main header delimiter by @lindsay-stevens in https://github.com/XLSForm/pyxform/pull/718 +* Support offline entities spec v2024.1.0 via opt-in setting by @lindsay-stevens in https://github.com/XLSForm/pyxform/pull/719 + v2.0.3, 2024-04-18 * Don't use regex to clean up XML following pretty-printing by @lindsay-stevens in https://github.com/XLSForm/pyxform/pull/681 * dev: update dependencies, testing, packaging, and linting/formatting by @lindsay-stevens in https://github.com/XLSForm/pyxform/pull/685 diff --git a/README.rst b/README.rst index eac4c64b..db987646 100644 --- a/README.rst +++ b/README.rst @@ -138,7 +138,7 @@ Releasing pyxform pyxform_validator_update odk update ODK-Validate-vx.x.x.jar -2. Run all tests through Validate by setting the default for ``run_odk_validate`` to ``kwargs.get("run_odk_validate", True)`` in ``tests/pyxform_test_case.py``. +2. Run all tests through Validate by setting the default for ``run_odk_validate`` to ``True`` in ``tests/pyxform_test_case.py``. 3. Draft a new GitHub release with the list of merged PRs. Follow the title and description pattern of the previous release. 4. Checkout a release branch from latest upstream master. 5. Update ``CHANGES.txt`` with the text of the draft release. diff --git a/pyproject.toml b/pyproject.toml index 436947e1..a72dd9a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pyxform" -version = "2.0.3" +version = "2.1.0" authors = [ {name = "github.com/xlsform", email = "support@getodk.org"}, ] @@ -9,7 +9,7 @@ readme = "README.rst" requires-python = ">=3.10" dependencies = [ "xlrd==2.0.1", # Read XLS files - "openpyxl==3.1.2", # Read XLSX files + "openpyxl==3.1.3", # Read XLSX files "defusedxml==0.7.1", # Parse XML ] @@ -17,9 +17,9 @@ dependencies = [ # Install with `pip install pyxform[dev]`. dev = [ "formencode==2.1.0", # Compare XML - "lxml==5.2.2", # XPath test expressions - "psutil==5.9.8", # Process info for performance tests - "ruff==0.4.5", # Format and lint + "lxml==5.3.0", # XPath test expressions + "psutil==6.0.0", # Process info for performance tests + "ruff==0.6.4", # Format and lint ] [project.urls] diff --git a/pyxform/__init__.py b/pyxform/__init__.py index 0073a72b..5bddfda9 100644 --- a/pyxform/__init__.py +++ b/pyxform/__init__.py @@ -4,7 +4,7 @@ Collect easy. """ -__version__ = "2.0.3" +__version__ = "2.1.0" from pyxform.builder import ( SurveyElementBuilder, diff --git a/pyxform/validators/odk_validate/.last_check b/pyxform/validators/odk_validate/.last_check index b1d46d4a..cb85eb74 100644 --- a/pyxform/validators/odk_validate/.last_check +++ b/pyxform/validators/odk_validate/.last_check @@ -1 +1 @@ -2023-09-19T16:41:46Z \ No newline at end of file +2024-09-05T21:15:02Z \ No newline at end of file diff --git a/pyxform/validators/odk_validate/bin/ODK_Validate.jar b/pyxform/validators/odk_validate/bin/ODK_Validate.jar index e60eb8e7..56cc7f87 100755 Binary files a/pyxform/validators/odk_validate/bin/ODK_Validate.jar and b/pyxform/validators/odk_validate/bin/ODK_Validate.jar differ diff --git a/pyxform/validators/odk_validate/bin/installed.json b/pyxform/validators/odk_validate/bin/installed.json index 84cd127e..1b10d9f0 100644 --- a/pyxform/validators/odk_validate/bin/installed.json +++ b/pyxform/validators/odk_validate/bin/installed.json @@ -1,17 +1,17 @@ { "assets": [ { - "browser_download_url": "https://github.com/getodk/validate/releases/download/v1.18.0/ODK-Validate-v1.18.0.jar", + "browser_download_url": "https://github.com/getodk/validate/releases/download/v1.19.0/ODK-Validate-v1.19.0.jar", "content_type": "application/java-archive", - "created_at": "2023-09-16T04:28:56Z", - "download_count": 2, - "id": 126294873, + "created_at": "2024-09-05T21:10:16Z", + "download_count": 0, + "id": 190700570, "label": null, - "name": "ODK-Validate-v1.18.0.jar", - "node_id": "RA_kwDOAmc2ms4HhxtZ", - "size": 5618270, + "name": "ODK-Validate-v1.19.0.jar", + "node_id": "RA_kwDOAmc2ms4LXdwa", + "size": 13416248, "state": "uploaded", - "updated_at": "2023-09-16T04:28:57Z", + "updated_at": "2024-09-05T21:10:18Z", "uploader": { "avatar_url": "https://avatars.githubusercontent.com/u/967540?v=4", "events_url": "https://api.github.com/users/lognaturel/events{/privacy}", @@ -32,10 +32,10 @@ "type": "User", "url": "https://api.github.com/users/lognaturel" }, - "url": "https://api.github.com/repos/getodk/validate/releases/assets/126294873" + "url": "https://api.github.com/repos/getodk/validate/releases/assets/190700570" } ], - "assets_url": "https://api.github.com/repos/getodk/validate/releases/121394106/assets", + "assets_url": "https://api.github.com/repos/getodk/validate/releases/173732535/assets", "author": { "avatar_url": "https://avatars.githubusercontent.com/u/967540?v=4", "events_url": "https://api.github.com/users/lognaturel/events{/privacy}", @@ -56,20 +56,20 @@ "type": "User", "url": "https://api.github.com/users/lognaturel" }, - "body": "## What's Changed\r\n* Upgrade [JavaRosa to 4.2.0](https://github.com/getodk/javarosa/releases/tag/v4.2.0) by @lognaturel in https://github.com/getodk/validate/pull/89\r\n\r\n\r\n**Full Changelog**: https://github.com/getodk/validate/compare/v1.17.0...v1.18.0", - "created_at": "2023-09-16T04:14:54Z", + "body": "## What's Changed\r\n* Upgrade [JavaRosa to 4.4.1](https://github.com/getodk/javarosa/releases/tag/v4.4.1) by @lognaturel in https://github.com/getodk/validate/pull/91\r\n\r\n\r\n**Full Changelog**: https://github.com/getodk/validate/compare/v1.18.0...v1.19.0", + "created_at": "2024-09-05T21:04:20Z", "draft": false, - "html_url": "https://github.com/getodk/validate/releases/tag/v1.18.0", - "id": 121394106, + "html_url": "https://github.com/getodk/validate/releases/tag/v1.19.0", + "id": 173732535, "mentions_count": 1, - "name": "v1.18.0", - "node_id": "RE_kwDOAmc2ms4HPFO6", + "name": "v1.19.0", + "node_id": "RE_kwDOAmc2ms4KWvK3", "prerelease": false, - "published_at": "2023-09-16T04:23:43Z", - "tag_name": "v1.18.0", - "tarball_url": "https://api.github.com/repos/getodk/validate/tarball/v1.18.0", + "published_at": "2024-09-05T21:07:12Z", + "tag_name": "v1.19.0", + "tarball_url": "https://api.github.com/repos/getodk/validate/tarball/v1.19.0", "target_commitish": "master", - "upload_url": "https://uploads.github.com/repos/getodk/validate/releases/121394106/assets{?name,label}", - "url": "https://api.github.com/repos/getodk/validate/releases/121394106", - "zipball_url": "https://api.github.com/repos/getodk/validate/zipball/v1.18.0" + "upload_url": "https://uploads.github.com/repos/getodk/validate/releases/173732535/assets{?name,label}", + "url": "https://api.github.com/repos/getodk/validate/releases/173732535", + "zipball_url": "https://api.github.com/repos/getodk/validate/zipball/v1.19.0" } \ No newline at end of file diff --git a/pyxform/xform2json.py b/pyxform/xform2json.py index e2011e6c..edf2576b 100644 --- a/pyxform/xform2json.py +++ b/pyxform/xform2json.py @@ -409,8 +409,7 @@ def _get_question_from_object(self, obj, type=None): if "label" in obj: k, v = self._get_label(obj["label"]) if isinstance(v, dict) and "label" in v.keys() and "media" in v.keys(): - for _k, _v in iter(v.items()): - question[_k] = _v + question.update(v) else: question[k] = v if "autoplay" in obj or "appearance" in obj or "count" in obj or "rows" in obj: @@ -424,8 +423,7 @@ def _get_question_from_object(self, obj, type=None): question_params = self._get_question_params_from_bindings(ref) if isinstance(question_params, dict): - for k, v in iter(question_params.items()): - question[k] = v + question.update(question_params) # Some values set from bindings are incorrect or incomplete. Correct them now. if "mediatype" in obj: diff --git a/tests/test_settings.py b/tests/test_settings.py index 640e65b2..64a9078c 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -10,7 +10,6 @@ class TestSettings(PyxformTestCase): Use the documented setting name, even if it's an alias. """ - # def test_form_title(self): """Should find the title set in the XForm.""" md = """ diff --git a/tests/test_xls2json_backends.py b/tests/test_xls2json_backends.py index 088bb51c..6ad6cf53 100644 --- a/tests/test_xls2json_backends.py +++ b/tests/test_xls2json_backends.py @@ -2,8 +2,8 @@ Test xls2json_backends module functionality. """ +import datetime import os -from datetime import datetime from unittest import TestCase import openpyxl @@ -81,9 +81,9 @@ def test_xls_with_many_empty_cells(self): self.maxDiff = None # Test fixture produced by adding data at cells IV1 and A19999. xls_path = os.path.join(bug_example_xls.PATH, "extra_columns.xls") - before = datetime.utcnow() + before = datetime.datetime.now(datetime.timezone.utc) xls_data = xls_to_dict(xls_path) - after = datetime.utcnow() + after = datetime.datetime.now(datetime.timezone.utc) self.assertLess((after - before).total_seconds(), 5) wb = xlrd.open_workbook(filename=xls_path) @@ -105,9 +105,9 @@ def test_xlsx_with_many_empty_cells(self): self.maxDiff = None # Test fixture produced (presumably) by a LibreOffice serialisation bug. xlsx_path = os.path.join(bug_example_xls.PATH, "UCL_Biomass_Plot_Form.xlsx") - before = datetime.utcnow() + before = datetime.datetime.now(datetime.timezone.utc) xlsx_data = xlsx_to_dict(xlsx_path) - after = datetime.utcnow() + after = datetime.datetime.now(datetime.timezone.utc) self.assertLess((after - before).total_seconds(), 5) wb = openpyxl.open(filename=xlsx_path, read_only=True, data_only=True)