Open jack89roberts opened 6 months ago
This is incredible feedback. Thank you for being so thorough with documenting your experience!!
A quick note just before I go through this more methodically: I've never actually used hatch
itself, just the hatchling
backend (there are a couple of notes on this here: https://hatch.pypa.io/1.9/why/).
Will make some spin-off issues :)
Created #34, #35, #36, #37, #38 to track some of these points. I've yet to look into your hatch
issues.
It looks like hatch
can do a lot in terms of Python version/environment management, I think it does everything you might use pyenv
/venv
/tox
/nox
/setuptools
for in one tool (though I've never used tox
/nox
). I might try it on a project at some point though poetry
/ setuptools
+ venv
are the current ARC favourites (& battle).
I think the pytest
defaults and the inclusion of flake8-errmsg
in ruff
are worth a chat at some point so I might make an issue about those too.
An update: I've thought about the hatch
issues, and decided not to support it (or poetry) as a backend from now, mostly because you can do most of this setup with the tools directly via poetry new
and hatch new
. The good news is that the template is much easier to maintain as a result! Thanks for trying out hatch
.
I played with the template for the first time today just to get an idea for what it does/how it compares to the ARC one. Just written down everything that came up when I went through it, apologies it got so long!
There are a few tweaks that could be nice to add, but otherwise most my comments are just places where I might prefer different (generally less strict) choices for the default setup of various tools, but different people will have different views on that and I can see the argument for keeping the template quite opinionated/strict. It's nice how much it sets up!
Setting up the template
CONTRIBUTING.md
actually, but I don't think people would necessarily look in there..copier-answers.yml
: Inclined to think I don't want this in my project, is there a strong case for including it?pyproject.toml
:classifiers
: Includes"Programming Language :: Python :: 3.9"
butrequires-python
is>=3.10
.test
anddev
groups in optional dependencies? (And personally I like to have pre-commit, linters etc. installed there too so I can run them easily locally and VS code extensions pick them up etc., though that may not be best practice since they're then defined in both pre-commit and pyproject.toml)from __future__ import annotations
still necessary in the Python 3.10+ world?Setting up Hatch/installing the package [some not really about the template]
hatch new --init
wasn't working before runninghatch env create
.[tool.hatch.build.targets.wheel], packages=["mypath"]
value needs to be added to pyproject.toml. I think the template allows these names to be different but doesn't update the hatch stuff to reflect.[tool.hatch]
section withenvs.default.<xyz>
keys I seemed to need a[tool.hatch.envs.default]
section for it to pick up the values correctly.tool.hatch.envs.default
when these are also specified inproject.optional-dependencies
? It seems optional dependencies are not installed in the hatch environment so I guess the answer is yes.features
block totool.hatch.envs
to do this.poetry add
, is it just by changingpyproject.toml
manually?Using the template
pytest
options make loads of my tests fail due to warnings from other packages. Maybe I should be better at suppressing/fixing these warnings but it feels quite aggressive as the default.mypy
is shouting at me about a lot but unsurprising since I didn't use mypy in that project. But does the pre-commit config remove type-checking if it's not asked for in the template setup (I haven't checked but don't see anything in the pre-commit config that would remove it)?ruff
config picks up on some interesting things, but not sure I'd want all of them to block commits/fail actions.