-
Notifications
You must be signed in to change notification settings - Fork 7
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
First cut #1
Comments
Turns out that bind9_parser was not packagable. Just made it packagble and provided a Was in the JetBrain PyCharm IDE for so long (doing unit tests from within there) that I had forgotten about the packagability of this. Now in latest master branch. |
I recently struggled with this too, with the new restructuring of pyparsing into folders and modules. Did you test out your package using the test pypi? I still need to do that - I won't really be sure I've got all the pieces in place until I can pip install from there. |
Pip is next on my list. I’m learning the entire pip ecosystem |
Done.
|
Seems like I broke something at a PyPi-level... but this
EDITED: pip v18.1 was obsoleted for this reason. Upgraded to v19.3.1. It's all good. |
There are some online instructions at the Python docs on how to use PyPi, including how to twine upload to a test site instead of the live site. |
Turns out that I'm running an old Debian 'python[3]-pip' v18.1 package (on Debian Buster 9 distro). Fixed it using this-link to bring it up to at least pip v19.3.1 python3 -m pip install --upgrade --force pip && python3 -m pip install --force requests urllib3 distro
apt remove python-pip python3-pip It works now. |
Didn't have to use the test.pypi.org.... https://test.pypi.org/project/bind9-parser/ Only thing left to do is Tox/coverity, et. al. |
Tox/coverity happens when I take this project out of private mdoe. Major changes to all We can now execute those tests/test_*.py directly from PyCharm with no related project configuration settings. I can also execute those test scripts directly from command line as well (after package install) I cannot make it work with |
Sorry not to respond earlier - I got wiped out this week with something very flu-like, despite getting a flu shot just a few weeks ago. This is a huge project of yours, and I'll try to give some feedback over the holiday weekend. |
Some notes: exclamation = Char('!')The purpose of Char is to simplify parse_meSeems to be a reinvention of CaselessLiteralShould probably be
so there is no need to do extra Parse actionsAn quick and easy debugger is to use pyparsing's Also, defensive coding like Example:
Module formatsA number of modules include internal unit-style tests, with find_pattern and parse_me testing methods. Move all of this test code to the bottom of each module in a "if name == 'main':" section, so that the module can be imported as a library module without actually running all the tests. This will also help clarify how much in each module is actual parser content vs. testing. It also feels like you have too many modules, but I am often accused of writing modules that are too big. But an entire module for a single isc_boolean expression seems a bit much. Reformatting isc_boolean:
Anyway, the way your parser is broken up, it is very difficult to see the big picture. Perhaps an overall BNF? |
One topic/comment at a time. BNF? Overall BNF? For the entirety of ISC Bind9 configuration file? I've extracted it from multiple versions of ISC Bind manuals and re-edited/finalized it from their source code; they were horribly documented (has at least 100+ errors in latest 9.15.1, and sometime do not even reflect its code). If and when I do reconstruct the correct BNF (and often do so), I put them before each function as a comment block. Perhaps, I should complete this step to 100%. Might be useful (to folks unlike me). But is it relevant to me at this point and stage? To me; Less so now, than before. To others, probably more so. |
Parser is broken up. It sure is. Yes. And the "parser appears broken up" is a product of individual SCRUM/AGILE approach. Small pieces at a time; small BNF syntax at a time; make it work firstly and solidly. And build my way upward carefully without breakage. Run unit tests repeatedly to ensure no breakage (PyCharm does this automatically auto-unittest after major code changes). Individual test cases solidify each parser. It is important to note that all parsers were done BEFORE the Often times the Bind9 'clause' can be included inside another clause(s); statement be inside another statement(s); syntax be inside another syntax(es). It didn't make sense (after a deep code review) to have duplication of parsers because it's neatly 'nested'. The way things are broken up is simply as:
The above terms are what a typical ISC Bind9 engineer would understand. As for trouble shooting, yes, big picture is not solid but I am quite positive that I got those clauses down 100%. It is the mixture of clauses that I am struggling at the moment:
PyParsing, as I've programmed with, can only take the same clause as a contiguous group of clause and not interleaved (or spread across or stand apart) between other clauses. I am making effort to reframe the terms so that a PyParsing engineer can solve it and it's not perfect either. |
Module formats;If I understood you correctly, you want to relocate those If that is so ...why introduce more Python bytecodes to add into your Python library by the mere act of merging the unit test files into their respective module source file? I like my Python library lean and light. It's bad enough when a Python script takes up to 2.5 GB of memory space. Is that it? (PS: isc_boolean_logic was the first module I wrote, I could fold that into the generic |
Parse_MeI'm making that go away... |
@ptmcg
Here's the first cut, complete with the most comprehensive test cases I've got (because I absolutely needed it to ensure nothing got broken during development).
I use the JetBrain PyCharm IDE so the (
.idea
hidden dotfile should be there).Enjoy.
Steve
The text was updated successfully, but these errors were encountered: