Giter Club home page Giter Club logo

Comments (8)

joeyagreco avatar joeyagreco commented on August 16, 2024 1

In version 2.1.1, I'm seeing that [autoflake] works, but [tool.autoflake] does not for a pyproject.toml file.

This is in direct contradiction to the PyPi docs

from autoflake.

fsouza avatar fsouza commented on August 16, 2024 1

@joeyagreco ahh ok, yes --config doesn't support pyproject.toml at the moment. It's being parsed as an ini file, and toml just happens to be compatible with that.

from autoflake.

fsouza avatar fsouza commented on August 16, 2024

Hi @kevinr-electric, thanks for reporting. I'm going to revert that change and then we can have a separate flag that's exclusive for the location of pyproject.toml.

Currently, autoflake doesn't keep a changelog in a dedicated location. We can introduce something with GitHub releases though.

from autoflake.

kevinr-electric avatar kevinr-electric commented on August 16, 2024

Hey @fsouza, thanks for the update. A releases section with release notes would also be appreciated!

from autoflake.

bricker avatar bricker commented on August 16, 2024

I'm confused here; Passing a toml file to --config was completely broken before (that was the whole point of this PR). How were you doing that?

from autoflake.

fsouza avatar fsouza commented on August 16, 2024

@joeyagreco can you share an example? I can't repro it:

% cat pyproject.toml
[project]
name = "sample"
description = "Just a sample"
license = { text = "ISC" }

[tool.autoflake]
expand-star-imports = true
% cat sample.py
import os
from sys import *

print("hi", file=stderr)
% autoflake sample.py
--- original/sample.py
+++ fixed/sample.py
@@ -1,4 +1,3 @@
-import os
-from sys import *
+from sys import stderr

 print("hi", file=stderr)
% autoflake --version
autoflake 2.1.1

from autoflake.

joeyagreco avatar joeyagreco commented on August 16, 2024

Sure! @fsouza

Here's my pyproject.toml file

[autoflake]
ignore_init_module_imports = true
in_place = true
recursive = true
remove_all_unused_imports = true

Check version

% autoflake --version
> autoflake 2.1.1

Run it

% autoflake --config=pyproject.toml .
> 

Works (removes an unused import)

Let's change the pyproject.toml

[tool.autoflake]
ignore_init_module_imports = true
in_place = true
recursive = true
remove_all_unused_imports = true

Now let's run it again

% autoflake --config=pyproject.toml .
> can't parse config file 'C:\foo\baz\pyproject.toml'

from autoflake.

fsouza avatar fsouza commented on August 16, 2024

I'm confused here; Passing a toml file to --config was completely broken before (that was the whole point of #249). How were you doing that?

Sorry, I had missed this message, but I assume people were relying on the fact that simple toml files can be parsed as ini files. After thinking about this a little bit, I feel like we can roll #249 forward again. Alternatively, we could have a dedicated flag for pyproject.toml.

from autoflake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.