Skip to content

Replace past.utils.old_div with true division - #42

Merged
cekees merged 1 commit into
mainfrom
remove-old-div
Oct 12, 2026
Merged

cekees merged 1 commit into
mainfrom
remove-old-div

Conversation

@cekees

@cekees cekees commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Removes the last use of the future compatibility package. proteus/richards/ADR.py imported past.utils.old_div, but proteus never declared future as a dependency (not in pyproject.toml, not in the conda-forge recipe). This came up in review of spack/spack-packages#6000.

  • proteus/richards/ADR.py: 7 old_div calls replaced with /. Every operand is a float (maxCFL >= 1e-6, float literals, the float element-diameter array), so the results are identical.
  • scripts/marinExtractHeight.py: called old_div without importing it (NameError); now uses / on the values it already casts to float.
  • Removed commented-out past.utils imports in richards/Richards.py and m_comp_co2/m_comp_co2.py.

from builtins import ... elsewhere is the Python 3 stdlib module and is unaffected.

Note: proteus.richards.ADR still cannot be imported after this change, because it does from .cADR import * and setup.py builds only the top-level proteus.cADR, not a proteus.richards.cADR. No test exercises it (only test/richards/adr_1d_p.py imports it). Out of scope here; tracked in erdc#1285.

Testing: py_compile on the four files, and git grep old_div|past.utils is empty.

🤖 Generated with Claude Code

proteus/richards/ADR.py was the only module still importing the
`future` compatibility package (past.utils.old_div), which proteus
never declared as a dependency. Every operand at the replaced call
sites is a float, so `/` is equivalent. Also drop two commented-out
imports and fix scripts/marinExtractHeight.py, which called old_div
without importing it.

`from builtins import ...` elsewhere is the Python 3 stdlib module and
does not need `future`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cekees
cekees merged commit e41b5fd into main Oct 12, 2026
5 checks passed
@cekees
cekees deleted the remove-old-div branch October 12, 2026 17:33
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.

1 participant