openraildata / stomp-client-python

Example code to use the Darwin v16 feed in Python 3
23 stars 12 forks source link

PyXB Deprecated #10

Open TomHanra opened 2 years ago

TomHanra commented 2 years ago

I attempted to follow the instructions to get the ppv16 module set up (i.e. run pyxbgen --schema-root=ppv16 --module PPv16 rttiPPTSchema_v16.xsd ) but neither pyxb or Pyxb-x (a successor) work with python 3.10.

poggs commented 2 years ago

This doesn't seem to be an issue for me on Python 3.10:

(venv) pwh@angel:~/PycharmProjects/stomp-client-python$ pyxbgen --schema-root=ppv16 --module PPv16 rttiPPTSchema_v16.xsd
WARNING:pyxb.binding.generate:Element use {http://www.thalesgroup.com/rtti/PushPort/Alarms/v1}RTTIAlarm.{http://www.thalesgroup.com/rtti/PushPort/Alarms/v1}set renamed to set_
WARNING:pyxb.binding.generate:Element use {http://www.thalesgroup.com/rtti/PushPort/Forecasts/v3}TSLocation.{http://www.thalesgroup.com/rtti/PushPort/Forecasts/v3}pass renamed to pass_
WARNING:pyxb.binding.generate:Element use {http://www.thalesgroup.com/rtti/PushPort/TrainOrder/v1}TrainOrder.{http://www.thalesgroup.com/rtti/PushPort/TrainOrder/v1}set renamed to set_
Python for http://www.thalesgroup.com/rtti/PushPort/v16 requires 16 modules
(venv) pwh@angel:~/PycharmProjects/stomp-client-python$ python -V
Python 3.8.10

Which version of pyxb are you using? I've recently updated the codebase to be specific on versions of dependencies, and it's fine with v1.2.6, at least here.

mneedham commented 1 year ago

For me, it complains about a missing attribute:

$ pyxbgen --schema-root=ppv16 --module PPv16 rttiPPTSchema_v16.xsd
Traceback (most recent call last):
  File "/Users/markhneedham/projects/stomp-client-python/.venv/bin/pyxbgen", line 4, in <module>
    import pyxb.xmlschema
  File "/Users/markhneedham/projects/stomp-client-python/.venv/lib/python3.10/site-packages/pyxb/xmlschema/__init__.py", line 12, in <module>
    from pyxb.xmlschema.structures import Schema as schema
  File "/Users/markhneedham/projects/stomp-client-python/.venv/lib/python3.10/site-packages/pyxb/xmlschema/structures.py", line 47, in <module>
    from pyxb.binding import basis, datatypes, facets
  File "/Users/markhneedham/projects/stomp-client-python/.venv/lib/python3.10/site-packages/pyxb/binding/__init__.py", line 8, in <module>
    from . import datatypes
  File "/Users/markhneedham/projects/stomp-client-python/.venv/lib/python3.10/site-packages/pyxb/binding/datatypes.py", line 1266, in <module>
    from . import content
  File "/Users/markhneedham/projects/stomp-client-python/.venv/lib/python3.10/site-packages/pyxb/binding/content.py", line 807, in <module>
    class _PluralBinding (collections.MutableSequence):
AttributeError: module 'collections' has no attribute 'MutableSequence'

$ python -V
Python 3.10.9

Update: It does work if I use pip install Pyxb-x:

$ pip install Pyxb-x
Collecting Pyxb-x
  Downloading PyXB_X-1.2.6.1-py3-none-any.whl (309 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 310.0/310.0 kB 2.8 MB/s eta 0:00:00
Installing collected packages: Pyxb-x
Successfully installed Pyxb-x-1.2.6.1

$ pyxbgen --schema-root=ppv16 --module PPv16 rttiPPTSchema_v16.xsd
WARNING:pyxb.binding.generate:Element use {http://www.thalesgroup.com/rtti/PushPort/Alarms/v1}RTTIAlarm.{http://www.thalesgroup.com/rtti/PushPort/Alarms/v1}set renamed to set_
WARNING:pyxb.binding.generate:Element use {http://www.thalesgroup.com/rtti/PushPort/Forecasts/v3}TSLocation.{http://www.thalesgroup.com/rtti/PushPort/Forecasts/v3}pass renamed to pass_
WARNING:pyxb.binding.generate:Element use {http://www.thalesgroup.com/rtti/PushPort/TrainOrder/v1}TrainOrder.{http://www.thalesgroup.com/rtti/PushPort/TrainOrder/v1}set renamed to set_
Python for http://www.thalesgroup.com/rtti/PushPort/v16 requires 16 modules