Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for pyproject.toml configuration. #301

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

ikollipara
Copy link

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.

Copy link
Owner

@CleanCut CleanCut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I like the idea! I think we should make a couple small changes, and then I would love to accept this.

  1. Let's switch back to tomllib, and just skip handling pyproject.toml if tomllib is not present. I don't feel like it's worth adding a dependency for one of the oldest versions of python we support (and will eventually drop support for).
  2. Please add test(s) in green/test/test_config.py!

😄

@ikollipara ikollipara requested a review from CleanCut October 26, 2024 01:24
@sodul
Copy link
Collaborator

sodul commented Oct 28, 2024

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.

@ikollipara
Copy link
Author

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

@CleanCut
Copy link
Owner

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.
              ********************************************************************************
      
      !!

README.md Outdated Show resolved Hide resolved
ikollipara and others added 2 commits November 10, 2024 14:38
Co-authored-by: Stephane Odul <1504511+sodul@users.noreply.github.com>
@ikollipara
Copy link
Author

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!

Copy link
Owner

@CleanCut CleanCut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

green/config.py Outdated Show resolved Hide resolved
setup.cfg Outdated Show resolved Hide resolved
green/test/test_config.py Outdated Show resolved Hide resolved
green/test/test_config.py Outdated Show resolved Hide resolved
@CleanCut
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants