Conversation
|
As a review, let me verify that this allows the git repo to be cloned and then pip installed into a python 3.12 environment. |
There was a problem hiding this comment.
Looks like this works for me, installs fine and no obvious crashes:
Details
(timechart)zlentz@psbuild-rhel7-02:~$ python --version
Python 3.12.3
(timechart)zlentz@psbuild-rhel7-02:~$ conda list timechart
# packages in environment at /cds/home/z/zlentz/miniconda3/envs/timechart:
#
# Name Version Build Channel
timechart 1.2.4.dev33+g13e1c0e pypi_0 pypi
(timechart)zlentz@psbuild-rhel7-02:~$ timechart --help
usage: timechart [-h] [--log_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--config-file CONFIG_FILE] [--version] [--pvs [PVS ...]]
A charting tool based on the Python Display Manager (PyDM).
options:
-h, --help show this help message and exit
--log_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
Configure level of log display
--config-file CONFIG_FILE
The configuration file to import to and start TimeChart.
--version show program's version number and exit
--pvs [PVS ...] Launch TimeChart with PVs loaded from the command line.
(timechart)zlentz@psbuild-rhel7-02:~$ timechart
There is, however, one notable pytest test failure, though I don't immediately understand what's up with it:
Details
pytest
==================================================================================================================================== test session starts =====================================================================================================================================
platform linux -- Python 3.12.3, pytest-8.2.0, pluggy-1.5.0
PyQt5 5.15.9 -- Qt runtime 5.15.8 -- Qt compiled 5.15.8
rootdir: /cds/home/z/zlentz/github/timechart
configfile: pyproject.toml
plugins: qt-4.4.0, cov-5.0.0
collected 8 items
timechart/tests/striptool_config_import/test_striptool_config_import.py .F...... [100%]
========================================================================================================================================== FAILURES ==========================================================================================================================================
________________________________________________________________________________________________________________________________ test_export_converted_files _________________________________________________________________________________________________________________________________
def test_export_converted_files():
"""
Import all StripTool config files, one-by-one, from the "data" directory, convert the StripTool config data into
the TimeChart config data, and save the data as JSON files.
This test executes a different code path then the previous test, i.e. testing the convert_stp_file method with the
path to export a TimeChart JSON config file as the second parameter.
"""
settings_importer = SettingsImporter()
_make_output_dir()
striptool_filenames = [f for f in os.listdir(INPUT_DIR_PATH) if isfile(os.path.join(
INPUT_DIR_PATH, f))]
for striptool_filename in striptool_filenames:
with open(os.path.join(INPUT_DIR_PATH, striptool_filename), 'r') as input_file:
output_filename = striptool_filename + ".json"
> settings_importer.convert_stp_file(input_file, os.path.join(OUTPUT_DIR_PATH, output_filename))
timechart/tests/striptool_config_import/test_striptool_config_import.py:90:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../miniconda3/envs/timechart/lib/python3.12/site-packages/timechart/data_io/settings_importer.py:87: in convert_stp_file
json.dump(timechart_settings, fp=output_file, indent=4, separators=(',', ': '))
../../miniconda3/envs/timechart/lib/python3.12/json/__init__.py:179: in dump
for chunk in iterable:
../../miniconda3/envs/timechart/lib/python3.12/json/encoder.py:432: in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
../../miniconda3/envs/timechart/lib/python3.12/json/encoder.py:406: in _iterencode_dict
yield from chunks
../../miniconda3/envs/timechart/lib/python3.12/json/encoder.py:439: in _iterencode
o = _default(o)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <json.encoder.JSONEncoder object at 0x7f2ec83f61b0>, o = '1.2.4.dev33+g13e1c0e'
def default(self, o):
"""Implement this method in a subclass such that it returns
a serializable object for ``o``, or calls the base implementation
(to raise a ``TypeError``).
For example, to support arbitrary iterators, you could
implement default like this::
def default(self, o):
try:
iterable = iter(o)
except TypeError:
pass
else:
return list(iterable)
# Let the base class default method raise the TypeError
return super().default(o)
"""
> raise TypeError(f'Object of type {o.__class__.__name__} '
f'is not JSON serializable')
E TypeError: Object of type VersionProxy is not JSON serializable
../../miniconda3/envs/timechart/lib/python3.12/json/encoder.py:180: TypeError
================================================================================================================================== short test summary info ===================================================================================================================================
FAILED timechart/tests/striptool_config_import/test_striptool_config_import.py::test_export_converted_files - TypeError: Object of type VersionProxy is not JSON serializable
================================================================================================================================ 1 failed, 7 passed in 0.86s =================================================================================================================================
|
Why are we trying to dump the version specifier into json.... I'll look at this more |
|
After confusing myself in my conda environments, I was able to install this as is and run the test suite successfully Details
|
|
Possibly confounding things, the output .json files in the test folder get updated version strings with each test suite run. I wonder if that's causing issues. |
|
I'm not entirely sure what's different between our cases but maybe the prudent thing is to force these exported version strings back to str type, I'll check if that fixes the suite for me |
|
I'm going to push the tiny commit that fixes this for me (searched for all instances of |
|
I think this sufficiently fixes the problem now, and we'll be able to build timechart in 3.12 envs going forward. |
Description
Migrate away from setup.py and deprecated versioneer framework to modern pyproject.toml build tools. This is necessary to build the package for python 3.12
I realize that without a running test suite I don't really have external verification that this is set up correctly