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

[1] Add tox generation script, but don't use it yet #3971

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Jan 20, 2025

Add:

  • tox generation script
  • tox template
  • script for generating tox and CI yamls in one go
  • readme for the script
  • starting config for multiple integrations (not used yet)

In this PR, the script is set to ignore all integrations, so no tox configuration is actually added. However, it's still the script actually generating the real tox.ini from the tox.jinja template.

See follow-up PRs for more.

Supersedes #3920

@sentrivana sentrivana marked this pull request as ready for review January 20, 2025 14:57
Copy link

codecov bot commented Jan 20, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
22016 1 22015 5708
View the top 1 failed tests by shortest run time
tests.integrations.stdlib.test_httplib test_http_timeout
Stack Traces | 0.12s run time
.../integrations/stdlib/test_httplib.py:373: in test_http_timeout
    assert len(transaction["spans"]) == 1
E   assert 0 == 1
E     +0
E     -1

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

Thanks for splitting up the PR, I think it is much easier to review now!

I added some questions and suggestions

Comment on lines +66 to +67
"*": ["Werkzeug"],
"<3.0": ["Werkzeug<2.1.0"],
Copy link
Member

Choose a reason for hiding this comment

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

Does order matter here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, any order is fine

Comment on lines 76 to 81
```
"aiohttp": {
...
"python": ">=3.7",
}
```
Copy link
Member

Choose a reason for hiding this comment

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

It is strange that the snippets before and after this one use deps, but this one does not. Is this intentional? If yes, maybe reordering would make sense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So this was an example for the paragraph talking about the python key, specifically. I can reorganize the README a bit so that it's clearer what belongs together. I'm thinking subheadings for the different keys would already help a lot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reorganized a bit in 474c679

Comment on lines 51 to 56
The following can be set as a rule:
- `*`: packages will be always installed
- a version specifier on the main package (e.g. `<=0.32`): packages will only
be installed if the main package falls into the version bounds specified
- specific Python version(s) in the form `py3.8,py3.9`: packages will only be
installed if the Python version matches one from the list
Copy link
Member

Choose a reason for hiding this comment

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

I find this description somewhat unclear.

The first line I would change to something like "The rule must be set to one of the following." Compared to the current first line, which is not specific regarding whether there might be some other valid values for the rule, my proposal clarifies that these are the only allowed values.

Second, I would explicitly clarify that the packages that are installed are always the ones listed under that rule.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated 474c679

scripts/populate_tox/README.md Outdated Show resolved Hide resolved
scripts/populate_tox/README.md Outdated Show resolved Hide resolved
scripts/populate_tox/config.py Show resolved Hide resolved
CLASSIFIER_PREFIX = "Programming Language :: Python :: "


IGNORE = {
Copy link
Member

Choose a reason for hiding this comment

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

Are all integrations listed in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this PR, yes, effectively making the script almost no-op. It still generates the tox.ini file, but without any auto-generated integration entries. This then happens in the other PRs.

return hasher.hexdigest()


def main(fail_on_changes: bool = False) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

This function seems a bit long – I think we should try to break it up into smaller functions. At a minimum, probably the code in the loop could be its own function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Broken up in c96bf0c

scripts/populate_tox/populate_tox.py Outdated Show resolved Hide resolved

if __name__ == "__main__":
fail_on_changes = len(sys.argv) == 2 and sys.argv[1] == "--fail-on-changes"
main(fail_on_changes)
Copy link
Member

Choose a reason for hiding this comment

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

I think it might be a good idea to add some tests for this script. What do you think?

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.

2 participants