Skip to content
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

Python 3 #8

Open
MartinThoma opened this issue Jan 19, 2015 · 4 comments
Open

Python 3 #8

MartinThoma opened this issue Jan 19, 2015 · 4 comments

Comments

@MartinThoma
Copy link
Contributor

Currently, cheesecake is not Python 3 ready:

$ pylint --py3k cheesecake
************* Module cheesecake.cheesecake_index
W: 15, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 16, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 17, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 18, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 19, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 21, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 22, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 23, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 24, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 26, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 28, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 30, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 31, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 32, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 33, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 34, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 35, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 36, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 37, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 38, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 40, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 58, 4: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 71,55: basestring built-in referenced (basestring-builtin)
W:419, 0: Assigning to a class' __metaclass__ attribute (metaclass-assignment)
W:532,19: reduce built-in referenced (reduce-builtin)
E:564, 8: print statement used (print-statement)
W:573,30: division w/o __future__ statement (old-division)
E:574, 8: print statement used (print-statement)
E:576, 8: print statement used (print-statement)
E:581, 8: print statement used (print-statement)
E:582, 8: print statement used (print-statement)
W:693,28: basestring built-in referenced (basestring-builtin)
W:969,22: division w/o __future__ statement (old-division)
W:989,22: division w/o __future__ statement (old-division)
W:1057,22: division w/o __future__ statement (old-division)
W:1195,27: division w/o __future__ statement (old-division)
W:1229,12: import missing `from __future__ import absolute_import` (no-absolute-import)
W:1230,12: import missing `from __future__ import absolute_import` (no-absolute-import)
W:1594,12: import missing `from __future__ import absolute_import` (no-absolute-import)
W:1595,12: import missing `from __future__ import absolute_import` (no-absolute-import)
W:1596,12: import missing `from __future__ import absolute_import` (no-absolute-import)
W:1597,12: import missing `from __future__ import absolute_import` (no-absolute-import)
W:1613,12: map is used as implicitly evaluated call (implicit-map-evaluation)
W:1930,21: division w/o __future__ statement (old-division)
E:1939,12: print statement used (print-statement)
E:1943,12: print statement used (print-statement)
E:1944,12: print statement used (print-statement)
E:1945,12: print statement used (print-statement)
E:1947,12: print statement used (print-statement)
E:2060, 8: print statement used (print-statement)
E:2064, 8: print statement used (print-statement)
E:2083, 8: print statement used (print-statement)
************* Module cheesecake.ast_pp
W:  2, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:  3, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:332, 8: file built-in referenced (file-builtin)
E:334, 4: print statement used (print-statement)
E:335, 4: print statement used (print-statement)
************* Module cheesecake.model
W: 14, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 15, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 16, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 17, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 18, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 20, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 21, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 23, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
E:112,24: print statement used (print-statement)
E:122,20: print statement used (print-statement)
E:128,20: print statement used (print-statement)
E:133,12: print statement used (print-statement)
W:153,20: Calling a dict.iter*() method (dict-iter-method)
E:473, 8: print statement used (print-statement)
E:701, 8: print statement used (print-statement)
E:702, 8: print statement used (print-statement)
E:704,12: print statement used (print-statement)
************* Module cheesecake.pep8
W: 80, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 81, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 82, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 83, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 84, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 85, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 86, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 87, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 88, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:355,21: division w/o __future__ statement (old-division)
E:372, 4: print statement used (print-statement)
W:382,26: Calling a dict.iter*() method (dict-iter-method)
W:423,21: file built-in referenced (file-builtin)
E:511,12: print statement used (print-statement)
E:514,16: print statement used (print-statement)
E:683, 8: print statement used (print-statement)
E:690, 4: print statement used (print-statement)
E:695,12: print statement used (print-statement)
W:696,18: division w/o __future__ statement (old-division)
W:758, 8: import missing `from __future__ import absolute_import` (no-absolute-import)
************* Module cheesecake.util
W:  4, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:  5, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:  6, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:  7, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:  8, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:  9, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 10, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 11, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 12, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 14, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:128,29: basestring built-in referenced (basestring-builtin)
W:141,29: basestring built-in referenced (basestring-builtin)
W:235,18: xrange built-in referenced (xrange-builtin)
************* Module cheesecake.codeparser
W:  1, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:  2, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:  3, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:  5, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W:  6, 0: import missing `from __future__ import absolute_import` (no-absolute-import)


Report
======
2326 statements analysed.

Statistics by type
------------------

