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

tox and GitHub checks are not aligned #1556

Closed
kurtmckee opened this issue Sep 27, 2020 · 18 comments · Fixed by #1557
Closed

tox and GitHub checks are not aligned #1556

kurtmckee opened this issue Sep 27, 2020 · 18 comments · Fixed by #1557
Assignees

Comments

@kurtmckee
Copy link
Contributor

After opening #1555 the regex linter warned me about a problem in my patch. This was not caught during extensive testing using tox, and indicates that tox and the GitHub checks are not aligned with each other.

tox must be updated to use the same regex linter that GitHub checks is using so that contributors can catch problems before submitting PR's.

@Anteru
Copy link
Collaborator

Anteru commented Sep 27, 2020

Right, but the regex linter check requires make support, which tox doesn't, so it's not entirely clear to me how you want the tox check to run the same checks as the GitHub actions. The GitHub actions are a superset of tox; eventually I expect things to shift even further in GitHub's favor (i.e. once we get make check to work.)

In any case, I don't see how we can get the regex linter run on Windows out of the box. Do you have any suggestions how to fix this?

@birkenfeld
Copy link
Member

Regexlint doesn't need make, it's just an external package and you call a script contained there.

I guess you could use regexlint as a library and create a "test" that calls it. It's an abuse of unit tests though, in my opinion.

Or does tox have a facility for integration of other types of checks?

@kurtmckee
Copy link
Contributor Author

kurtmckee commented Sep 27, 2020 via email

@Anteru
Copy link
Collaborator

Anteru commented Sep 27, 2020

Ah my bad, I thought it required some Linux-ism to run. Should we include regexlint as a git submodule and run it through tox? It seems like a welcome addition (and potentially a better path forward for moving the other make check calls to?)

@kurtmckee
Copy link
Contributor Author

kurtmckee commented Sep 27, 2020 via email

@Anteru
Copy link
Collaborator

Anteru commented Sep 27, 2020

Ah, perfect. Let me look into this and see what I can do.

@Anteru Anteru self-assigned this Sep 27, 2020
kurtmckee added a commit to kurtmckee/pr-pygments that referenced this issue Sep 27, 2020
@kurtmckee
Copy link
Contributor Author

Regarding migrating commands out of make, tox might not be the right tool for arbitrary build or release commands. For example, tox is probably not the right tool for managing the build of the Pygments demo.

doit may be more appropriate -- it has strong support for specifying input file dependencies and output files, for skipping steps if the inputs and outputs aren't going to change, and running arbitrary commands. I've found it to be an powerful tool for automating builds and releases.

@birkenfeld
Copy link
Member

There's no need to replace make; even if tox runs the linter (which I approve, of course) the standalone make target is still useful.

@Anteru
Copy link
Collaborator

Anteru commented Sep 28, 2020

I was mostly hoping to reduce duplication, i.e. have make check call tox going forward, once all tests are there -- but that depends on how easy it is to run arbitrary commands in tox.

I don't want to remove the make files wholesale; only the tests if that's feasible.

@birkenfeld
Copy link
Member

Sure, as long as you can still call the different things individually (i.e. make check, make regexlint etc.)

As for regexlint, I'd prefer to keep using our fork instead of upstream, since we can easily tweak some rules there when needed.

@kurtmckee
Copy link
Contributor Author

I updated #1557 to depend on Pygments' regexlint git master branch.

regexlint depends on Pygments, so tox is installing the latest Pygments release in the testing environment. I think this is probably unnecessary, but please evaluate. It may be worthwhile to remove that dependency from regexlint. Here's the output from tox when I ran tox -e lint a moment ago (I manually wrapped the lines):

lint installed:
Pygments @ file:///C:/Users/Kurt/Documents/dev/pygments/.tox/.tmp/package/11/Pygments-2.7.1.dev20200928.zip,
regexlint @ git+https://github.com/pygments/regexlint.git@3d7426ae369f139f2589a13939bd8723be15eacc

@Anteru
Copy link
Collaborator

Anteru commented Sep 28, 2020

I just tried this locally and it seems to work. I did notice however that changing a rule like true|false|NULL to true|truer|false|NULL does not seem to trigger regexlint any more (I thought it specifically was looking for prefixes in alternative expressions?)

In any case, this seems to work, though it's significantly slower compared to running make regexlint. Timing make regexlint shows that the command takes

$> time make regexlint
# Removed output

real    0m2.655s
user    0m30.383s
sys     0m1.103s

In comparison, tox takes an eternity -- certainly not something I'd want to run locally during development:

$> time tox -e lint
# Removed output

real    1m4.879s
user    0m35.793s
sys     0m9.915s

Frankly I'd call this prohibitively slow. It's definitely not something I'd want make regexlint to use by default.

Anteru pushed a commit that referenced this issue Sep 28, 2020
* Add regexlint to tox so linting can be done during development

Tested on Windows.

Closes #1556

* Make regex linting depend on pygments/regexlint@master
@birkenfeld
Copy link
Member

Uh, that difference should be investigated. It looks like missing parallelism, although user time is significantly higher as well.

@birkenfeld birkenfeld reopened this Sep 28, 2020
@Anteru
Copy link
Collaborator

Anteru commented Sep 29, 2020

As far as I can tell most of the time is spent in downloading/installing the package. The check itself is not much slower. This could be biased due to me running this on WSL2, but I thought the gap is big enough to not make tox the default path used by make regexlint. I'm not entirely sure what to profile here -- the test themselves seem to take comparable amounts of time.

@birkenfeld
Copy link
Member

Got it.

@kurtmckee
Copy link
Contributor Author

kurtmckee commented Sep 29, 2020 via email

@Anteru
Copy link
Collaborator

Anteru commented Oct 4, 2020

Thanks. My suspicion is that the (dependent) Pygments installation takes most of the time, and WSL2 certainly doesn't help. If it's a one-time cost that's fine for local use, but it won't help the CI as it starts from scratch every time.

@birkenfeld
Copy link
Member

There's no reason for the CI to change anyway.

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 a pull request may close this issue.

3 participants