Skip to content

Conversation

@sirosen
Copy link
Member

@sirosen sirosen commented Dec 15, 2024

Experimental PR: I decided to see if I could solve this problem, and what the tradeoffs would be.
We should be quick to reject it if we don't like the result, after a discussion.

The basic questions I wanted to answer were:

  • how hard is it to implement "custom commands" as part of tox config via the plugin file?
  • can we do better on the very common pattern of invoking rm, specifically?

Something non-obvious about this from just seeing the PR is that it took ~1 hour to implement these very modest changes.
The tox docs for the plugin hooks and objects are lagging a bit behind best-in-class tools like pytest, so it took some trial-and-error + reading up on existing plugins (like tox-docker) to see what they're doing.


Replace uses of rm in tox.ini with custom rmtree config setting, provided by the toxfile.py plugin.

Advantages over using rm:

  • more concise, without the risk of forgetting allowlist_externals
  • more portable -- works on Windows

Some projects have historically made themselves more portable by embedding python -c ... invocations in their tox config. This solves the problem of "how to do that cleanly".


📚 Documentation preview 📚: https://globus-sdk-python--1118.org.readthedocs.build/en/1118/

Replace uses of `rm` in tox.ini with custom `rmtree` config setting,
provided by the toxfile.py plugin.

Advantages over using `rm`:
- more concise, without the risk of forgetting `allowlist_externals`
- more portable -- works on Windows

Some projects have historically made themselves more portable by
embedding `python -c ...` invocations in their tox config. This solves
the problem of "how to do that cleanly".
@sirosen sirosen added the no-news-is-good-news This change does not require a news file label Dec 15, 2024
for name in sdk_rmtree:
path = pathlib.Path(name)
if path.exists():
log.warning(f"globus_sdk_rmtree: {path}")
Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, quick review note: logged warnings show up in tox output by default, but info logs don't.

Copy link
Member

@kurtmckee kurtmckee left a comment

Choose a reason for hiding this comment

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

❤️

@sirosen sirosen merged commit fa22c64 into globus:main Dec 16, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-news-is-good-news This change does not require a news file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants