Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major overhaul with cleanup and addition of type hints #13

Merged
merged 31 commits into from
Apr 11, 2024

Conversation

sveinse
Copy link
Member

@sveinse sveinse commented Apr 7, 2024

This is a major change of objdictgen. After the removal of py2 support, it primary objective was to add full type hint support. However, the process of adding typing revealed many unfortunate coding patterns which have been cleaned up. This PR has become a large step towards modernizing objdictgen.

The object model, i.e. what the class contain and how the data is store have not been changed in this fixup.

Unit testing, through pytest have been implemented. Now, the test suite is not complete, especially for the UI parts, but it has been used to ensure that the file type handling and code generating parts remains intact.

The objdictgen version after this merge will be 3.4

* Use display_error_dialog() instead of repeatedly calling wx.MessageDialog()
* Fixup UI exception handling
* Changed methods to snake_case
* Rename functions from CamelCase to snake_case
* Restructure functions in node.py to be staticmethods in Node
* Clean up confetest for pytest
* Restrict line length to 120. Break up long lines
* Formatting changes
* Add function docs
* Change wx Dialogs to with contexts
* Minor code changes
* Refactored conftest.py. Add new fixtures
* Refactored test_odcompare.py
* Change to dynamically compare py2 with py3 runtime during testing. Remove legacy_compare.
* Updated lots of ODs
* Improved profile loading
* Load profile from env var ODG_PROFILE_PATH and support multiple entries
* Fix import ordering (with isort)
* Added loading name, description and type from EDS
* Change profile default in Node to "None"
* Migrate to use pathlib.Path (more remains)
* Add '*' Mult to evaluate_node, which is used by certain profiles. Updated tests
* Cleanup nosis. Remove unused deepcopy
* Fix missing number (float) in JSON schema
* Minor cleanups
* Fix encoding issues for OD files with unicode
* Fix nosis quoting
* Simplify stream handling in nosis. Add support for bytestream
* Add --extra to pytest to test additional ODs
* Add test fixture `py2_pickle` to read the verbatim OD data from py2
* Minor fixes
* Rename `Node.string_format()` to `Node.eval_name()`
* Rename `Node.CompileValue` to `Node.eval_value()`
* Add more py syntax support in `Node.evaulate_expression`
*  Fix bugs in JSON OD
* Remove wheel as requirement for GH actions
* Move pytest and mypy config to pyproject.toml
* Remove flake8
* Add type hints
* Remove methods and merge functionality into existing
* Remove the unused "extra"and "family" feature
* Added typing support
* Nearly full typing coverage
* Refactored methods for cleaner types
* Node methods renamed, some deleted
* Many Node methods rewritten as a result of typing uncovering bugs
* NodeManager use .current as property to conditionally acces the current node
* Many superflous methods removed from NodeManager
* Add support for legacy gen_cfiles in Node
* Add to NodeProtocol
* Reduced min version to py 3.10
Copy link

codecov bot commented Apr 7, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

sveinse and others added 3 commits April 9, 2024 22:19
* Fix failure on reading the "need" field from node
* Increase the viewport size of the index parts in GUI
* Add error message if entering invalid data in GUI table editor
* Fix bug where UI changes in the table didn't update the data
* Added in-line documentation in ODStructTypes
* Fix incorrect ValueError when having arrays
* FIxed Node.DumpFile not guessing the filetype correctly
* Fix handling of DOMAIN, which address #10
Testing
* Add new "equiv_files" fixture to test equivalent files
* Add test for testing `odg compare`
* Added OD-file for DOMAIN and updated OD-files for consistency
@sveinse sveinse merged commit beef315 into main Apr 11, 2024
4 checks passed
@sveinse sveinse deleted the fix-typing-and-cleanups branch April 11, 2024 11:29
@paletteguy
Copy link

paletteguy commented Apr 13, 2024

Yocto receipe is failing....

ERROR: objdictgen-native-git-r0 do_compile: 'python3 setup.py bdist_wheel ' execution failed.

ERROR: objdictgen-native-git-r0 do_compile: ExecutionError('/srv/run/builds/plus-SP-7321-Not-able-to-record-session-on-Simcapture/build/tmp/work/x86_64-linux/objdictgen-native/git-r0/temp/run.do_compile.24175', 1, None, None)

ERROR: Logfile of failure stored in: /srv/run/builds/plus-SP-7321-Not-able-to-record-session-on-Simcapture/build/tmp/work/x86_64-linux/objdictgen-native/git-r0/temp/log.do_compile.24175

Log data follows:

| DEBUG: Executing shell function do_compile

| /srv/run/builds/plus-SP-7321-Not-able-to-record-session-on-Simcapture/build/tmp/work/x86_64-linux/objdictgen-native/git-r0/recipe-sysroot-native/usr/bin/python3-native/python3: can't open file '/srv/run/builds/plus-SP-7321-Not-able-to-record-session-on-Simcapture/build/tmp/work/x86_64-linux/objdictgen-native/git-r0/git/setup.py': [Errno 2] No such file or directory

| ERROR: 'python3 setup.py bdist_wheel ' execution failed.

| WARNING: exit code 1 from a shell command.

NOTE: recipe objdictgen-native-git-r0: task do_compile: Failed

ERROR: Task (virtual:native:/srv/run/builds/plus-SP-7321-Not-able-to-record-session-on-Simcapture/poky/../meta-simpad/recipes-packages/objdictgen/objdictgen_git.bb:do_compile) failed with exit code '1'

@sveinse
Copy link
Member Author

sveinse commented Apr 13, 2024

@paletteguy This is because the python build system has changed. It has replaced setup.py method to the new setup.cfg which is handled via pip.

PS! It seems you're tracking tip of main in the yocto build. That's cool for the latest and the greatest. main is development, but breakage like this might happen. For production use the latest release (e.g. from pypi) should be used.

PPS! For further discissions, please post a new issue, as this PR is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants