Closed moorepants closed 18 hours ago
The readthedoc builds are now failing from this: https://app.readthedocs.org/projects/opty/builds/25974252/ I guess they'e updated to Python 3.13.
Looks like there is no whitespace in Python 3.13:
ipdb> coll_doc.split('Parameters\n ==========\n ')
["Instantiates a ConstraintCollocator object.\n\nParameters\n==========\nequations_of_motion : sympy.Matrix, shape(n, 1)\n A column matrix of SymPy expressions defining the right hand side\n of the equations of motion when the left hand side is zero, e.g.\n ``0 = x'(t) - f(x(t), u(t), p)`` or ``0 = f(x'(t), x(t), u(t),\n p)``. These should be in first order form but not necessairly\n explicit. They can be ordinary differential equations or\n differential algebraic equations.\nstate_symbols : iterable\n An iterable containing all ``n` of the SymPy functions of time\n which represent the states in the equations of motion.\nnum_collocation_nodes : integer\n The number of collocation nodes, ``N``. All known trajectory arrays\n should be of this length.\nnode_time_interval : float or Symbol\n The time interval between collocation nodes. If a SymPy symbol is\n provided, the time interval will be treated as a free variable\n resulting in a variable duration solution.\nknown_parameter_map : dictionary, optional\n A dictionary that maps the SymPy symbols representing the known\n constant parameters to floats. Any parameters in the equations of\n motion not provided in this dictionary will become free\n optimization variables.\nknown_trajectory_map : dictionary, optional\n A dictionary that maps the non-state SymPy functions of time to\n ndarrays of floats of ``shape(N,)``. Any time varying parameters in\n the equations of motion not provided in this dictionary will become\n free trajectories optimization variables. If solving a variable\n duration problem, note that the values here are fixed at each node\n and will not scale with a varying time interval.\ninstance_constraints : iterable of SymPy expressions, optional\n These expressions are for constraints on the states at specific\n times. They can be expressions with any state instance and any of\n the known parameters found in the equations of motion. All states\n should be evaluated at a specific instant of time. For example, the\n constraint ``x(0) = 5.0`` would be specified as ``x(0) - 5.0``. For\n variable duration problems you must specify time as an integer\n multiple of the node time interval symbol, for example ``x(0*h) -\n 5.0``. The integer must be a value from 0 to\n ``num_collocation_nodes - 1``. Unknown parameters and time varying\n parameters other than the states are currently not supported.\ntime_symbol : SymPy Symbol, optional\n The symbol representating time in the equations of motion. If not\n given, it is assumed to be the default stored in\n ``sympy.physics.vector.dynamicsymbols._t``.\ntmp_dir : string, optional\n If you want to see the generated Cython and C code for the\n constraint and constraint Jacobian evaluations, pass in a path to a\n directory here.\nintegration_method : string, optional\n The integration method to use, either ``backward euler`` or\n ``midpoint``.\nparallel : boolean, optional\n If true and openmp is installed, constraints and the Jacobian of\n the constraints will be executed across multiple threads. This is\n only useful for performance when the equations of motion have an\n extremely large number of operations.\nshow_compile_output : boolean, optional\n If True, STDOUT and STDERR of the Cython compilation call will be\n shown.\n\n"]
From Python 3.12:
ipdb> coll_doc
"Instantiates a ConstraintCollocator object.\n\n Parameters\n ==========\n equations_of_motion : sympy.Matrix, shape(n, 1)\n A column matrix of SymPy expressions defining the right hand side\n of the equations of motion when the left hand side is zero, e.g.\n ``0 = x'(t) - f(x(t), u(t), p)`` or ``0 = f(x'(t), x(t), u(t),\n p)``. These should be in first order form but not necessairly\n explicit. They can be ordinary differential equations or\n differential algebraic equations.\n state_symbols : iterable\n An iterable containing all ``n` of the SymPy functions of time\n which represent the states in the equations of motion.\n num_collocation_nodes : integer\n The number of collocation nodes, ``N``. All known trajectory arrays\n should be of this length.\n node_time_interval : float or Symbol\n The time interval between collocation nodes. If a SymPy symbol is\n provided, the time interval will be treated as a free variable\n resulting in a variable duration solution.\n known_parameter_map : dictionary, optional\n A dictionary that maps the SymPy symbols representing the known\n constant parameters to floats. Any parameters in the equations of\n motion not provided in this dictionary will become free\n optimization variables.\n known_trajectory_map : dictionary, optional\n A dictionary that maps the non-state SymPy functions of time to\n ndarrays of floats of ``shape(N,)``. Any time varying parameters in\n the equations of motion not provided in this dictionary will become\n free trajectories optimization variables. If solving a variable\n duration problem, note that the values here are fixed at each node\n and will not scale with a varying time interval.\n instance_constraints : iterable of SymPy expressions, optional\n These expressions are for constraints on the states at specific\n times. They can be expressions with any state instance and any of\n the known parameters found in the equations of motion. All states\n should be evaluated at a specific instant of time. For example, the\n constraint ``x(0) = 5.0`` would be specified as ``x(0) - 5.0``. For\n variable duration problems you must specify time as an integer\n multiple of the node time interval symbol, for example ``x(0*h) -\n 5.0``. The integer must be a value from 0 to\n ``num_collocation_nodes - 1``. Unknown parameters and time varying\n parameters other than the states are currently not supported.\n time_symbol : SymPy Symbol, optional\n The symbol representating time in the equations of motion. If not\n given, it is assumed to be the default stored in\n ``sympy.physics.vector.dynamicsymbols._t``.\n tmp_dir : string, optional\n If you want to see the generated Cython and C code for the\n constraint and constraint Jacobian evaluations, pass in a path to a\n directory here.\n integration_method : string, optional\n The integration method to use, either ``backward euler`` or\n ``midpoint``.\n parallel : boolean, optional\n If true and openmp is installed, constraints and the Jacobian of\n the constraints will be executed across multiple threads. This is\n only useful for performance when the equations of motion have an\n extremely large number of operations.\n show_compile_output : boolean, optional\n If True, STDOUT and STDERR of the Cython compilation call will be\n shown.\n\n "
ipdb> coll_doc.split('Parameters\n ==========\n ')
['Instantiates a ConstraintCollocator object.\n\n ', "equations_of_motion : sympy.Matrix, shape(n, 1)\n A column matrix of SymPy expressions defining the right hand side\n of the equations of motion when the left hand side is zero, e.g.\n ``0 = x'(t) - f(x(t), u(t), p)`` or ``0 = f(x'(t), x(t), u(t),\n p)``. These should be in first order form but not necessairly\n explicit. They can be ordinary differential equations or\n differential algebraic equations.\n state_symbols : iterable\n An iterable containing all ``n` of the SymPy functions of time\n which represent the states in the equations of motion.\n num_collocation_nodes : integer\n The number of collocation nodes, ``N``. All known trajectory arrays\n should be of this length.\n node_time_interval : float or Symbol\n The time interval between collocation nodes. If a SymPy symbol is\n provided, the time interval will be treated as a free variable\n resulting in a variable duration solution.\n known_parameter_map : dictionary, optional\n A dictionary that maps the SymPy symbols representing the known\n constant parameters to floats. Any parameters in the equations of\n motion not provided in this dictionary will become free\n optimization variables.\n known_trajectory_map : dictionary, optional\n A dictionary that maps the non-state SymPy functions of time to\n ndarrays of floats of ``shape(N,)``. Any time varying parameters in\n the equations of motion not provided in this dictionary will become\n free trajectories optimization variables. If solving a variable\n duration problem, note that the values here are fixed at each node\n and will not scale with a varying time interval.\n instance_constraints : iterable of SymPy expressions, optional\n These expressions are for constraints on the states at specific\n times. They can be expressions with any state instance and any of\n the known parameters found in the equations of motion. All states\n should be evaluated at a specific instant of time. For example, the\n constraint ``x(0) = 5.0`` would be specified as ``x(0) - 5.0``. For\n variable duration problems you must specify time as an integer\n multiple of the node time interval symbol, for example ``x(0*h) -\n 5.0``. The integer must be a value from 0 to\n ``num_collocation_nodes - 1``. Unknown parameters and time varying\n parameters other than the states are currently not supported.\n time_symbol : SymPy Symbol, optional\n The symbol representating time in the equations of motion. If not\n given, it is assumed to be the default stored in\n ``sympy.physics.vector.dynamicsymbols._t``.\n tmp_dir : string, optional\n If you want to see the generated Cython and C code for the\n constraint and constraint Jacobian evaluations, pass in a path to a\n directory here.\n integration_method : string, optional\n The integration method to use, either ``backward euler`` or\n ``midpoint``.\n parallel : boolean, optional\n If true and openmp is installed, constraints and the Jacobian of\n the constraints will be executed across multiple threads. This is\n only useful for performance when the equations of motion have an\n extremely large number of operations.\n show_compile_output : boolean, optional\n If True, STDOUT and STDERR of the Cython compilation call will be\n shown.\n\n "]
In the Python 3.13 changes https://docs.python.org/3/whatsnew/3.13.html#other-language-changes it says:
The compiler now strips common leading whitespace from every line in a docstring.
which seems backwards incompatible.
The change was here: https://github.com/python/cpython/issues/81283 and there seems to be lots of other downstream code breaking because of it.
The 3.13 builds failed on conda forge, see https://github.com/conda-forge/opty-feedstock/pull/33
This is the traceback:
and it seems that this split() call isn't working: