New dev setup#79
Conversation
|
Hi Constantin - Thanks for this. How are you running the tests? What OS/python version? Interested in all of the linting fixes, although would prefer that CI be at least as strict as local testing to avoid situations where someone bypasses checks and then later committers have to clean it up.
For running tests/tools, I would prefer to stick with Will see if I can bump the CI test runners as it looks like ubuntu 18.04 was deprecated late last year. Are you interested in making the fix for the |
I'm not so sure running the entire test suite on each commit is preferable. There are speed concerns, as mentioned here, but on top of that, making intermediate commits which do not pass the test suite should be perfectly acceptable. Perhaps, if not solely for the sake of keeping this PR as simple as possible, this behavior can be omitted from this PR and reevaluated in a later issue or PR. Another concern I have, which is not really the fault of this PR but more so of our CI infrastructure in general, is that it seems like it will become increasingly difficult to maintain all of this CI. With this addition, there will be three different locations where CI will need to be maintained: |
Tests are run with tox. You'll need to add |
|
I'm also of the opinion that this should be broken into two PRs: one for adding the |
|
So, to summarize: I'll make 2 PRs, one for moving |
These are all fixed in PR #81 |
You are probably correct, it does not make sense to run the tests as a git hook.
First of all #81 simplifies the configuration a bit by moving black's, isort's, and mypy's common elements in I think the main question is, what do you want to have? Looking at
The answer seems to be no. I'd propose something different:
My reasoning for that is the following: for me, installing tox environments never works correctly and I'm always missing something. On the other hand, In addition, it is really annoying if github ci fails, because you did not run black or isort and pre-commit kind of forces you to run them. What do you think? |
My view on this is that tox, github CI and pre-commit are all at about the same level of abstraction and so shouldn't depend on each other. I think the correct approach is to move as much as possible to the next layer down. Moving exclude rules to |
I think the answer is that we want to either run everything using tox or everything using pre-commit. Both are currently completely adequate for the job, and using two just makes it twice as likely that something will break. Weirdly I don't think we can make the decision based on current features. Given that this project is mostly just ticking over with regular but infrequent updates to handle new python versions and occasional feature requests, the most important factor is how scary it is to come back to after six months. My expectation with My suspicion with |
To me, the most important thing is that failures should be a result of changes in the current PR. Having local tests that are stricter than CI tests makes it more likely that someone will bypass the local checks and break subsequent pushes. The well behaved developer who actually runs the tests locally then has the awkward choice between raising a separate PR to fix the previous break, bundling the unrelated fixes with the current PR, or bypassing local tests. The developer who broke the local tests doesn't see the consequences. |
Hey everyone,
I saw some comments regarding improving the dev setup and moving all configuration to
pyproject.toml. Here is my take on that:add pre-commit hooks
ssort introduces a pre-commit hook, so why not pre-commit to improve the code.
These are the hooks I propose to add (through trial and error I found those to be useful):
little impact
already existed
big impact:
Altogether, these hooks seem to be in the spirit of the existing tools used.
run code on existing files
I ran all hooks on the existing files, there were 2 small changes
add config to exclude test_data from black and isort
As far as I can see, the
test_datafolder contains example code to testssorton. As such, black shouldn't format and mypy should not run on this code. This commit ensures that.add toml sort config
enforce a consistent sorting of
pyproject.tomlconvert setup.cfg and setup.py to pyproject.toml
The main commit:
remove
setup.cfgadd package metadata to
pyproject.tomlAs far as I checked, all metadata should be correct. Installing the package works aswell.
remove
setup.py:setup.pyseems to be not necessary for installing the package correctly. However, the tox tests seem to fail now.ToDo:
Basically, fix the tests. This includes deciding whether to run the tests using pre-commit and how to run the test properly. For both points I need your input.
Constantin