+---------+-------+-----------+-----------+------------+---------+
|type     |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module   |0      |0          |=          |0           |0        |
+---------+-------+-----------+-----------+------------+---------+
|class    |38     |38         |=          |NC          |NC       |
+---------+-------+-----------+-----------+------------+---------+
|method   |0      |0          |=          |0           |0        |
+---------+-------+-----------+-----------+------------+---------+
|function |0      |0          |=          |0           |0        |
+---------+-------+-----------+-----------+------------+---------+



External dependencies
---------------------
::

    cheesecake 
      \-ast_pp (cheesecake.model)
      \-pep8 (cheesecake.cheesecake_index)
    pylint 
      \-__pkginfo__ (cheesecake.cheesecake_index)



Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |2641   |65.63 |2641     |=          |
+----------+-------+------+---------+-----------+
|docstring |887    |22.04 |887      |=          |
+----------+-------+------+---------+-----------+
|comment   |173    |4.30  |173      |=          |
+----------+-------+------+---------+-----------+
|empty     |323    |8.03  |323      |=          |
+----------+-------+------+---------+-----------+



Duplication
-----------

+-------------------------+------+---------+-----------+
|                         |now   |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines      |0     |0        |=          |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |0.000    |=          |
+-------------------------+------+---------+-----------+



Messages by category
--------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |0      |0        |=          |
+-----------+-------+---------+-----------+
|refactor   |0      |0        |=          |
+-----------+-------+---------+-----------+
|warning    |83     |83       |=          |
+-----------+-------+---------+-----------+
|error      |29     |29       |=          |
+-----------+-------+---------+-----------+



% errors / warnings by module
-----------------------------

+----------------------------+------+--------+---------+-----------+
|module                      |error |warning |refactor |convention |
+============================+======+========+=========+===========+
|cheesecake.cheesecake_index |44.83 |46.99   |0.00     |0.00       |
+----------------------------+------+--------+---------+-----------+
|cheesecake.model            |27.59 |10.84   |0.00     |0.00       |
+----------------------------+------+--------+---------+-----------+
|cheesecake.pep8             |20.69 |16.87   |0.00     |0.00       |
+----------------------------+------+--------+---------+-----------+
|cheesecake.ast_pp           |6.90  |3.61    |0.00     |0.00       |
+----------------------------+------+--------+---------+-----------+
|cheesecake.util             |0.00  |15.66   |0.00     |0.00       |
+----------------------------+------+--------+---------+-----------+
|cheesecake.codeparser       |0.00  |6.02    |0.00     |0.00       |
+----------------------------+------+--------+---------+-----------+


Messages
--------

+------------------------+------------+
|message id              |occurrences |
+========================+============+
|no-absolute-import      |63          |
+------------------------+------------+
|print-statement         |29          |
+------------------------+------------+
|old-division            |8           |
+------------------------+------------+
|basestring-builtin      |4           |
+------------------------+------------+
|file-builtin            |2           |
+------------------------+------------+
|dict-iter-method        |2           |
+------------------------+------------+
|xrange-builtin          |1           |
+------------------------+------------+
|reduce-builtin          |1           |
+------------------------+------------+
|metaclass-assignment    |1           |
+------------------------+------------+
|implicit-map-evaluation |1           |
+------------------------+------------+



Global evaluation
-----------------
Your code has been rated at 9.02/10 (previous run: 9.02/10, +0.00)
@matthewdeanmartin
Copy link

matthewdeanmartin commented Feb 4, 2019

Ok, I just attempted to naively convert cheesecake to python 3, first using 2to3.

Cheesecake in ast_pp.py, model.py, codeparser.py has a dependency on the compiler module. That module re-implemented the cpython compiler in python and it was completely removed from python 3.

Furthermore, the code references the private module _subprocess, which appears to also be gone in python3. This looks like it can just be replaced with modern popen patterns.

setuptools has changed... and now my attention is wandering.

We might be better off just re-writing the 2000 lines of cheesecake_index.py by hand to support py3

@griggheo
Copy link
Owner

griggheo commented Feb 4, 2019

Agreed with rewriting. Although I have a feeling not a lot of people are even using this package. Are you using it on a regular basis @matthewdeanmartin ?

@matthewdeanmartin
Copy link

@griggheo I was, out of frustration with the large number of trash packages on pypi, writing a "package quality checker" of my own, cheese_grader. Along the way I stumbled on this library. I'm the build master where I work, so I check code we write within an inch of its life. But as soon as I import a 3rd party library, other than the "safety" check, it is like I'm assuming other people's code is perfect. All the code I support is py3 only, so I won't be able to use cheeseshop even though I'd want to.

@griggheo
Copy link
Owner

griggheo commented Feb 5, 2019

Got it. It looks like your cheese grader package is the way to go then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants