Skip to content

Import on Python 3.12 generates syntax warnings that will fail in the future #17

@rmpinchback

Description

@rmpinchback

Expected Behavior

For "import pydtmc" to just quietly succeed.

Current Behavior

The following message is printed after import (where '$PROJECTDIR' is just eliminated noise on the base directory):

$PROJECTDIR.venv\Lib\site-packages\pydtmc\markov_chain.py:1624: SyntaxWarning: invalid escape sequence '\g'
| :math:p_{new} = (1 - \gamma) p_{current} + \gamma p_{other}
$PROJECTDIR.venv\Lib\site-packages\pydtmc\utilities.py:174: SyntaxWarning: invalid escape sequence '\m'
models_names = [f'$\mathregular{{{models_label}_{index + 1}}}$' for index, model in enumerate(models)]
$PROJECTDIR.venv\Lib\site-packages\pydtmc\plotting.py:1423: SyntaxWarning: invalid escape sequence '\m'
headers = ["$\mathregular{T_0}$"] + [hmm.symbols[symbol] for symbol in gts_symbols[1:]]

Steps to Reproduce

  1. Install Python 3.12
  2. Add "pydtmc==8.7.0" to a requirements file and install.
  3. import pydtmc

Environment

Python 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)] on win32

  • Application Version:

pydtmc==8.7.0

  • Operating System:

win32

Possible Solution

I believe this indicates that a level of backslashing is missing from a string, so that needs fixing or perhaps just prefixing a string to indicate it is raw.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions