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

Moving to Ruff and pyproject.toml #204

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

HarrisonWilde
Copy link

@HarrisonWilde HarrisonWilde commented Dec 19, 2024

Fixes #195 and fixes #196 (they are pretty closely linked here). Not quite passing all tests but have switched fully to ruff and as a result ditched most of the other config files.

I cannot for the life of me get all tests to pass, because of weird issues in the makefile I have begun to address (This also fixes #203), one of which is the bug in the conda-remove step but now I cannot get the pre-commit hooks and install to work at the same time, seems to be some issue with conda on my system.

Main things to discuss before full PR are:

  1. Resolving the issues w the tests (and we may want to add more at some point but for now these seem to work ok)
  2. How precisely we want to use Ruff, you can see that I have pretty much kept in line with the old ways with a few changes like standard line length (88 from 80) and fewer ignores + standard isort, etc.

Checklist:

  • Updated documentation
  • CI passes
  • Labelled PR major/minor/patch

…full to ruff and as a result ditched most of the other config files
@HarrisonWilde HarrisonWilde added bug Something isn't working enhancement New feature or request labels Dec 19, 2024
@HarrisonWilde HarrisonWilde self-assigned this Dec 19, 2024
@HarrisonWilde
Copy link
Author

Checks now pass here, but still not on my machine, would be good to figure this out as my setup is fairly standard iiuc.

Copy link

@caldwellst caldwellst left a comment

Choose a reason for hiding this comment

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

Okay, just a few comments for the moment. I need to install conda and then will run the tests and test out spinning up a project using the cookiecutter.

docs/docs/structure.md Show resolved Hide resolved
tests/test_creation.py Outdated Show resolved Hide resolved
.pre-commit-config.yaml Show resolved Hide resolved
@caldwellst
Copy link

I am unable to locally pass test_precommit(). Everything else is successful. Potentially something with my conda setup, but haven't used it in at least 5 years, so not particularly sure how to troubleshoot.

../../../miniconda3/lib/python3.10/subprocess.py:526: CalledProcessError
--------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------
Installing and configuring git pre-commit hooks/bin/bash: /Users/seth.caldwell/miniconda3/envs/nestatestcookie/bin/pre-commit: /Users/seth.caldwell/miniconda3/envs/nestatestcookie/bin/python3.10: bad interpreter: No such file or directory
Git pre-commit setup failed, check .cookiecutter/state/setup-git.log for more info

@HarrisonWilde Have you been able to get all checks passing locally?

@HarrisonWilde
Copy link
Author

I am unable to locally pass test_precommit(). Everything else is successful. Potentially something with my conda setup, but haven't used it in at least 5 years, so not particularly sure how to troubleshoot.

../../../miniconda3/lib/python3.10/subprocess.py:526: CalledProcessError
--------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------
Installing and configuring git pre-commit hooks/bin/bash: /Users/seth.caldwell/miniconda3/envs/nestatestcookie/bin/pre-commit: /Users/seth.caldwell/miniconda3/envs/nestatestcookie/bin/python3.10: bad interpreter: No such file or directory
Git pre-commit setup failed, check .cookiecutter/state/setup-git.log for more info

@HarrisonWilde Have you been able to get all checks passing locally?

Mine actually fails locally too, I am not sure if I ever got that one working but it works fine on the CI so I stopped trying. I have a feeling it is related to the test itself which may be wrong (could also be due to the addition of the ruff step, perhaps something in the generated repo doesn't pass? I have tried to test this locally and it isn't the case but it is hard to say).

Copy link

@caldwellst caldwellst left a comment

Choose a reason for hiding this comment

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

Overall, everything looks good. I can't resolve the tests, but also can't resolve the tests in the base master branch, so not too concerned there. Will need to be a wider look at tests at some point in the future.

To me, the settings you've put in place for ruff make sense, but probably those who have worked on previous projects will have more concrete input, particularly on docstring styling or particular approaches we use here.

default_cell_metadata_filter = "-all"

[tool.ruff.lint]
select = ["ANN", "B", "C", "D", "E", "F", "I", "N", "W"]

Choose a reason for hiding this comment

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

Looks like a reasonable selection! Will be mainly interested how people using the current code base feel. Particularly around mandating a docstring convention? But I am all for it!

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, I noticed that was enabled in current flake8 config, I don't usually support those but just tried to stay close for now

# S101 - warns about assert being removed when compiled
# D100 - warns about missing module-level docstrings
ignore = ["S101", "D100"]
mccabe = { max-complexity = 10 }

Choose a reason for hiding this comment

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

Yes please!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
2 participants