A Series of Unfortunate Events (Kind of)

Goose Chase

This week I went on a goose chase, a few of them if we’re being honest. Picking up from last week I continued to look into pylint for automating the testing process, as well as staying hopeful for a response from Gabriel regarding further suggestions. My goose chase began with me continuing to look into AST again, and the possibility of being able to get the sweet sweet . in the imports I so desired. This goose chase left me once again empty handed as I was still unable to find a solution.

Moving On

With this roadblock ahead I shifted my attention over to pylint and began experimenting with the implementation into my script only to be lead on another goose chase. One of the larger problems and complications of using pylint (or python for that matter) on Windows OS is the environment variables. pylint requires the use of custom plugins in order to run additional checkers, and said plugins are added by adding them to the PYTHONPATH environment variables. When a module does not exist in the environment variables this message is displayed.module

Needless to say, I saw a lot of this.

After sorting this out and having my custom plugin within my PYTHONPATH environment variable, I was ready to go. The link Gabriel gave me to look at was an excellent guide into creating a custom checker for pylint, however it too faced a large flaw. The example uses AST, which is something I am unable to use, this itself was not the problem, the way the imports are checked was. Essentially the checker function uses an AST node instance in order to check the imports, which is the only way to access the current file (as far as I am aware) in pylint.

Pylint Problems

With AST even further out of the question, I put all my belief in pylint, which was quick to disappoint. Pylint is run through the command line and takes the file to perform tests on as one of the parameters, which makes it impossible to get the current file within a checker (located in a separate file). With the inability to grab the current file, or read the current file, I can not even begin to test my script using pylint.

GitHub Guidance

Still awaiting my response from Gabriel, I reached out again to “nudge” him as to if he had seen my response.module

This was an answer I dreaded, but got nonetheless.

Where To Go From Here?

I was committed to bringing something to the table and finding some hope in this dying light, and after some digging I found it. It turns out I was looking in the wrong place, looking into pylint AST checkers, rather than raw checkers. These raw checkers gave me exactly what I needed, a way to access the current line, and parse imports. Using pylint loaded plugins and keras directories, I was able to test it with the following command:

​​​pylint keras/activations.py --load-plugins=absolute,relative

Where absolute and relative are my loaded plugins, running on one single keras file. For the time being I have not figured out how to disable all warnings except for mine, as the keras directory has a lot of pylint warnings and errors, but these are the results for activations.py

Screen Shot 2019-02-22 at 12.54.18 PM

The top 3 warnings indicated by the W are from my testers.

Closing thoughts

This was a long and windy road, but I believe I continued to make more progress. Continuing from here I will be shifting my focus to another issue until there is more feedback on this current one, and a stronger direction to go in. Pylint really kicked my butt this week, but I am glad I was able to learn it, lots of it, even parts I didn’t really need to. My next issue(s) have yet to be chosen, but will be from the keras project as I have enjoyed working in it so far.

Until next time…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s