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

Upgrade to Python 3.10 #187

Closed
2 tasks done
davidhassell opened this issue Jun 24, 2022 · 4 comments · Fixed by #189
Closed
2 tasks done

Upgrade to Python 3.10 #187

davidhassell opened this issue Jun 24, 2022 · 4 comments · Fixed by #189
Labels
enhancement New feature or request
Milestone

Comments

@davidhassell
Copy link
Contributor

davidhassell commented Jun 24, 2022

cfdm won't import under Python 3.10 (see #186). This issue needs fixing, as well as any other items that arise from testing:

  • Account for __wrapper__ being a read-only attribute at Python 3.10 (fixed by Python 3.10: __wrapper__ attribute #189)

  • Address following decorator-related(?) issue or test manifestation, resulting in this test error:

    ======================================================================
    FAIL: test_manage_log_level_via_verbosity (test_decorators.decoratorsTest)
    Test the `_manage_log_level_via_verbosity` decorator.
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/sadie/cfdm/cfdm/test/test_decorators.py", line 204, in test_manage_log_level_via_verbosity
        self.assertIn(msg, catch.output)
    AssertionError: 'INFO:test_decorators:This should be short and sweet' not found in ['WARNING:test_decorators:Best pay attention to this!']

    (fixed by Set correct assertLogs levels to fix Py 3.10+ test_decorators #197 & Fix test_decorators issue by setting correct assertLogs levels (1.9.0.x) #198)

@sadielbartholomew
Copy link
Member

FYI, after reviewing #189 I see the following result from the test suite (the final shown for PEP8 compliance is probably due to random files I have floating about from reviewing that aren't 'git ignored' so can be ignored and the first is likely because I haven't got the right requirements in the 3.10 conda environment to access the ncdump command, so these two can be ignored):

$ conda list | grep python
python                    3.10.5          ha86cf86_0_cpython    conda-forge
python_abi                3.10                    2_cp310    conda-forge
$ python run_tests.py
...
...
...
======================================================================
ERROR: test_read_CDL (test_read_write.read_writeTest)
Test the reading of files in CDL format.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sadie/cfdm/cfdm/test/test_read_write.py", line 548, in test_read_CDL
    subprocess.run(
  File "/home/sadie/anaconda3/envs/3ten-cf-env/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'ncdump /home/sadie/cfdm/cfdm/test/test_file.nc > /home/sadie/cfdm/cfdm/test/tmphpjs0e7y_test_read_write.nc' returned non-zero exit status 127.

======================================================================
ERROR: test_read_write_netCDF4_compress_shuffle (test_read_write.read_writeTest)
Test the `compress` and `shuffle` parameters to `write`.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sadie/cfdm/cfdm/read_write/netcdf/netcdfwrite.py", line 2657, in _write_netcdf_variable
    self._createVariable(**kwargs)
  File "/home/sadie/cfdm/cfdm/read_write/netcdf/netcdfwrite.py", line 2389, in _createVariable
    g["nc"][ncvar] = g["netcdf"].createVariable(**kwargs)
  File "src/netCDF4/_netCDF4.pyx", line 2838, in netCDF4._netCDF4.Dataset.createVariable
  File "src/netCDF4/_netCDF4.pyx", line 4003, in netCDF4._netCDF4.Variable.__init__
  File "src/netCDF4/_netCDF4.pyx", line 1965, in netCDF4._netCDF4._ensure_nc_success
RuntimeError: NetCDF: Filter error: bad id or parameters or duplicate filter

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sadie/cfdm/cfdm/test/test_read_write.py", line 442, in test_read_write_netCDF4_compress_shuffle
    cfdm.write(
  File "/home/sadie/cfdm/cfdm/read_write/write.py", line 521, in write
    netcdf.write(
  File "/home/sadie/cfdm/cfdm/decorators.py", line 171, in verbose_override_wrapper
    return method_with_verbose_kwarg(*args, **kwargs)
  File "/home/sadie/cfdm/cfdm/read_write/netcdf/netcdfwrite.py", line 4726, in write
    self._file_io_iteration(
  File "/home/sadie/cfdm/cfdm/read_write/netcdf/netcdfwrite.py", line 4995, in _file_io_iteration
    self._write_field_or_domain(f)
  File "/home/sadie/cfdm/cfdm/read_write/netcdf/netcdfwrite.py", line 3573, in _write_field_or_domain
    coordinates = self._write_auxiliary_coordinate(
  File "/home/sadie/cfdm/cfdm/read_write/netcdf/netcdfwrite.py", line 2130, in _write_auxiliary_coordinate
    self._write_netcdf_variable(
  File "/home/sadie/cfdm/cfdm/read_write/netcdf/netcdfwrite.py", line 2681, in _write_netcdf_variable
    raise RuntimeError(message)
RuntimeError: Can't create variable in NETCDF4 file from <AuxiliaryCoordinate: long_name=greek_letters(10) > (NetCDF: Filter error: bad id or parameters or duplicate filter)

======================================================================
FAIL: test_manage_log_level_via_verbosity (test_decorators.decoratorsTest)
Test the `_manage_log_level_via_verbosity` decorator.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sadie/cfdm/cfdm/test/test_decorators.py", line 204, in test_manage_log_level_via_verbosity
    self.assertIn(msg, catch.output)
AssertionError: 'INFO:test_decorators:This should be short and sweet' not found in ['WARNING:test_decorators:Best pay attention to this!']

======================================================================
FAIL: test_pep8_compliance (test_style.styleTest)
Test PEP8 compliance on all Python files in the codebase.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sadie/cfdm/cfdm/test/test_style.py", line 79, in test_pep8_compliance
    self.assertEqual(
AssertionError: 3 != 0 : Detected 3 PEP8 errors or warnings:

----------------------------------------------------------------------
Ran 239 tests in 50.842s

FAILED (failures=2, errors=2, skipped=1)

@davidhassell davidhassell reopened this Jul 9, 2022
@davidhassell
Copy link
Contributor Author

Hi @sadielbartholomew , Did the test suite run OK for you after #189 was merged?

@sadielbartholomew
Copy link
Member

sadielbartholomew commented Jul 11, 2022

Hi @davidhassell, no - the output I shared above is from the branch after #189 is included, if that's what you are asking?

I'm looking into the decorators-related failure now and should put up a fix very shortly. Just to confirm, that was the decorator-related issue you mentioned on Friday that you wanted sorting, correct?

@davidhassell
Copy link
Contributor Author

I'm looking into the decorators-related failure now and should put up a fix very shortly. Just to confirm, that was the decorator-related issue you mentioned on Friday that you wanted sorting, correct?

Hi Sadie - that's right. Could you edit in a new check box into the original post for that? Then all of the Python 3.10 stuff is in one place. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants