Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Made compatibility with lark ≥1.0!#100

Merged
htorianik merged 9 commits into
amplify-education:masterfrom
KOLANICH-libs:newer_lark
Dec 28, 2022
Merged

Made compatibility with lark ≥1.0!#100
htorianik merged 9 commits into
amplify-education:masterfrom
KOLANICH-libs:newer_lark

Conversation

@KOLANICH

@KOLANICH KOLANICH commented Jun 1, 2022

Copy link
Copy Markdown
Contributor

No description provided.

@KOLANICH KOLANICH requested a review from a team June 1, 2022 14:19
Comment thread hcl2/parser.py Outdated
@KOLANICH

Copy link
Copy Markdown
Contributor Author

This import should be moved to the top

No, it shouldn't. End users are not supposed to call it.

@KOLANICH

Copy link
Copy Markdown
Contributor Author

That branch should be taken only on the machines of the ones building a wheel from source. If it is taken in an installed wheel, it is likely it will error - /usr/lib/python3.10/dist-packages (the path on Debian-derived distros when packages are system-installed) is not available for writing.

@KOLANICH KOLANICH requested review from rddimon and removed request for aoskotsky-amplify December 23, 2022 20:00
@rddimon

rddimon commented Dec 28, 2022

Copy link
Copy Markdown
Contributor

Hi @KOLANICH

Will you be able to rebase with the master and fix PR checks?

@KOLANICH

Copy link
Copy Markdown
Contributor Author

Will you be able to rebase with the master

already done.

fix PR checks?

Works for me locally (pytest ./test). IDK why doesn't it work on the server, the CI pipeline seems to be non reporting what exactly is wrong. Feel free to fix the CI yourself.

@rddimon

rddimon commented Dec 28, 2022

Copy link
Copy Markdown
Contributor

https://github.com/amplify-education/python-hcl2/actions/runs/3794008621/jobs/6451675562

ModuleNotFoundError: No module named 'lark'

@rddimon

rddimon commented Dec 28, 2022

Copy link
Copy Markdown
Contributor

@htorianik will help with it

@rddimon rddimon assigned rddimon and htorianik and unassigned rddimon Dec 28, 2022
@rddimon rddimon added the enhancement New feature or request label Dec 28, 2022
@KOLANICH

Copy link
Copy Markdown
Contributor Author

Under "not reporting" I meant this: https://github.com/amplify-education/python-hcl2/actions/runs/3794168036/jobs/6451977387

