Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trying to install
py3nj
withpip>=23.1
results in the following error:The problem is related to the fact that
setup.py
needs to be able to importnumpy
in order to create the fortran modules. This is actually an issue for all versions of pip; if you try to installpy3nj
into an environment withoutnumpy
installed, you'll get the same error message. In fact, the discussion in #17 diagnoses this exact problem, and also proposes the exact solution implemented by this PR. But it's more urgent now, because it used to be that everything would work so long asnumpy
was installed.What changed in
pip>=23.1
is that packages are now built in their own virtual environments, isolated from any user-installed packages. See the CHANGELOG, and two relevant pull requests: pypa/pip#8368 and pypa/pip#8559. This means that there's no longer any way for users to provide thenumpy
dependency (note that installingnumpy
beforepy3nj
in the above snippet didn't avoid the error), sopy3nj
needs to tell pip to include it in the build environment. This is done using the[build-system]
section of thepyproject.toml
file.While I was at it, I moved most of the metadata from
setup.py
topyproject.toml
, and got rid of the now-redundantsetup.cfg
. I think this is considered best-practice, because it's easier for third-party tools to extra project metadata from TOML files than python scripts. I also noticed thatsetup.py
specified a BSD 3-clause license, while the actualLICENSE
file in the repository contains the Apache license. I assumed that thesetup.py
file was wrong, and changed it to just reference theLICENSE
file.