tox-dev/platformdirs

Please consider switching the build-system to flit_core or removing hatch-vcs to ease setuptools bootstrap

Closed this issue · 4 comments

Could you please consider switching the build system from setuptools to flit_core, or at least removing the hatch-vcs requirement? This would help Linux distributions such as Gentoo avoid cyclic dependencies that cause bootstrapping unbundled setuptools a real pain. If you agree, I can submit a pull request doing one or the other.

The problem is that the most recent release of setuptools (66.0.0) started using platformdirs. Hatchling has a number of dependencies using setuptools themselves, that are effectively creating a dependency cycle for us — we need platformdirs to install setuptools, platformdirs need hatchling but hatchling needs setuptools first (because of its dependencies). On top of that, hatch-vcs needs setuptools_scm which invariably needs setuptools.

flit_core is a "no dependencies [except for tomli, on Python < 3.11]" by design, so it makes bootstrapping packages much easier. Alternatively, I'm also trying to get hatchling's dependencies not to use setuptools (feels like asking a lot of favors just to get things working again…).

Unfortunately, I don't think it's possible to retain setuptools_scm-style logic. Both hatch-vcs and flit_scm packages use setuptools_scm which invariably means a cyclic dependency with setuptools.

we need platformdirs to install setuptools,

This is likely because you're trying to devendor playformdirs from setup tools that's not supported by setuptools. We don't want to change our build system either.

we need platformdirs to install setuptools,

This is likely because you're trying to devendor playformdirs from setup tools that's not supported by setuptools. We don't want to change our build system either.

The presence of pkg_resources.extern and setuptools.extern modules whose purpose is to wrap between loading vendored and system dependencies suggests otherwise. Do you have evidence to support that it's "not supported"?

Note setuptools has no dependencies https://github.com/pypa/setuptools/blob/main/setup.cfg#L29

This is not true. Vendoring dependencies does not make them "no dependencies". Plus, it indirectly depends on wheel breaking the PEP517 bootstrap. There's a bug open about it for years but that's not really relevant to the problem at hand.

ofek commented

To be clear what's happening here:

On top of that, hatch-vcs needs setuptools_scm which invariably needs setuptools.

That is actually the only issue here. setuptools_scm depends on setuptools, but only for legacy backward compatibility reasons, it is now completely uncoupled. When Ronny the maintainer strips the logic into a new reusable package then the Hatchling plug-in will depend on that but nothing can be done until then.