py310-unit: commands[1]> nose2 --config tox.ini --verbose
2022-12-28T13:05:12.7068749Z test_load_terraform (test.unit.test_load.TestLoad)
2022-12-28T13:05:16.2686751Z Test parsing a set of hcl2 files and force recreating the parser file ... ok
2022-12-28T13:05:16.2692288Z test_load_terraform_from_cache (test.unit.test_load.TestLoad)
2022-12-28T13:05:16.3123322Z Test parsing a set of hcl2 files from a cached parser file ... ok
2022-12-28T13:05:16.3129150Z
2022-12-28T13:05:20.7365920Z ----------------------------------------------------------------------
2022-12-28T13:05:20.7366718Z Ran 2 tests in 3.606s
2022-12-28T13:05:20.7458974Z
2022-12-28T13:05:20.7459146Z FAILED
2022-12-28T13:05:20.7459476Z Name Stmts Miss Branch BrPart Cover Missing
2022-12-28T13:05:20.7460100Z -----------------------------------------------------------------
2022-12-28T13:05:20.7460545Z hcl2/__init__.py 5 2 0 0 60% 5-6
2022-12-28T13:05:20.7460829Z hcl2/api.py 6 0 0 0 100%
2022-12-28T13:05:20.7468841Z hcl2/lark_parser.py 1932 942 641 45 45% 49, 75-86, 94-137, 140-143, 151-161, 165-167, 178-197, 201-207, 218-234, 239-241, 244-249, 260-265, 294->297, 321-322, 325-334, 350-351, 366-367, 370, 374, 384, 389-390, 398-429, 447, 461-463, 467-469, 472, 475, 478-487, 491, 495, 498-510, 513-516, 519, 522, 526-537, 541-550, 554, 558, 576, 588-606, 609, 618, 623-638, 641-651, 654-663, 666-667, 671, 678, 682, 686, 691-706, 714-720, 728, 731-733, 739, 746, 749-752, 761-800, 806-807, 815, 819, 822, 830-832, 836-838, 846-851, 855-861, 874, 877-882, 885, 889, 892, 899-903, 909-914, 922-929, 932, 935-944, 947-952, 956, 958, 960, 962, 967-988, 1002, 1005-1006, 1009, 1015, 1020, 1029-1030, 1034, 1037, 1056-1060, 1063, 1079-1084, 1090, 1093, 1101, 1116-1118, 1121, 1126, 1129, 1133, 1138, 1143, 1147, 1161, 1179, 1184, 1200-1203, 1206, 1209-1213, 1245, 1248->exit, 1262-1266, 1287, 1291, 1294-1301, 1304, 1315, 1318, 1321, 1325, 1343-1346, 1373-1375, 1378-1379, 1396, 1400->1394, 1433, 1436-1438, 1467-1470, 1473, 1491, 1502, 1506, 1527-1537, 1558-1563, 1577-1579, 1586-1589, 1604, 1609-1610, 1655-1666, 1690-1700, 1706, 1722-1727, 1742, 1748-1749, 1752-1790, 1793-1802, 1806, 1808, 1812, 1817-1819, 1822-1835, 1842-1858, 1889-1892, 1908, 1918-1920, 1923-1946, 1950-1953, 1960-1961, 1964-1993, 1998-2004, 2008-2014, 2052, 2061, 2063, 2071, 2081-2087, 2097, 2100, 2105-2134, 2167-2169, 2172, 2181, 2194-2196, 2239, 2252-2267, 2274, 2276, 2289-2297, 2319-2331, 2336-2345, 2373-2377, 2384-2386, 2393-2395, 2400, 2406, 2408-2409, 2423-2427, 2432->exit, 2447, 2452-2453, 2456-2457, 2462-2463, 2472-2474, 2484, 2584, 2633, 2638, 2646, 2650, 2655-2656, 2659-2660, 2663, 2693-2898, 2901, 2906-2911, 2917->2926, 2929-2932, 2942-2945, 2950-2951, 2967, 2975, 3004-3008, 3013-3018, 3021, 3027-3035, 3039, 3043, 3060-3062, 3065-3083, 3086-3102, 3105-3107, 3113, 3118, 3123, 3128, 3133, 3138, 3143
2022-12-28T13:05:20.7470836Z hcl2/parser.py 18 1 4 1 91% 46
2022-12-28T13:05:20.7471589Z hcl2/transformer.py 166 10 74 10 91% 18, 32, 36, 91->93, 108, 121, 126, 167, 176, 193, 203, 260->263 2022-12-28T13:05:20.7472658Z hcl2/version.py 2 0 0 0 100%
2022-12-28T13:05:20.7473326Z -----------------------------------------------------------------
2022-12-28T13:05:20.7563524Z TOTAL 2129 955 719 56 49%
2022-12-28T13:05:20.7563738Z
2022-12-28T13:05:20.7801060Z py310-unit: exit 1 (8.61 seconds) /home/runner/work/python-hcl2/python-hcl2> nose2 --config tox.ini --verbose pid=2012
2022-12-28T13:05:20.7840611Z py310-unit: FAIL ✖ in 22.56 seconds
2022-12-28T13:05:20.7841351Z py311-unit: skipped because could not find python interpreter with spec(s): py311
2022-12-28T13:05:20.7874643Z lint: SKIP (0.74 seconds)
2022-12-28T13:05:20.7875119Z py37-unit: SKIP (0.00 seconds)
2022-12-28T13:05:20.7875429Z py38-unit: SKIP (0.00 seconds)
2022-12-28T13:05:20.7875758Z py39-unit: SKIP (0.00 seconds)
2022-12-28T13:05:20.7876198Z py310-unit: FAIL code 1 (22.56=setup[0.17]+cmd[13.78,8.61] seconds)
2022-12-28T13:05:20.7876568Z py311-unit: SKIP (0.00 seconds)
2022-12-28T13:05:20.7876876Z evaluation failed :( (23.56 seconds)
2022-12-28T13:05:20.8339598Z ##[error]Process completed with exit code 255.

No exception, no failed test name, no details, just something somewhere has failed.

@htorianik

Copy link
Copy Markdown
Contributor

@KOLANICH nose2 requires coverage >80% like set in .coveragerc:

fail_under = 80

Give me a second, I'll fix it. It happened because lark_parser.py wasn't ignored for some reason.

Comment thread .github/workflows/pr_check.yml
…ause lark by now generates the code not passing `mypy` checks. And `mypy` seems to be having a bug that its ignore settings sometimes don't work.
@KOLANICH

Copy link
Copy Markdown
Contributor Author

Done. 🎉🎉🎉 I guess you may want to report the bugs in mypy and lark.

Comment thread .github/workflows/pr_check.yml Outdated
Comment thread pyproject.toml Outdated
Comment thread .github/workflows/pr_check.yml Outdated
@KOLANICH

Copy link
Copy Markdown
Contributor Author

2BH I'm not sure how to behave about that and if the parsers generated by lark==1.15 are compatible with lark==1.0. It needs some testing.

@rddimon

rddimon commented Dec 28, 2022

Copy link
Copy Markdown
Contributor

2BH I'm not sure how to behave about that and if the parsers generated by lark==1.15 are compatible with lark==1.0. It needs some testing.

I just wanted to highlight it

@KOLANICH

Copy link
Copy Markdown
Contributor Author

Tested. 0. versions are incompatible with the generated parser, 1. are compatible.

@htorianik htorianik merged commit c81502c into amplify-education:master Dec 28, 2022
@rddimon

rddimon commented Dec 28, 2022

Copy link
Copy Markdown
Contributor

@KOLANICH Nice work!

Thank you for your contribution!

@KOLANICH

Copy link
Copy Markdown
Contributor Author

In theory we can support both 1. and 0. with a little dispatching based on version.

@rddimon

rddimon commented Dec 28, 2022

Copy link
Copy Markdown
Contributor

In my opinion, it's not needed
People can use python-hcl2<4.2.0 or update it in another case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants