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

A few misc tidy-ups #85

Merged
merged 2 commits into from
May 29, 2024
Merged

A few misc tidy-ups #85

merged 2 commits into from
May 29, 2024

Conversation

alexdewar
Copy link
Contributor

While working on a new template using cookiecutter, I found a few small issues with the current template:

  • Missing return-type annotation in test
  • Remove unnecessary __init__.py file in tests folder
  • Use importlib to find the package version in a more robust way
  • Drop ruff from dev dependencies (the pre-commit hook and VS Code extension both use bundled versions)
  • Use consistent case for project name

@AdrianDAlessandro
Copy link
Contributor

AdrianDAlessandro commented May 28, 2024

I disagree with needing a return type annotation in tests since they all, but design, return None. This is why there is the mypy override in the pyproject.toml. Also, I believe we need to the __init__.py in the tests file for that override to work properly, I just removed it in an existing repo and had a bunch of mypy errors when I ran pytest.

The importlib idea is great! Does that also work for pip-tools?

@alexdewar
Copy link
Contributor Author

@AdrianDAlessandro Ahhh ok. I wondered what that __init__.py file was doing in there, but that makes sense. I'll drop those two commits.

The importlib thing should work with pip-tools or anything else really as long as the project is actually installed as part of the build process (as I think it is).

Copy link
Contributor

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

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

Works for me

@cc-a
Copy link

cc-a commented May 28, 2024

Just a note. I don't think we should remove ruff as a dev dependency. We can't assume people use VScode and my own dev setup for instance presumes that the linters are available in the project venv.

@alexdewar
Copy link
Contributor Author

The importlib thing should work with pip-tools or anything else really as long as the project is actually installed as part of the build process (as I think it is).

Turns out it doesn't work with pip-tools 🙃. Weird that pip doesn't install the current project, but seemingly it doesn't.

@alexdewar
Copy link
Contributor Author

@cc-a Ahh ok. I'll put it back then. Also, I've noticed mypy isn't in the dev dependencies, although we use it for linting. Do you think we should add that too?

@AdrianDAlessandro
Copy link
Contributor

Turns out it doesn't work with pip-tools 🙃. Weird that pip doesn't install the current project, but seemingly it doesn't.

It does work, but you have to do pip install -e ".[dev]"

@cc-a Ahh ok. I'll put it back then. Also, I've noticed mypy isn't in the dev dependencies, although we use it for linting. Do you think we should add that too?

It might be installed along with pytest-mypy?

@alexdewar
Copy link
Contributor Author

Aha. Right on both counts @AdrianDAlessandro

@alexdewar alexdewar merged commit 3bd3b70 into main May 29, 2024
10 checks passed
@alexdewar alexdewar deleted the tidyup branch May 29, 2024 10:53
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.

3 participants