Skip to content

Fix warnings in ci#314

Merged
leeping merged 20 commits intoleeping:masterfrom
lilyminium:fix-warnings-in-ci
Mar 7, 2026
Merged

Fix warnings in ci#314
leeping merged 20 commits intoleeping:masterfrom
lilyminium:fix-warnings-in-ci

Conversation

@lilyminium
Copy link
Copy Markdown
Collaborator

Outdated strings and imports are causing a ton of warnings in CI -- this PR fixes them.

Most of the changes are changing strings to raw strings. This is rebased off of #312 -- only the most recent commit is relevant.

e.g. the below from a run in master:



<unknown>:573: DeprecationWarning: invalid escape sequence '\['
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/abinitio.py:573: DeprecationWarning: invalid escape sequence '\['
  """
<unknown>:251: DeprecationWarning: invalid escape sequence '\.'
<unknown>:658: DeprecationWarning: invalid escape sequence '\.'
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/amberio.py:251: DeprecationWarning: invalid escape sequence '\.'
  block_split = re.findall("[A-Za-z0-9_]+ *= *(?:\'[^']*\'|[+-]?[0-9]+\.?[0-9]*),", block_string)
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/amberio.py:658: DeprecationWarning: invalid escape sequence '\.'
  FORMAT_RE_PATTERN=re.compile("([0-9]+)([a-zA-Z]+)([0-9]+)\.?([0-9]*)")
<unknown>:53: DeprecationWarning: invalid escape sequence '\$'
<unknown>:54: DeprecationWarning: invalid escape sequence '\$'
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/binding.py:53: DeprecationWarning: invalid escape sequence '\$'
  if re.match('^\$',line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/binding.py:54: DeprecationWarning: invalid escape sequence '\$'
  word = re.sub('^\$','',line).upper()
<unknown>:79: DeprecationWarning: invalid escape sequence '\.'
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/counterpoise.py:79: DeprecationWarning: invalid escape sequence '\.'
  elif match('[A-Z][a-z]*( +[-+]?([0-9]*\.[0-9]+|[0-9]+)){3}$',strip):
<unknown>:62: DeprecationWarning: invalid escape sequence '\['
<unknown>:64: DeprecationWarning: invalid escape sequence '\['
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/custom_io.py:62: DeprecationWarning: invalid escape sequence '\['
  if match('^\[.*\]',line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/custom_io.py:64: DeprecationWarning: invalid escape sequence '\['
  self.sec = sub('[\[\] \n]','',line)
<unknown>:1500: DeprecationWarning: invalid escape sequence '\['
<unknown>:1502: DeprecationWarning: invalid escape sequence '\['
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/forcefield.py:1500: DeprecationWarning: invalid escape sequence '\['
  matches = re.findall("\[['\"][^'\"]*['\"]\]", cmd)
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/forcefield.py:1502: DeprecationWarning: invalid escape sequence '\['
  src_param_name = re.sub("\[['\"]|['\"]\]", "", word)
<unknown>:412: DeprecationWarning: invalid escape sequence '\['
<unknown>:414: DeprecationWarning: invalid escape sequence '\['
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/gmxio.py:412: DeprecationWarning: invalid escape sequence '\['
  if re.match('^ *\[.*\]',line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/gmxio.py:414: DeprecationWarning: invalid escape sequence '\['
  self.sec = re.sub('[\[\] \n]','',line.strip())
<unknown>:240: DeprecationWarning: invalid escape sequence '\P'
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/optimizer.py:240: DeprecationWarning: invalid escape sequence '\P'
  warn_press_key("mvals.txt in %s does not match loaded parameters.\nSave file : %s\Parameters : %s\n" % (T.absrd(), tmvals, self.mvals0))
<unknown>:59: DeprecationWarning: invalid escape sequence '\['
<unknown>:68: DeprecationWarning: invalid escape sequence '\['
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/output.py:59: DeprecationWarning: invalid escape sequence '\['
  message = re.sub("\x1b\[[0-9][0-9]?;?[0-9]?[0-9]?m", "", message)
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/output.py:68: DeprecationWarning: invalid escape sequence '\['
  message = re.sub("\x1b\[[0-9][0-9]?;?[0-9]?[0-9]?m", "", message)
<unknown>:332: DeprecationWarning: invalid escape sequence '\$'
<unknown>:340: DeprecationWarning: invalid escape sequence '\$'
<unknown>:349: DeprecationWarning: invalid escape sequence '\$'
<unknown>:454: DeprecationWarning: invalid escape sequence '\e'
<unknown>:501: DeprecationWarning: invalid escape sequence '\$'
<unknown>:502: DeprecationWarning: invalid escape sequence '\$'
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/parser.py:332: DeprecationWarning: invalid escape sequence '\$'
  if re.match("(/read_mvals)|(^\$end)",line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/parser.py:340: DeprecationWarning: invalid escape sequence '\$'
  if re.match("(/read_pvals)|(^\$end)",line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/parser.py:349: DeprecationWarning: invalid escape sequence '\$'
  if re.match("(/priors)|(^\$end)",line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/parser.py:454: DeprecationWarning: invalid escape sequence '\e'
  """ Parse through the input file and read all user-supplied options.
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/parser.py:501: DeprecationWarning: invalid escape sequence '\$'
  if re.match('^\$',line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/parser.py:502: DeprecationWarning: invalid escape sequence '\$'
  newsection = re.sub('^\$','',line).upper()
<unknown>:55: DeprecationWarning: invalid escape sequence '\$'
<unknown>:57: DeprecationWarning: invalid escape sequence '\$'
<unknown>:62: DeprecationWarning: invalid escape sequence '\.'
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/qchemio.py:55: DeprecationWarning: invalid escape sequence '\$'
  if match('^\$',line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/qchemio.py:57: DeprecationWarning: invalid escape sequence '\$'
  self.sec = sub('^\$','',line)
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/qchemio.py:62: DeprecationWarning: invalid escape sequence '\.'
  elif match('^[SPDFGH]P? +[0-9]+ +1\.0+$',line):
<unknown>:31: DeprecationWarning: invalid escape sequence '\.'
<unknown>:155: DeprecationWarning: invalid escape sequence '\.'
<unknown>:231: DeprecationWarning: invalid escape sequence '\s'
<unknown>:238: DeprecationWarning: invalid escape sequence '\s'
<unknown>:243: DeprecationWarning: invalid escape sequence '\s'
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/readfrq.py:31: DeprecationWarning: invalid escape sequence '\.'
  if re.match("^[0-9]+ +[0-9]+ +[0-9]+( +[-+]?([0-9]*\.)?[0-9]+){3}$", line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/readfrq.py:155: DeprecationWarning: invalid escape sequence '\.'
  if re.match("^[0-9]+ +[A-Z][A-Za-z]?( +[-+]?([0-9]*\.)?[0-9]+){3}$", line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/readfrq.py:231: DeprecationWarning: invalid escape sequence '\s'
  if re.match('^\s*[0-9]', line) and mode_num >= skip_modes:
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/readfrq.py:238: DeprecationWarning: invalid escape sequence '\s'
  elif re.match('^\s*[0-9]', line):
/Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/readfrq.py:243: DeprecationWarning: invalid escape sequence '\s'
  elif re.match('^[ \t\r\n\s]*$', line):
src/tests/test_tinkerio.py::TestInteraction_TINKER::test_get_agrad PASSED [100%]

=============================== warnings summary ===============================
src/parser.py:332
  /Users/runner/work/forcebalance/forcebalance/src/parser.py:332: DeprecationWarning: invalid escape sequence '\$'
    if re.match("(/read_mvals)|(^\$end)",line):

src/parser.py:340
  /Users/runner/work/forcebalance/forcebalance/src/parser.py:340: DeprecationWarning: invalid escape sequence '\$'
    if re.match("(/read_pvals)|(^\$end)",line):

src/parser.py:349
  /Users/runner/work/forcebalance/forcebalance/src/parser.py:349: DeprecationWarning: invalid escape sequence '\$'
    if re.match("(/priors)|(^\$end)",line):

src/parser.py:454
  /Users/runner/work/forcebalance/forcebalance/src/parser.py:454: DeprecationWarning: invalid escape sequence '\e'
    """ Parse through the input file and read all user-supplied options.

src/parser.py:501
  /Users/runner/work/forcebalance/forcebalance/src/parser.py:501: DeprecationWarning: invalid escape sequence '\$'
    if re.match('^\$',line):

src/parser.py:502
  /Users/runner/work/forcebalance/forcebalance/src/parser.py:502: DeprecationWarning: invalid escape sequence '\$'
    newsection = re.sub('^\$','',line).upper()

src/nifty.py:866
  /Users/runner/work/forcebalance/forcebalance/src/nifty.py:866: DeprecationWarning: 'import work_queue' is deprecated. Please instead use: 'import ndcctools.work_queue'
    import work_queue

src/forcefield.py:1500
  /Users/runner/work/forcebalance/forcebalance/src/forcefield.py:1500: DeprecationWarning: invalid escape sequence '\['
    matches = re.findall("\[['\"][^'\"]*['\"]\]", cmd)

src/forcefield.py:1502
  /Users/runner/work/forcebalance/forcebalance/src/forcefield.py:1502: DeprecationWarning: invalid escape sequence '\['
    src_param_name = re.sub("\[['\"]|['\"]\]", "", word)

src/optimizer.py:240
  /Users/runner/work/forcebalance/forcebalance/src/optimizer.py:240: DeprecationWarning: invalid escape sequence '\P'
    warn_press_key("mvals.txt in %s does not match loaded parameters.\nSave file : %s\Parameters : %s\n" % (T.absrd(), tmvals, self.mvals0))

src/output.py:59
  /Users/runner/work/forcebalance/forcebalance/src/output.py:59: DeprecationWarning: invalid escape sequence '\['
    message = re.sub("\x1b\[[0-9][0-9]?;?[0-9]?[0-9]?m", "", message)

src/output.py:68
  /Users/runner/work/forcebalance/forcebalance/src/output.py:68: DeprecationWarning: invalid escape sequence '\['
    message = re.sub("\x1b\[[0-9][0-9]?;?[0-9]?[0-9]?m", "", message)

src/tests/__init__.py:9
  /Users/runner/work/forcebalance/forcebalance/src/tests/__init__.py:9: DeprecationWarning: invalid escape sequence '\.'
    if re.match("^test_.*\.py$",module)]

src/tests/test_objective.py:26
  /Users/runner/work/forcebalance/forcebalance/src/tests/test_objective.py:26: DeprecationWarning: invalid escape sequence '\.'
    if re.compile(".*\.py$").match(module)

src/tests/test_smirnoff_hack.py::test_smirnoff_hack
  /Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/openff/interchange/smirnoff/_create.py:142: UserWarning: Automatically up-converting BondHandler from version 0.3 to 0.4. Consider manually upgrading this BondHandler (or <Bonds> section in an OFFXML file) to 0.4 or newer. For more details, see https://openforcefield.github.io/standards/standards/smirnoff/#bonds.
    _upconvert_bondhandler(force_field["Bonds"])

src/tests/test_system.py: 176 warnings
  /Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/optimizer.py:810: DeprecationWarning: scipy.optimize: The `disp` and `iprint` options of the L-BFGS-B solver are deprecated and will be removed in SciPy 1.18.0.
    Opt1 = optimize.fmin_l_bfgs_b(HYP.compute_val,dx0,fprime=HYP.compute_grad,m=30,factr=1e7,pgtol=1e-4,iprint=-1,disp=0,maxfun=1e5,maxiter=1e5)

src/tests/test_system.py: 176 warnings
  /Users/runner/micromamba/envs/forcebalance-test/lib/python3.11/site-packages/forcebalance/optimizer.py:816: DeprecationWarning: scipy.optimize: The `disp` and `iprint` options of the L-BFGS-B solver are deprecated and will be removed in SciPy 1.18.0.
    Opt2 = optimize.fmin_l_bfgs_b(HYP.compute_val,-xkd,fprime=HYP.compute_grad,m=30,factr=1e7,pgtol=1e-4,iprint=-1,disp=0,maxfun=1e5,maxiter=1e5)

lilyminium and others added 20 commits February 26, 2026 11:27
_Multiprocessor.run() uses multiprocessing.Manager() + Process() to
run each calculation task in a subprocess. When called from the Dask
worker thread pool (which runs Tornado's async event loop), fork() on
Python 3.9/3.10 inherits locked mutexes from sibling threads and
deadlocks. The server then crashes after accepting the first job
submission, causing ConnectionRefusedError on the next client poll.

Setting openff.evaluator._called_from_test = True in run_server.py
activates the existing bypass path in _Multiprocessor.run() that
calls the function directly in the current thread instead of spawning
a subprocess. This is the mechanism the evaluator itself uses for CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread src/optimizer.py
# Opt2 = optimize.fmin_bfgs(HYP.compute_val,-xkd,fprime=HYP.compute_grad,gtol=1e-5*np.sqrt(len(dx0)),full_output=True,disp=1)
# Opt2 = optimize.fmin_l_bfgs_b(HYP.compute_val,-xkd,fprime=HYP.compute_grad,m=30,factr=1e7,pgtol=1e-4,iprint=0,disp=1,maxfun=1e5,maxiter=1e5)
Opt2 = optimize.fmin_l_bfgs_b(HYP.compute_val,-xkd,fprime=HYP.compute_grad,m=30,factr=1e7,pgtol=1e-4,iprint=-1,disp=0,maxfun=1e5,maxiter=1e5)
Opt2 = optimize.fmin_l_bfgs_b(HYP.compute_val,-xkd,fprime=HYP.compute_grad,m=30,factr=1e7,pgtol=1e-4,maxfun=int(1e5),maxiter=int(1e5))
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To handle the below:

DeprecationWarning: scipy.optimize: The disp and
iprint options of the L-BFGS-B solver are deprecated and will be removed in SciPy 1.18.0.
Opt1 = optimize.fmin_l_bfgs_b(HYP.compute_val,dx0,fprime=HYP.compute_grad,m=30,factr=1e7,pgtol=1e-4,iprint=-1,disp=0,maxfun=1e5,maxiter=1e5)

From the scipy docs, disp and iprint used to control printing:

disp: None or int

Deprecated option that previously controlled the text printed on the screen during the problem solution. Now the code does not emit any output and this keyword has no function.

iprint: int, optional

Deprecated option that previously controlled the text printed on the screen during the problem solution. Now the code does not emit any output and this keyword has no function

Comment thread src/abinitio.py
Comment on lines +609 to +617
\\[ = {W_E}\\left[ {\\frac{{{\\sum\\limits_{i \\in {N_s}}
{{w_i}{{\\left( {E_i^{MM} - E_i^{QM}}
- \\left( {{{\\bar E}^{MM}} - {{\\bar E}^{QM}}} \\right) \\right)}^2}}}}}
{{\\sum\\limits_{i \\in {N_s}} {{w_i}{{\\left(
{E_i^{QM} - {{\\bar E}^{QM}}} \\right)}^2}} }}} \\right] +
{W_F}\\left[ {\\frac{{\\sum\\limits_{i \\in {N_s}} {{w_i}\\sum\\limits_{a \\in {N_a}}
{{{\\left| {{\\bf{F}}_{i,a}^{MM} - {\\bf{F}}_{i,a}^{QM}} \\right|}^2}} } }}
{{\\sum\\limits_{i \\in {N_s}} {{w_i}\\sum\\limits_{a \\in {N_a}}
{{{\\left| {{\\bf{F}}_{i,a}^{QM}} \\right|}^2}} } }}} \\right]\\]
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just needed more escaping of the latex code -- I didn't use a raw string here because it's in the middle of a longer docstring

@leeping leeping merged commit 48d875b into leeping:master Mar 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants