Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ian Lee
    @IanLee1521
    Great, thanks @leorochael ! I should be able to take a look this weekend
    Leonardo Rochael Almeida
    @leorochael
    Hi @sigmavirus24, I'm here if you want to discuss the PR I sent. I'll reply to the question you just posed on the PR now.
    Leonardo Rochael Almeida
    @leorochael
    done
    yanggh
    @yanggh
    hi
    Ian Lee
    @IanLee1521
    hi @yanggh , welcome!
    Richard Lewis
    @richrd
    Hey all! Sorry to bother you guys, but is there any info about when the next version will be released?
    Ian Lee
    @IanLee1521
    Hi @richrd ! Welcome!
    I’m hoping to get this built and released by the end of next week. One of the last remaining tasks has been done, now I just need to review the entire diff from the 2.0.0 release and usually that just involves updating the changelog
    Varun Agrawal
    @varunagrawal
    Hi. Is there a room for pydocstyle?
    Amir Rachum
    @Nurdok
    Varun Agrawal
    @varunagrawal
    Thanks Amir
    AJ Catambay
    @adrianjayson

    Hello pycodestyle developers,

    AJ here, been using pycodestyle for a month now in refactoring the code and removing some code smells and fixing a few bugs of an existing python project assigned to me, as a newbie in python, I found your tool really handy and helpful, and it's a good thing you made a tool like this. Just wanna send my compliments :+1:

    also forked it, coz I wanna check out the code, I hope you welcome contributors. :)
    Ian Lee
    @IanLee1521
    @adrianjayson :+1: Definitely, sometimes life keeps me busier than I'd like and can be a bit slow to respond, but contributions are certainly welcome. :)
    KM4YRI
    @KM4YRI
    Hi, is this chat group still active? Last reply was October 2016 from what it's showing me. I've got a question if anyone's out there.
    John Vandenberg
    @jayvdb
    Ask.. ;)
    KM4YRI
    @KM4YRI
    OK, here goes. Is there any reason why the pycodestyle API can't easily be invoked directly from Python? It's primary purpose seems to be to run it from the commandline, but that's not exactly pythonic. There are use cases where this would be useful (e.g. PyQt5 based python code editors like Mu), and it just seems like sloppy code. This makes it difficult (although not impossible when using workarounds like rerouting stdout stacked on top of other workarounds like regexes to reconstruct the line, column, error code, and messages) to get line-by-line output of each style error found, from within a python script. The whole thing feels like a hack. I can't tell if this is deliberate or intentional. I'd make a fork and submit a pull request but I see 27 other pull requests going back to 2013, so I don't want to waste that time if it's not in line with whatever vision PYCQA is currently running with. I also see open issues going back to 2013 without a single comment, so should I even waste my time trying to file an issue and submit a pull request, just to be ignored?
    John Vandenberg
    @jayvdb
    im pretty sure pycodestyle does have a usable API, but iirc you need to instatiate a few classes so it isnt the simplest of APIs. Checkout the flake8 codebase as it invokes pycodestyle via the API. @KM4YRI If you want a different api, mention your desired API here, or in an issue and drop a link here, and we can get some discussion happening.
    KM4YRI
    @KM4YRI
    @jayvdb while there's an API, it requires a set of workarounds in the scenario where a list of errors is desired, including the line, column, error code, and message (so, in other words, more details than just statistics). Invoking pycodestyle.Checker(path, options) and then calling check_all(), the list of errors are only output to stdout via print() functions. So the only way to capture this data from the API is to reroute stdout to a StringIO object, capture it, and then fix the stdout. That gives a string that then has to be parsed using a regex, e.g.: r'.:(?P<line>\d+):(?P<col>\d+):\s+(?P<code>[A-Z][0-9]{3,4})\s+(?P<msg>.)' ... What I'd like to see (and I'd probably be able to file a pull request if it would be accepted), is an API call that could return some object structure, e.g. a list of dict, with that information, to get around the stdout rerouting and parsing. Also, it would be nice to be able to pass the checker a regular string object rather than a filename.
    KM4YRI
    @KM4YRI
    @jayvdb https://github.com/PyCQA/pycodestyle/blob/master/pycodestyle.py#L2056 is the print() line, and at no point are those statistics for the tokens added to the report. One proposed solution would be a boolean flag in the Checker constructor, that, if present, would append a dict or namedtuple consisting of line, column, error code, and message to the report.
    John Vandenberg
    @jayvdb
    That is only very verbose mode, which you would want to avoid when using it as an API.
    You need to
    initialise Checker with report such that self.report.get_file_results() gives you the information you want
    The filename thing is a bit different. You can give Checker lines for the file contents. filename is iirc because the output wants to print the filename of that set of
    lines
    John Vandenberg
    @jayvdb
    I am fairly confident filename can be 'anything' you want when you supply lines
    KM4YRI
    @KM4YRI
    @jayvdb why would I want to avoid that when using it as an api? I DO want to get that information from the API. What reason would make me want to avoid it?
    John Vandenberg
    @jayvdb
    Because very verbose mode uses print. You want to control the user experience so you do not want very verbose mode
    Is very verbose mode enabled by default with api usage? If so that might be something to fix to avoid confusion
    A better default for report may also help
    KM4YRI
    @KM4YRI
    What I'm asking for doesn't really have anything to do with how verbose the stdout is. What I'm asking for is that (with some boolean flag from the constructor), the information collected about each violation (line, column, error code, and message) be stored in some structure (list of namedtuple, for example) is stored in a property, so that I can read that property to get that complete list, without having to resort to regexes and stdout rerouting. And that should be available regardless of the verboseness of the stdout data. I want the actual data collected.
    As far as the defaults go, that's actually another workaround because the options are all specified as optparse options, which only make sense if pycodestyle is being run as a commandline application. That makes using it as an api ('import pycodestyle' within another application) much more difficult. That's kind of my point is that while pycodestyle works great as a commandline application, it's not well suited at all when imported into another application.
    John Vandenberg
    @jayvdb
    check_all does give the report object the structured dataset you seek
    Im not saying pycodestyle is ideal, but before designing improvements it is useful that you see how it currently does provide the data that you expect
    KM4YRI
    @KM4YRI
    Can you provide example code that shows how to get the data set? It's definitely not in the docs and I don't see any obvious part of the code that would provide it.
    KM4YRI
    @KM4YRI
    @jayvdb Can you provide example code that shows how to get the data set? It's definitely not in the docs and I don't see any obvious part of the code that would provide it.
    John Vandenberg
    @jayvdb
    best i can quickly suggest is to look at how flake8 does it.
    KM4YRI
    @KM4YRI
    @jayvdb Flake8 hasn't delegated style checking to pycodestyle since version 2.6 (over 2 years ago). Look at the source code if you don't believe me, it's a dependency but it doesn't even get imported in the code. I'd make a guess that it was too damn hard to interface for the same reasons that I've mentioned, but their bug tracker doesn't go back that far so I don't know the real reason why. If you happen to look back at their 2.6 code to see how they interfaced it with pycodestyle before they ditched it: They used the SAME workaround(s) that I mentioned. See for yourself here: https://github.com/PyCQA/flake8/blob/stable/2.6/flake8/reporter.py -- So my initial question is still valid. Here's where we're at: 1) pycodestyle has no documentation alluding to a native interface, 2) pycodestyle can only be used natively with a bodgy set of undocumented workarounds, 3) flake8 doesn't use pycodestyle any more for probably those reasons, 4) All of this has been pointed out but I've yet to see an ackowledgement about any of it, 5) I'm offering to submit a pull request to fix it but I won't until I can at least have someone on the project acknowledge as to whether they'd accept it if I did.
    I mean, flake8 doesn't have a native API either but at least they're acknowledging that and have plans to add it at some point: http://flake8.pycqa.org/en/latest/user/python-api.html#public-python-api
    John Vandenberg
    @jayvdb
    BaseReport.error is what pycodestyle will invoke for each result it finds
    flake8 2.x uses the private _deferred_results instead, for better performance especially as it distributes the work over multiple processes running pycodestyle concurrently
    John Vandenberg
    @jayvdb
    I dont know internals of flake8 3.x , so i can comment on that easily. But i understand one of the goals of flake8 3 was to avoid being so closely coupled to pycodestyle.
    Carl Crowder
    @carlio
    hey all, just wondering if this is the defacto PyCQA chat method; I found an issue on the meta repo about irc but can't find any irc server/channel info
    nvm found it
    Tomer Keren
    @Tadaboody
    Hey - is there a way to mark certain tests as ignored for certain python implementations?
    I’m asking because PyCQA/pycodestyle#809 addresses typing annotations which were introduced in python 3.5, so I don’t know how to make py2 tests pass
    Gabriel
    @gpotter2

    Hi ! Quick note: pycodestyle conflicts with pylint on F821 when using external classes in a docstring such as:

    def a_scapy_function(self, payload):
        # type: (str) -> base_classes.Packet_metaclass
        return from_another_function()
        # (note we have never imported base_classes in this file)

    ==> since (latest?) version, pycodestyle (flake8) will require base_classes to be imported, whereas pylint will report an "unused import"

    Which one is correct ? (to which tracker should I post a bug ^^)

    Gabriel
    @gpotter2
    Hum, guess I’ll have more chance on github ^^
    Keshav Garg
    @KVGarg
    hey all, I was looking forward to create a converter from JSON to other output formats like JUnit XML, checkstyle, TAP and clover. These JSON results are nothing but coala results. I will be creating this tool as part of my GSoC'19 project. So can anyone help me how will my work will be meaningful to this community ? Also, suggestions are welcome regarding any other format support or related to some topic. :innocent: