gristlabs_grist-core/sandbox/grist
Alex Hall 42afb17e36 (core) Run and test imports only in Python 3, upgrade openpyxl, fix weird date handling
Summary:
Python 2 only needs to be supported for the sake of old documents and formulas. This doesn't apply to the separate sandboxes that parse files for imports. Using Python 3 only allows using newer libraries and library versions. In particular, the latest version of openpyxl doesn't support Python 2. This will also make it easier to make other similar changes in the future, such as replacing messytables with a modern library. See https://grist.slack.com/archives/C0234CPPXPA/p1661261829343999?thread_ts=1661260442.837959&cid=C0234CPPXPA

The latest openpyxl is better at handling a particular edge case with broken dates in Excel, but still doesn't quite do what we want, so we monkeypatch it. Discussion: https://grist.slack.com/archives/C02EGJ1FUCV/p1661440851911869?thread_ts=1661154219.515549&cid=C02EGJ1FUCV

Setting `preferredPythonVersion` to '3' in SafePythonComponent ensures that JS always creates import sandboxes that use Python 3. Within Python, a module used by all imports will raise an error in Python 2. Python unit tests of imports are now only run in Python 3, using the `load_tests` protocol of `unittest`.

Test Plan: Mostly existing tests. Added another strange date to the Excel fixture.

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3606
2022-09-02 16:27:34 +02:00
..
functions (core) Upgrade sortedcontainers, python_dateutil, and html5lib for better Python 3.10 compatibility 2022-08-30 16:46:29 +02:00
imports (core) Run and test imports only in Python 3, upgrade openpyxl, fix weird date handling 2022-09-02 16:27:34 +02:00
acl_formula.py (core) AddOrUpdateRecord user action 2022-02-03 16:22:51 -05:00
acl.py (core) Remaining Python 3 compatibility changes 2021-06-25 12:00:58 +02:00
action_obj.py (core) External requests 2022-06-17 21:53:20 +02:00
action_summary.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
actions.py (core) AddOrUpdateRecord user action 2022-02-03 16:22:51 -05:00
autocomplete_context.py (core) Formula autocomplete improvements for references and lookups 2022-08-20 19:11:41 +02:00
codebuilder.py (core) Error explanations from friendly-traceback 2022-08-12 19:45:00 +02:00
column.py (core) Add PUT /records DocApi endpoint to AddOrUpdate records 2022-02-12 09:44:34 +02:00
csv_patch.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
depend.py (core) Implement trigger formulas (generalizing default formulas) 2021-06-25 22:53:07 -04:00
docactions.py (core) Undo bug - restoring dependencies for trigger formulas 2021-12-06 16:09:41 +01:00
docmodel.py (core) Implementing row conditional formatting 2022-08-09 20:11:36 +02:00
engine.py (core) Formula autocomplete improvements for references and lookups 2022-08-20 19:11:41 +02:00
friendly_errors.py (core) Error explanations from friendly-traceback 2022-08-12 19:45:00 +02:00
gencode.py (core) Error explanations from friendly-traceback 2022-08-12 19:45:00 +02:00
grist.py (core) Use MixedTypesKey for sort_by arg of lookupRecords to avoid errors in Python 3 2021-11-09 18:08:29 +02:00
identifiers.py (core) Remove accents when picking identifiers 2021-08-24 14:47:50 +02:00
import_actions.py (core) Prevent rebuilding usercode for every AddColumn when importing 2022-05-24 22:29:20 +02:00
logger.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
lookup.py (core) External requests 2022-06-17 21:53:20 +02:00
main.py (core) ensure randomness works when sandbox is cloned from a checkpoint 2022-07-27 14:59:27 -04:00
match_counter.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
migrations.py (core) Implementing row conditional formatting 2022-08-09 20:11:36 +02:00
moment.py (core) New type conversion in the backend 2022-02-04 20:28:13 +02:00
objtypes.py (core) Error explanations from friendly-traceback 2022-08-12 19:45:00 +02:00
parse_data.py (core) Switch excel import parsing from messytables+xlrd to openpyxl, and ignore empty rows 2022-05-12 14:43:21 +02:00
records.py Tweaks to documentation comments for user-facing Grist functions (#126) 2022-02-13 00:45:24 -05:00
relabeling.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
relation.py (core) Polish and enable Reference List widget 2021-08-12 11:51:21 -07:00
runtests.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
sandbox.py (core) communicate with sandbox via standard pipes 2021-07-12 06:45:47 -04:00
schema.py (core) Implementing row conditional formatting 2022-08-09 20:11:36 +02:00
sort_specs.py (core) Adding sort options for columns. 2021-11-03 15:31:39 +01:00
summary.py (core) Nice summary table IDs 2022-07-14 12:09:56 +02:00
table_data_set.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
table.py (core) More helpful messages when formula probably needs to use Table.all 2022-08-24 14:49:33 +02:00
test_acl_formula.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
test_acl_renames.py (core) Update ACL resources/rules when tables/columns get renamed 2021-01-04 22:03:01 -05:00
test_actions.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
test_codebuilder.py (core) Error explanations from friendly-traceback 2022-08-12 19:45:00 +02:00
test_column_actions.py (core) Nice summary table IDs 2022-07-14 12:09:56 +02:00
test_completion.py (core) Formula autocomplete improvements for references and lookups 2022-08-20 19:11:41 +02:00
test_default_formulas.py (core) Fix lookups in default formulas 2020-09-10 18:06:06 -04:00
test_depend.py (core) Fix recursion error in invalidate_deps 2021-06-18 15:42:20 +02:00
test_derived.py (core) Nice summary table IDs 2022-07-14 12:09:56 +02:00
test_display_cols.py (core) Automatically remove empty summary table rows 2022-07-08 18:56:41 +02:00
test_docmodel.py (core) Backend restrictions for raw data widgets 2022-02-15 22:04:32 +02:00
test_engine.py (core) Error explanations from friendly-traceback 2022-08-12 19:45:00 +02:00
test_find_col.py Correct spelling mistakes 2022-02-19 09:46:49 +00:00
test_formula_error.py (core) More helpful messages when formula probably needs to use Table.all 2022-08-24 14:49:33 +02:00
test_formula_undo.py (core) Mark column changing actions as indirect when adding data to empty column 2022-05-25 16:21:04 +02:00
test_functions.py (core) Use standard library uuid.uuidv4 when possible for better randomness 2022-08-12 16:45:11 +02:00
test_gencode.py (core) Error explanations from friendly-traceback 2022-08-12 19:45:00 +02:00
test_import_actions.py (core) Create an extra raw data widget when creating a table 2022-02-01 21:19:30 +02:00
test_logger.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
test_lookups.py (core) Log number of rows in user tables in data engine 2022-02-22 00:59:56 +02:00
test_match_counter.py (core) Import Hashable from six.moves.collections_abc 2022-02-22 00:27:51 +02:00
test_migrations.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
test_moment.py (core) New type conversion in the backend 2022-02-04 20:28:13 +02:00
test_record_func.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
test_recordlist.py (core) Return RecordSet instead of list from property access when possible, to allow further property access 2022-04-05 18:05:00 +02:00
test_reflist_rel.py (core) New type conversion in the backend 2022-02-04 20:28:13 +02:00
test_relabeling.py (core) Remaining Python 3 compatibility changes 2021-06-25 12:00:58 +02:00
test_renames2.py Correct spelling mistakes 2022-02-19 09:46:49 +00:00
test_renames.py (core) Fix renaming columns when iterating over Table.all in comprehension 2022-07-21 18:30:16 +02:00
test_replay.py (core) Add test_replay for easily replaying data sent to the sandbox purely within python 2021-06-30 16:56:09 +02:00
test_requests.py (core) External requests 2022-06-17 21:53:20 +02:00
test_rules_grid.py (core) Implementing row conditional formatting 2022-08-09 20:11:36 +02:00
test_rules.py (core) Updating RawData views 2022-05-04 21:41:42 +02:00
test_side_effects.py (core) Ensure formulas return something and don't assign to attributes of rec 2022-05-23 21:06:18 +02:00
test_sort_spec.py (core) Adding sort options for columns. 2021-11-03 15:31:39 +01:00
test_summary2.py (core) Nice summary table IDs 2022-07-14 12:09:56 +02:00
test_summary_choicelist.py (core) Nice summary table IDs 2022-07-14 12:09:56 +02:00
test_summary_undo.py (core) Nice summary table IDs 2022-07-14 12:09:56 +02:00
test_summary.py (core) Fix error when updating summary table formulas after rename 2022-08-11 12:51:11 +02:00
test_table_actions.py (core) Nice summary table IDs 2022-07-14 12:09:56 +02:00
test_table_data_set.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
test_temp_rowids.py (core) Allow using negative rowIds to add records and refer to them in Reference values. 2020-12-15 16:39:56 -05:00
test_textbuilder.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
test_treeview.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
test_trigger_formulas.py (core) Error explanations from friendly-traceback 2022-08-12 19:45:00 +02:00
test_twowaymap.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
test_types.py (core) Nicer conversion from numeric to text 2021-09-30 14:16:24 +02:00
test_undo.py (core) Updating RawData views 2022-05-04 21:41:42 +02:00
test_urllib_patch.py (core) Remaining Python 3 compatibility changes 2021-06-25 12:00:58 +02:00
test_user.py (core) add a user.SessionID value for trigger formulas and granular access rules 2022-02-22 12:50:43 -05:00
test_useractions.py (core) Keep track of row counts per table 2022-08-03 08:13:33 -07:00
testsamples.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
testscript.json (core) Updating RawData views 2022-05-04 21:41:42 +02:00
testutil.py (core) Implement trigger formulas (generalizing default formulas) 2021-06-25 22:53:07 -04:00
textbuilder.py (core) Remaining Python 3 compatibility changes 2021-06-25 12:00:58 +02:00
treeview.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
twowaymap.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
tzdata.data (core) move data engine code to core 2020-07-29 08:57:25 -04:00
urllib_patch.py (core) Remaining Python 3 compatibility changes 2021-06-25 12:00:58 +02:00
user.py (core) add a user.SessionID value for trigger formulas and granular access rules 2022-02-22 12:50:43 -05:00
useractions.py (core) Implementing row conditional formatting 2022-08-09 20:11:36 +02:00
usercode.py (core) Raise syntax errors that Python can format nicely to show the location 2021-09-24 15:07:09 +02:00
usertypes.py (core) New type conversion in the backend 2022-02-04 20:28:13 +02:00
xmlrunner.py (core) Run python unit tests again in python 3 2021-06-30 21:46:18 +02:00