dkriegner / xrayutilities

xrayutilities - a package with useful scripts for X-ray diffraction physicists
http://xrayutilities.sourceforge.io
GNU General Public License v2.0
83 stars 29 forks source link

Use numpy>=2 as build dependency only for python>=3.9 #188

Closed t20100 closed 4 months ago

t20100 commented 4 months ago

This PR proposes to use dependency specifiers in the build-system's requires to use numpy>2 only for versions of Python that supports it.

Closes #187

dkriegner commented 4 months ago

/AzurePipelines run

thanks for this contribution. This is fine for me. It should not affect anything on the azure pipelines and the automatic builds for PyPI since they only run for python >= 3.9

azure-pipelines[bot] commented 4 months ago
Command 'run thanks' is not supported by Azure Pipelines.

Supported commands
  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.
dkriegner commented 4 months ago

/AzurePipelines run

azure-pipelines[bot] commented 4 months ago
Azure Pipelines successfully started running 1 pipeline(s).
t20100 commented 4 months ago

I tried to use oldest-supported-numpy instead of numpy for python<3.9 which would make the build more compatible... but it fails to install, so I left numpy.

Test TestIO_PerkinElmer.test_tiffread fails with Python3.12:

Logs ``` .tif, .bin and .bin.xz path : str, optional path of the data files """ if path: full_filename = os.path.join(path, filename) else: full_filename = filename if config.VERBOSITY >= config.INFO_ALL: print(f"XU.io.ImageReader.readImage: file {full_filename}") t1 = time.time() with xu_open(full_filename) as fh: # jump over header fh.seek(self.hdrlen) # read image rlen = numpy.dtype(self.dtype).itemsize * self.nop1 * self.nop2 img = numpy.frombuffer(fh.read(rlen), dtype=self.dtype) if self.byteswap: img = img.byteswap() > img.shape = (self.nop1, self.nop2) # reshape the data E ValueError: cannot reshape array of size 0 into shape (2048,2048) /opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/xrayutilities/io/imagereader.py:159: ValueError =============================== warnings summary =============================== tests/test_io_perkinelmer.py::TestIO_PerkinElmer::test_tiffread /opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/xrayutilities/io/imagereader.py:155: RuntimeWarning: overflow encountered in scalar multiply rlen = numpy.dtype(self.dtype).itemsize * self.nop1 * self.nop2 ```
dkriegner commented 4 months ago

The test failure is weird and certainly unrelated to your change. If it reproduces I will investigate.

dkriegner commented 4 months ago

/AzurePipelines run

azure-pipelines[bot] commented 4 months ago
Azure Pipelines successfully started running 1 pipeline(s).
dkriegner commented 4 months ago

I will merge this despite the error. My feeling is that it is a download problem of the test data. If the problem persists on the main branch I will fix it in a separate PR. thanks again for the contribution.