mozilla-services / python-dockerflow

A Python package to implement tools and helpers for Mozilla Dockerflow
https://python-dockerflow.readthedocs.io
Mozilla Public License 2.0
38 stars 22 forks source link

Fix support of Python 3.8 #38

Closed leplatrem closed 5 years ago

leplatrem commented 5 years ago

The parent arguments do not really match what we have in stdlib

https://github.com/python/cpython/blob/v3.8.0/Lib/logging/__init__.py#L413-L421

https://github.com/python/cpython/blob/v3.8.0/Lib/logging/__init__.py#L555-L576

leplatrem commented 5 years ago

In case this helps, this is the stacktrace of python-dockerflow with Python 3.8:

/home/travis/build/Kinto/kinto/.tox/py38/lib/python3.8/site-packages/dockerflow/logging.py:82: in __init__
    parent_init(self, format, datefmt, style)
/opt/python/3.8.0/lib/python3.8/logging/__init__.py:576: in __init__
    self._style.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <logging.PercentStyle object at 0x7f99c30830a0>
    def validate(self):
        """Validate the input format, ensure it matches the correct style"""
>       if not self.validation_pattern.search(self._fmt):
E       TypeError: expected string or bytes-like object

The fmt parameter should be a string. Here, we don't use this style customization and can leave the default (None).

leplatrem commented 5 years ago

The TravisCI job did not apparently... https://travis-ci.org/mozilla-services/python-dockerflow/pull_requests

codecov-io commented 5 years ago

Codecov Report

Merging #38 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master     #38   +/-   ##
======================================
  Coverage    98.8%   98.8%           
======================================
  Files          19      19           
  Lines         585     585           
  Branches       79      79           
======================================
  Hits          578     578           
  Misses          6       6           
  Partials        1       1
Impacted Files Coverage Δ
src/dockerflow/logging.py 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 74765c5...9a77a36. Read the comment docs.

leplatrem commented 5 years ago

Apparently uvloop does not like Python 3.8

   #define CO_OPTIMIZED    0x0001
                           ^
  uvloop/loop.c:334:37: note: in definition of macro ‘__Pyx_PyCode_New’
             PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
                                       ^
  uvloop/loop.c:154727:63: note: in expansion of macro ‘CO_OPTIMIZED’
     __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_uvloop_loop_pyx, __pyx_n_s_callback, 850, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(2, 850, __pyx_L1_error)
                                                                 ^
  In file included from /opt/python/3.8.0/include/python3.8/compile.h:5:0,
                   from /opt/python/3.8.0/include/python3.8/Python.h:138,
                   from uvloop/loop.c:20:
  /opt/python/3.8.0/include/python3.8/code.h:122:28: note: expected ‘PyObject * {aka struct _object *}’ but argument is of type ‘int’
   PyAPI_FUNC(PyCodeObject *) PyCode_New(
diox commented 5 years ago

Looks like https://github.com/MagicStack/uvloop/issues/277#issuecomment-545730455

jezdez commented 5 years ago

Closing in favor #39.

jezdez commented 5 years ago

dockerflow 2019.10.0 is out!