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

Remove setuptools from the dependency list #367

Closed
TLCFEM opened this issue Jul 3, 2024 · 9 comments
Closed

Remove setuptools from the dependency list #367

TLCFEM opened this issue Jul 3, 2024 · 9 comments

Comments

@TLCFEM
Copy link
Contributor

TLCFEM commented Jul 3, 2024

https://github.com/FAIRmat-NFDI/pynxtools/blob/aaf3c50b18956b76b710cdb1525589bf9a36b81e/pyproject.toml#L38C6-L38C16

setuptools should not be listed as dependency, and this propagates to downstream projects and breaking the installation.
Please remove it.
See details and discussion via the following issue.

jazzband/pip-tools#522

@TLCFEM
Copy link
Contributor Author

TLCFEM commented Jul 3, 2024

@lukaspie

@blueraft
Copy link

blueraft commented Jul 4, 2024

Seems like setuptools is used directly in the tests here.

Maybe it can be moved to a dev dependency instead?

@rettigl
Copy link
Collaborator

rettigl commented Jul 4, 2024

If setuptools is not installed, you cannot import pynxtools:

>>> import pynxtools
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/pcshare/users/Laurenz/AreaB/sed/poetry_envs/virtualenvs/sed-processor-3qnpZCFI-py3.9/lib/python3.9/site-packages/pynxtools/__init__.py", line 23, in <module>
    from pynxtools._build_wrapper import get_vcs_version
  File "/mnt/pcshare/users/Laurenz/AreaB/sed/poetry_envs/virtualenvs/sed-processor-3qnpZCFI-py3.9/lib/python3.9/site-packages/pynxtools/_build_wrapper.py", line 10, in <module>
    from setuptools import build_meta as _orig
ModuleNotFoundError: No module named 'setuptools'

So I would argue it needs to be in dependencies, or am I missing something? Actually, I had the issue recently that under certain conditions, poetry would remove setuptools if it is not mentioned explicitly by pynxtools.

@domna
Copy link
Collaborator

domna commented Jul 4, 2024

If setuptools is not installed, you cannot import pynxtools:

>>> import pynxtools
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/pcshare/users/Laurenz/AreaB/sed/poetry_envs/virtualenvs/sed-processor-3qnpZCFI-py3.9/lib/python3.9/site-packages/pynxtools/__init__.py", line 23, in <module>
    from pynxtools._build_wrapper import get_vcs_version
  File "/mnt/pcshare/users/Laurenz/AreaB/sed/poetry_envs/virtualenvs/sed-processor-3qnpZCFI-py3.9/lib/python3.9/site-packages/pynxtools/_build_wrapper.py", line 10, in <module>
    from setuptools import build_meta as _orig
ModuleNotFoundError: No module named 'setuptools'

So I would argue it needs to be in dependencies, or am I missing something? Actually, I had the issue recently that under certain conditions, poetry would remove setuptools if it is not mentioned explicitly by pynxtools.

This is our build wrapper which assumes that it's build with setuptools. This should only occur when installed from the git repo (because it already build for the package), but I think we can also import setuptools conditionally there or ditch the build wrapper entirely (we added the nexus-version.txt as a fixed file anyways - the only difference would be that when you clone, change the definitions, don't update the file and install it in non-editable mode then the retrieved nexus version would be wrong... a slim but possible (and hard to debug) problem)

@TLCFEM
Copy link
Contributor Author

TLCFEM commented Jul 4, 2024

If setuptools is not installed, you cannot import pynxtools:

>>> import pynxtools
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/pcshare/users/Laurenz/AreaB/sed/poetry_envs/virtualenvs/sed-processor-3qnpZCFI-py3.9/lib/python3.9/site-packages/pynxtools/__init__.py", line 23, in <module>
    from pynxtools._build_wrapper import get_vcs_version
  File "/mnt/pcshare/users/Laurenz/AreaB/sed/poetry_envs/virtualenvs/sed-processor-3qnpZCFI-py3.9/lib/python3.9/site-packages/pynxtools/_build_wrapper.py", line 10, in <module>
    from setuptools import build_meta as _orig
ModuleNotFoundError: No module named 'setuptools'

So I would argue it needs to be in dependencies, or am I missing something? Actually, I had the issue recently that under certain conditions, poetry would remove setuptools if it is not mentioned explicitly by pynxtools.

It will be installed anyway since the following

requires = ["setuptools>=64.0.1", "setuptools-scm[toml]>=6.2"]

Poetry's behavior is annoying and arguable.

Making it an optional dependency is okay I guess, at least it's not going to pollute downstreams.

@TLCFEM
Copy link
Contributor Author

TLCFEM commented Jul 4, 2024

Seems like setuptools is used directly in the tests here.

Maybe it can be moved to a dev dependency instead?

It seems it is only used for file copying. It can be done by stdlibs. The dependency is not compulsory in this regard if I am correct.

@rettigl
Copy link
Collaborator

rettigl commented Jul 4, 2024

This should only occur when installed from the git repo (because it already build for the package),

This is also happening if installing directly from pypi. But @lukaspie is fixing it, no?

@blueraft
Copy link

blueraft commented Jul 4, 2024

I was able to install an older commit hash which did not have setuptools listed as a direct dependency with poetry.

❯ poetry show
anytree             2.12.1                             Powerful and Lightweight Python Tree Data Structure with various plugins
ase                 3.23.0                             Atomic Simulation Environment
click               8.1.7                              Composable command line interface toolkit
click-default-group 1.2.4                              click_default_group
contourpy           1.2.1                              Python library for calculating contours of 2D quadrilateral grids
cycler              0.12.1                             Composable style cycles
fonttools           4.53.0                             Tools to manipulate font files
h5py                3.11.0                             Read and write HDF5 files from Python
importlib-metadata  8.0.0                              Read metadata from Python packages
kiwisolver          1.4.5                              A fast implementation of the Cassowary constraint solver
lxml                5.2.2                              Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
matplotlib          3.9.1                              Python plotting package
mergedeep           1.3.4                              A deep merge function for 🐍.
numpy               1.26.4                             Fundamental package for array computing in Python
packaging           24.1                               Core utilities for Python packages
pandas              2.2.2                              Powerful data structures for data analysis, time series, and statistics
pillow              10.4.0                             Python Imaging Library (Fork)
pynxtools           0.3.2.post1.dev8+g273a0a14 273a0a1 Extend NeXus for experiments and characterization in Materials Science and Materials Engineering and serve as a NOMAD parser implementation for NeXus.
pyparsing           3.1.2                              pyparsing module - Classes and methods to define and execute parsing grammars
python-dateutil     2.9.0.post0                        Extensions to the standard Python datetime module
pytz                2024.1                             World timezone definitions, modern and historical
pyyaml              6.0.1                              YAML parser and emitter for Python
scipy               1.13.1                             Fundamental algorithms for scientific computing in Python
six                 1.16.0                             Python 2 and 3 compatibility utilities
tzdata              2024.1                             Provider of IANA time zone data
xarray              2024.6.0                           N-D labeled arrays and datasets in Python
zipp                3.19.2                             Backport of pathlib-compatible object wrapper for zip files

@lukaspie
Copy link
Collaborator

lukaspie commented Jul 4, 2024

Thanks @TLCFEM, I agree that having setuptools in the dependencies is not great.
I fixed it with #370.

I replaced setuptools.disutils by native shutil and moved the build_wrapper out of the src folder.

@lukaspie lukaspie closed this as completed Jul 4, 2024
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

No branches or pull requests

5 participants