Merge lp:~hawkowl/twistedchecker/add-setup-1084552 into lp:~twisted-dev/twistedchecker/trunk

Proposed by HawkOwl
Status: Merged
Merged at revision: 30
Proposed branch: lp:~hawkowl/twistedchecker/add-setup-1084552
Merge into: lp:~twisted-dev/twistedchecker/trunk
Diff against target: 93 lines (+62/-17)
3 files modified
README (+0/-17)
README.rst (+19/-0)
setup.py (+43/-0)
To merge this branch: bzr merge lp:~hawkowl/twistedchecker/add-setup-1084552
Reviewer Review Type Date Requested Status
Richard Wall (community) Approve
Twisted-dev Pending
Review via email: mp+183223@code.launchpad.net

Description of the change

Including a setup.py, allowing TwistedChecker to be installed system-wide.

To post a comment you must log in.
Revision history for this message
Richard Wall (richardw) wrote :
Download full text (3.5 KiB)

Thanks hawkowl,

This looks good. I'm looking forward to being able to install from
Pypi.

Here are a few notes:
 1. Add a newline at end of file. "\ No newline at end of file"

 2. description

    1. I think the term "code standard" in the descriptions sounds
       unfamiliar. I think it's commonly called "coding standard".

    2. Add a link to the coding standard document.

 3. python setup.py --requires gives no output although I can see
    that you've specified install_requires. Not sure why or if
    it's important. The Twisted one doesn't either.

 4. I'd guess that install_requirements might mean packages that
    are needed to compile the package while requirements are
    run-time requirements.

    1. I've seen most other python packages have a requirements.txt
       file - should we do that here.

 5. I like the way klein and treq have organised their setup.py - they
    haven't bothered with a main function and they read the content of
    the README as the long description. I'd be inclined to follow
    their style.
    1. https://github.com/dreid/treq/blob/master/setup.py

 6. The classifiers don't mention any python versions. They should
    probably be the same as Twisted itself.

 7. No keywords - might be nice to add a few.

 8. I get config parsing error unless I'm running it from the
    twistedchecker working directory
    {{{
    (twistedchecker)[richard@zorin ~]$ twistedchecker --help
    No config file found, using default configuration
    Traceback (most recent call last):
      File "/home/richard/.virtualenvs/twistedchecker/bin/twistedchecker", line 10, in <module>
        Runner().run(sys.argv[1:])
      File "/home/richard/.virtualenvs/twistedchecker/lib/python2.7/site-packages/twistedchecker/core/runner.py", line 57, in __init__
        .cfgfile_parser.get("TWISTEDCHECKER", "disable")
      File "/usr/lib64/python2.7/ConfigParser.py", line 607, in get
        raise NoSectionError(section)
    ConfigParser.NoSectionError: No section: 'TWISTEDCHECKER'
    }}}

    1. Is that because setup.py should generate the default configuration?

    2. Also sounds like this bug which you though would be fixed by
       setup.py https://bugs.launchpad.net/twistedchecker/+bug/1096562

I think the goal of this branch should be to allow us to publish the
to Pypi and be able to install from Pypi using pip.

Please address or answer the numbered points above and resubmit for
review.

Thanks again. -RichardW.

PS Here are my suggested changes to the description

=== modified file 'setup.py'
--- setup.py 2013-08-30 15:42:55 +0000
+++ setup.py 2013-09-01 20:15:19 +0000
@@ -52,12 +52,11 @@
             "pylint==0.26.0",
             "pep8==1.3.3"
             ],
- description='A code standards checker for Twisted.',
+ description='A Twisted coding standard compliance checker.',
         long_description="""\
-TwistedChecker is a code standards checker, originally designed for the use of
-the Twisted project. It tests Python code for problems such as PEP8 compliance,
-docstrings, trailing spaces and strange variable naming.
-""",
+TwistedChecker checks Python code for compliance with the Twisted coding standa...

Read more...

review: Needs Resubmitting (code review)
Revision history for this message
Richard Wall (richardw) wrote :

I tried installing it with Python3 and it doesn't work. So the new setup.py should certainly specify only compatible with Python2.6. and 2.7

I filed a bug report:
 * https://bugs.launchpad.net/twistedchecker/+bug/1219563

33. By HawkOwl

Updated setup.py according to review, changed it to use README.rst instead

Revision history for this message
HawkOwl (hawkowl) wrote :

Hi Richard,

Thanks for the review.

1. Fixed!
2. I changed it to use an external README for the long description, and put in a link to the standards document as suggested.
3. --provides doesn't work either. I think it's just broken, tbh, since install_requires is what I see everywhere.
4. See above - but I don't think that the requirements.txt is needed, since it's meant to be installed rather than ran in place.
5. Agreed, I've ditched the main() and neatened everything up. Also reorganised it so it flows a bit better, if you're reading it manually.
6. Agreed, added 2.6 and 2.7 - I don't think there's anything that would make it incompatible with 2.6.
7. Added a few, but I'm mostly making them up off the top of my head :)
8. That's the problem, yeah. I've switched it to use package_data, which should fix it, and it works here.

Agreed, I think with this one, we should be able to get it onto PyPI and usable.

I also incorporated your description suggestion in the README.rst.

I'll also have a look at py3 compat later - I set 2.6 and 2.7 in the setup(), so it shouldn't be a problem right now.

I've pushed up some revisions to address the above, too.

- hawkie

Revision history for this message
Richard Wall (richardw) wrote :

Thanks! Those changes look great and twistedchecker now seems to work from any cwd.

One thing - I tried running the unittests but didn't have twisted + trial installed in the virtualenv. I wonder why trial is required for the tests (instead of stdlib unittest). And if it is required I wondered if there's a way to specify test dependencies.
Anyway, that's a separate issue.

Merge (more importantly upload) away....if you can.

-RichardW.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'README'
2--- README 2012-07-10 00:30:55 +0000
3+++ README 1970-01-01 00:00:00 +0000
4@@ -1,17 +0,0 @@
5-Twisted Coding Standard Checker
6-
7-This is a project of Google Summer of Code 2012.
8-
9-
10-Dependencies
11-==========
12-
13- To run twistedchecker, it requires pylint 0.25.1 and pep8.py (>=1.0.0).
14-
15-Unit Tests
16-==========
17-
18-
19- To test twistedchecker, run:
20-
21- % trial twistedchecker
22
23=== added file 'README.rst'
24--- README.rst 1970-01-01 00:00:00 +0000
25+++ README.rst 2013-09-01 21:48:15 +0000
26@@ -0,0 +1,19 @@
27+Twisted Coding Standard Checker
28+===============================
29+
30+TwistedChecker checks Python code for compliance with the `Twisted coding
31+standard <https://twistedmatrix.com/documents/current/core/development/policy/coding-standard.html>`.
32+
33+This was originally a project of Google Summer of Code 2012.
34+
35+Dependencies
36+------------
37+
38+TwistedChecker's dependencies are pylint (== 0.26.0) and a recent version of PEP8.
39+
40+Tests
41+-----
42+
43+To test twistedchecker, run the following in the source directory::
44+
45+ trial twistedchecker
46
47=== added file 'setup.py'
48--- setup.py 1970-01-01 00:00:00 +0000
49+++ setup.py 2013-09-01 21:48:15 +0000
50@@ -0,0 +1,43 @@
51+#!/usr/bin/env python
52+
53+# Copyright (c) Twisted Matrix Laboratories.
54+# See LICENSE for details.
55+
56+from setuptools import find_packages, setup
57+
58+
59+setup(
60+ name='TwistedChecker',
61+ description='A Twisted coding standard compliance checker.',
62+ version='0.1.0',
63+ author='Twisted Matrix Laboratories',
64+ author_email='twisted-python@twistedmatrix.com',
65+ url='https://launchpad.net/twistedchecker',
66+ packages=find_packages(),
67+ package_data={
68+ "twistedchecker": ["configuration/pylintrc"]
69+ },
70+ scripts=[
71+ 'bin/twistedchecker'
72+ ],
73+ license='MIT',
74+ classifiers=[
75+ "Development Status :: 3 - Alpha",
76+ "Environment :: Console",
77+ "Intended Audience :: Developers",
78+ "License :: OSI Approved :: MIT License",
79+ "Programming Language :: Python",
80+ "Programming Language :: Python :: 2",
81+ "Programming Language :: Python :: 2.6",
82+ "Programming Language :: Python :: 2.7",
83+ "Topic :: Software Development :: Quality Assurance"
84+ ],
85+ keywords=[
86+ "twisted", "checker", "compliance", "pep8"
87+ ],
88+ install_requires=[
89+ "pylint == 0.26.0",
90+ "pep8"
91+ ],
92+ long_description=file('README.rst').read()
93+ )

Subscribers

People subscribed via source and target branches

to all changes: