Skip to content

Remove setup.py information from info.py #551

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

Merged
merged 8 commits into from
Nov 11, 2023

Conversation

matthew-brett
Copy link
Member

Shift away from info.py as source of setup information.

Shift away from info.py as source of setup information.
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (dc97dbf) 84.71% compared to head (adfaf66) 84.69%.
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #551      +/-   ##
==========================================
- Coverage   84.71%   84.69%   -0.02%     
==========================================
  Files         297      297              
  Lines       27632    27592      -40     
  Branches     3361     3361              
==========================================
- Hits        23409    23370      -39     
+ Misses       3269     3268       -1     
  Partials      954      954              
Files Coverage Δ
nipy/__init__.py 69.23% <100.00%> (-6.96%) ⬇️
nipy/info.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@effigies effigies left a comment

Choose a reason for hiding this comment

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

Some quick notes. Nothing blocking.

pyproject.toml Outdated
Comment on lines 34 to 50
build = [
'meson-python>=0.13',
'wheel',
'setuptools>=67',
'ninja',
'Cython>=3',
'numpy>=1.22',
'spin==0.3',
'build',
]
default = [
'numpy>=1.22',
'scipy>=1.8',
'nibabel>=3.2',
'sympy>=1.9',
'transforms3d'
]
Copy link
Member

Choose a reason for hiding this comment

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

IMO build and default don't make much sense. nipy[default] is equivalent to nipy and now you have duplication.

I'm not sure what nipy[build] is adding, since to install it you will already need something capable of building, while also duplicating (and extending?) the build-system.requires table.

Copy link
Member Author

Choose a reason for hiding this comment

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

@stefanv - any thoughts? I copied this brainlessly from scikit-image: https://github.com/scikit-image/scikit-image/blob/main/pyproject.toml#L46

Copy link
Member Author

Choose a reason for hiding this comment

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

@stefanv - any reason not to just delete the build and default sections of the optional-dependencies?

[build-system]
build-backend = "mesonpy"
requires = [
"meson-python>=0.13",
"ninja",
Copy link
Member

Choose a reason for hiding this comment

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

I'm able to build without this. Is ninja a dependency of meson-python that you just want to be explicit about? Do you actually depend on ninja-specifics, or could the other build tools stop using it without you needing to change anything?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was getting errors trying to build without it, for the wheel builds. I'm afraid I don't understand the build mechanics well enough to respond. If ninja is missing, with meson-python use something else?

Copy link
Member

Choose a reason for hiding this comment

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

How are you building? I'm using python -m build.

Copy link
Member Author

Choose a reason for hiding this comment

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

pip wheel ...

Copy link
Member

Choose a reason for hiding this comment

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

Hmm. Possibly an old pip? I just created a fresh environment:

$ mamba create -n tmp python=3.11
$ mamba activate tmp
$ pip wheel .
Processing /home/chris/Projects/nipy/nipy
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: nipy
  Building wheel for nipy (pyproject.toml) ... done
  Created wheel for nipy: filename=nipy-0.5.1.dev1-cp311-cp311-linux_x86_64.whl size=1916097 sha256=7ff5b2a9a9fe053c913dd2e487ee8c8fd11991893cf96e0f806846c79d17cd8b
  Stored in directory: /tmp/pip-ephem-wheel-cache-sn4mrur1/wheels/a1/58/f7/1af5aca9b8327defaf19028fc61c6f4850bd54b33e92f89a43
Successfully built nipy
$ pip --version
pip 23.3.1 from /home/chris/mambaforge/envs/tmp/lib/python3.11/site-packages/pip (python 3.11)

matthew-brett and others added 3 commits November 10, 2023 14:09
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
This reverts commit ee349e8, and adds
some comments.
@stefanv
Copy link
Collaborator

stefanv commented Nov 10, 2023

I'm curious why dropping ninja works. You need to get it into your environment somehow, and it is not installed as a dependency of meson or meson-python.

@stefanv
Copy link
Collaborator

stefanv commented Nov 10, 2023

I just verified that, if ninja is not presence, it will fail on a build. It can be confusing to test, because if ninja is already on the PATH (from a different venv), it will still be picked up and used.

To see that in action, clone https://github.com/stefanv/test-ninja-missing-compile-failure and run nox, ensuring that ninja is NOT on the PATH.

@effigies
Copy link
Member

I don't have ninja installed in my path, and using pipx run build to run in a completely clean environment, I see:

$ pipx run build
[...]
Build targets in project: 16

nipy 0.5.1.dev1

  User defined options
    Native files: /tmp/build-via-sdist-48bra0w8/nipy-0.5.1.dev1/.mesonpy-x0vcp63g/meson-python-native-file.ini
    buildtype   : release
    b_ndebug    : if-release
    b_vscrt     : md

Found ninja-1.11.1.git.kitware.jobserver-1 at /tmp/build-env-bge1hi3c/bin/ninja

So it does seem to be getting pulled in somewhere. I don't know how right now...

@effigies
Copy link
Member

effigies commented Nov 10, 2023

Hmm. Missed an important bit:

$ pipx run build 
* Creating venv isolated environment...
* Installing packages in isolated environment... (cython>=3, meson-python>=0.13, numpy==1.22; python_version >= '3.7' and python_version < '3.9', numpy>=1.25; python_version > '3.8', setuptools)
* Getting build dependencies for sdist...
* Installing packages in isolated environment... (ninja >= 1.8.2)

I would guess meson is injecting it.

Edit: https://github.com/mesonbuild/meson-python/blob/551962d/mesonpy/__init__.py#L993-L1000

@effigies
Copy link
Member

To see that in action, clone https://github.com/stefanv/test-ninja-missing-compile-failure and run nox, ensuring that ninja is NOT on the PATH.

I can confirm that pipx run nox doesn't work, but pipx run build does.

@matthew-brett
Copy link
Member Author

Sounds like it would be safer to add it back, no?

@effigies
Copy link
Member

Sure, why not.

@stefanv
Copy link
Collaborator

stefanv commented Nov 10, 2023

OK, so it looks like you get ninja pulled in when building via build. On scikit-image, we generate requirement.txt files from our pyproject.toml to make it easy to install build dependencies, so we need ninja there for when building the project via spin.

@stefanv
Copy link
Collaborator

stefanv commented Nov 10, 2023

No, I think skimage may have done the same. We used to use it to generate requirements, but those are now picked up from the correct locations in the file.

@matthew-brett
Copy link
Member Author

Thanks Stefan. Chris - does this look right to you now?

@effigies
Copy link
Member

Yup, that all looks fine to me.

@matthew-brett matthew-brett merged commit b3d202f into nipy:main Nov 11, 2023
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