green icon indicating copy to clipboard operation
green copied to clipboard

Add Support for `pyproject.toml` configuration.

Open ikollipara opened this issue 1 year ago • 5 comments

In relation to #300, this pulls request adds the feature. The current implementation makes use of tomlkit to support 3.8 compatibility. If the project moves to only support 3.11 and up, then tomlkit can be replaced with tomllib (built-in to Python stdlib).

The current ordering places the pyproject.toml configuration directly before cli commands, making it the last configuration file to be parsed. This pushes new users to use the pyproject.toml configuration.

Usage

To use the new configuration, add a section named [tool.green] into your pyproject.toml:

[tool.green]
verbosity = 2
run-coverage = true

And green will take it from there.

ikollipara avatar Oct 25 '24 02:10 ikollipara

I have seen other projects make tomllib an optional dependency only for older versions of python: prior to 3.11. We could have similar logic here.

sodul avatar Oct 28 '24 18:10 sodul

I've added support using the specifier found at https://github.com/hukkin/tomli to allow toml support on versions below 3.11.

ikollipara avatar Oct 28 '24 21:10 ikollipara

I'm not sure why the CI isn't running automatically. I enabled it...again. Let's get this problem fixed:

      !!
      
              ********************************************************************************
              One of the parsed requirements in `extras_require[toml]` looks like a valid environment marker:
      
                  'python_version < "3.11"'
      
              Please make sure that the configuration file is correct.
              You can use dangling lines to avoid this problem.
      
              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html#opt-2 for details.
              ********************************************************************************
      
      !!

CleanCut avatar Oct 29 '24 18:10 CleanCut

Sorry for the delay, but here are the changes. They should work for setting the version identifier. Let me know if there's anything else!

ikollipara avatar Nov 10 '24 20:11 ikollipara

Will you please merge main into this PR? That will fix at least some of the CI failures.

CleanCut avatar Nov 12 '24 22:11 CleanCut