Closed w0rp closed 2 years ago
I'd also be very happy to see this implemented.
I think this is a reasonable request. I've done this in various other tools. For example, see:
Implemented it. See the PR.
@myint Steven, hi. What happened finally to this feature? I'd be very happy to use it on a SublimeText plugin but i don't see it living on the latest autoflake 1.2
after doing pip install --upgrade autoflake
.
Autoflake is an awesome tool and reading from stdin is supported by many python linters out there, so it'd be great to have it as well here.
For example, autopep8... test it on windows is as easy as just doing echo a=1+2 | autopep8 --ignore=IGNORE -
.
Please let me know. Tyvm
Is this repo still alive? Here's a little example how to achieve the task:
@brupelo Please see https://github.com/myint/autoflake/pull/37#discussion_r184868642.
Almost all python linters out there support this and if -
conflicts with another option the right call is just warning about it (see for instance how isort does it as an example), not having this standard common operation on autoflake doesn't make sense. A linter tool should be a tool to be used not only on the command line but also should allow to interact with the IDE itself.
I'm not arguing against the -
feature. š
Merely doing it in the right way, which I specified in the pull request. I would do it myself if I wasn't doing 12 hour days at work.
Any news?
If there was news, you'd see a comment here. ;)
@myint hi there! If I were to take on this change, would you accept a patch? I can build on #37 or start from scratch, whatever works better (haven't investigated what will be simpler yet).
@fsouza Hi, why you PR was declined?
@fsouza Hi, why you PR was declined?
Oh, this was from before the repo was moved to pycqa and I thought it was kind of abandoned. It wasn't declined, I just closed it. Happy to reopen it if the repo is active again.
Looks like it is abandoned indeed, which is unfortunate :(
With the move to PyCQA maybe it'll be picked up again? I did fork it here and have some plans for it, but if pycqa will move it forward I'm happy to abandon autoflake8 and focus on the work here.
@fsouza Would you be interested in becoming a maintainer of this repository?
@fsouza Would you be interested in becoming a maintainer of this repository?
Hey @myint, thank you very much for creating autoflake and apologies for the delayed response, I was on paternity leave and very slow to respond. Do you have details on what maintaining it would entail? (something along the lines of reviewing PRs, triaging issues, creating new releases? Anything else?) Are there other maintainers? Like, would there be someone to review my PRs too? š
Maintaining would entail reviewing, triaging, and creating releases as you suggest. There are currently no other maintainers, but ideally there would be.
I just took a look at https://github.com/fsouza/autoflake8, and one slightly worrying thing I notice is there is over ten dependencies in the fork whereas autoflake
in this repository only depends on pyflakes
. I try to keep dependencies minimal in autoflake
.
Users of autoflake8 still only have 1 dependency (pyflakes). The other dependencies are used only to develop autoflake8. It's basically pytest and aiofiles, and both are used for running tests/in tests.
That being said, I don't think we need to bring autoflake8 as is. We can keep the current approach and port the improvements without necessarily pushing it to poetry, changing how the code is organized or how tests are executed.
I see. That sounds reasonable then. Welcome aboard!
Sounds good! I'll reopen my PR adding stdin and stdout, and if CI is happy I'll merge it! I'll also move CI to GH Actions.
Currently
autoflake
reads from a file by taking a filename, and outputs a diff with a patch to make. This works well for some command line usage, but doesn't integrate so well with replacing a buffer in Vim. This could be improved by offering an option to read the file from stdin, and an option for outputting the entire file contents, with the patch applied, to stdout. stdin support could either by via flag, or by reading a special filename-
. Supposing there was a flag for stdout support, thenautoflake
could automatically remove unused imports in Vim with both flags like so.That command would take the contents of the current buffer, pass it to
autoflake
via stdin, get the new file after applying the patch back out again, and replace the current buffer with that text.At the moment, I shall have to save my current buffer to a file, run
autoflake
on that temporary file and save the diff to another temporary file, and then use the:diffpatch
command to apply the patch to the current buffer, in order to integrateautoflake
with Vim.