netdevops / hier_config

Hierarchical Configuration
MIT License
126 stars 24 forks source link

support 2.7 as well #11

Closed itdependsnetworks closed 6 years ago

jtdub commented 6 years ago

Hey @itdependsnetworks - I'm going to discuss this with the team. Our current tooling is ~python 3.6 only. There is a possibility that we will be implementing python 3+ code objects, such as type hinting (https://www.python.org/dev/peps/pep-0484/).

itdependsnetworks commented 6 years ago

@aedwardstx thanks! I did not mean to do that.

@jtdub I believe there is a (sub-optimal) way to accommodate both, and while it would be great if everything was 3.X in the world, we are where we are. IMHO this would broaden the scope of the project.

jtdub commented 6 years ago

Update: The latest push fixed the test error.

Just checked Travis, the unittests failed, but it's not reporting properly:

$ python ./tests/tests.py
.......................F..............................
======================================================================
FAIL: test_dump_and_load_from_dump_and_compare (test_hier_config.TestHConfig)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/netdevops/hier_config/tests/test_hier_config.py", line 90, in test_dump_and_load_from_dump_and_compare
    self.assertEqual(hier_pre_dump, hier_post_dump)
AssertionError: <instance object at 0x7f7605bb1908> != <instance object at 0x7f7605bb1b48>
----------------------------------------------------------------------
Ran 54 tests in 0.038s
FAILED (failures=1)

I'll look into that failure to catch the failure when I get a chance.

itdependsnetworks commented 6 years ago

Yay!! @jmcgill298

aedwardstx commented 6 years ago

I would like to implement Type Hints at some point. Doing so does not seem compatible with Python2.7. I don't suppose its possible for the customer's application to be upgraded to Python3? :-) If we do add Python2.7 support, I think we should restrict it to 2.7 and 3.6 to make it more practical to deprecate Python2.7 at some point to support Type Hints.

jmcgill298 commented 6 years ago

Have you tried using comment-based syntax? http://mypy.readthedocs.io/en/latest/python2.html

aedwardstx commented 6 years ago

I'm good with supporting Python2.7. Comment based syntax is an option but it wouldn't allow for using packages like https://github.com/RussBaz/enforce. Once Python2.7 is retired, I vote we deprecate support for it https://pythonclock.org/.

Another option to consider: We've realized that once you're building remediations for hundreds or thousands of devices at a time and have pretty complex remediation fix up functions, it becomes handy to front the remediation build logic with an API or worker queue model. This has the added benefit of allowing HConfig to run in another runtime.

jtdub commented 6 years ago

Can you increment hier_config.__version__ to 1.2.0?

aedwardstx commented 6 years ago

Looks like this needs to be rebased before merging.