barefoot icon indicating copy to clipboard operation
barefoot copied to clipboard

Python map import scripts refactor

Open Conengmo opened this issue 6 years ago • 8 comments

Hi guys,

I'm working on figuring out how Barefoot really works underneath. While I was looking through the Python scripts that import map data, I figured they could use some work. I wanted to show my work in progress to maybe get some comments if and how this could be merged in main stream Barefoot when finished.

What I'm working on:

  • Mainly making it DRY
  • Making it Python 3 compatible
  • Improve readability
  • Keep functionality the same

I know this will be hard to review because the changes are so large. But know that I'm not changing functionality in this PR.

Conengmo avatar Jul 01 '18 06:07 Conengmo

I touched all the Python code and finished a first refactoring. It can be better, but it is functional now.

Conengmo avatar Jul 02 '18 07:07 Conengmo

Thanks for refactoring and the PR!

@jongiddy Would you mind having a look on the changes? You're much better in Python than me. I have looked through it, e.g., if conditions, test execution, etc., and it seems all okay (not bypassing any test) and the CI system checked it with perfect results, i.e., also the result of the sample data looks the same as before.

@Conengmo Have you used some code style configuration? If so, could you include that in the repo in order to have the same style with future edits? Further, is the PR still WIP?

smattheis avatar Jul 04 '18 16:07 smattheis

Good to hear you want to consider this PR. I follow regular PEP8, the default style guide for Python:

https://www.python.org/dev/peps/pep-0008/

Is there a line width you want to stick to in this project? I tried to keep most at 80 characters, but allowed for lines to go to 100 characters. Personally I like 100.

If you want to consider merging this, I'll take this weekend to polish it a bit more before dropping the WIP. Let me know if you have any comments or requests!

Conengmo avatar Jul 04 '18 18:07 Conengmo

In the Java code style, we use a line width of 100 characters. PEP8 is perfect and can be integrated into the Travis CI configuration. Thanks!

smattheis avatar Jul 04 '18 19:07 smattheis

Does Travis also do code style reviews? Another project I work on uses Travis for testing and Stickler for automated code style review:

https://stickler-ci.com/

Conengmo avatar Jul 05 '18 07:07 Conengmo

Alright I finished cleaning up. The Travis test passed, so that's nice. I hope you guys like it, let me know if you have any further requests or suggestions.

Conengmo avatar Jul 08 '18 10:07 Conengmo

Glad you like it. I agree on adding more tests, and also a good idea to add a pep8 check to Travis. But that's something for a new PR I reckon. I'll leave this PR as is so it won't have to be reviewed again.

Conengmo avatar Aug 01 '18 09:08 Conengmo

So since it's approved and everyone's happy. Can this be merged?

thomhubers avatar Aug 20 '19 16:08 thomhubers