Skip to content

Python 3.14 support - #1287

Merged
moreati merged 3 commits into
mitogen-hq:masterfrom
moreati:issue1242-py3.14
Sep 18, 2025
Merged

moreati merged 3 commits into
mitogen-hq:masterfrom
moreati:issue1242-py3.14

Conversation

@moreati

@moreati moreati commented Jun 19, 2025

Copy link
Copy Markdown
Member

refs #1242

@moreati
moreati force-pushed the issue1242-py3.14 branch from d4c74ba to 076d9a2 Compare June 19, 2025 09:07
@moreati

moreati commented Jun 19, 2025

Copy link
Copy Markdown
Member Author
py314-mode_ansible-ansible12-strategy_linear: install_deps> python -m pip --no-python-version-warning --disable-pip-version-check install 'ansible!=12.0a6' 'ansible-core!=2.19b6' 'ansible>=12.0a' -r /home/runner/work/mitogen/mitogen/tests/requirements.txt -r /home/runner/work/mitogen/mitogen/tests/ansible/requirements.txt
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [4 lines of output]
      <string>:67: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      Building lxml version 5.4.0.
      Building without Cython.
      Error: Please make sure the libxml2 and libxslt development packages are installed.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

-- https://github.com/mitogen-hq/mitogen/actions/runs/15754060599/job/44405373517

This was running on Ubuntu 24.04. lxml 5.4.0 is the latest on PyPI, there are no prebuilt Python 3.14 wheels yet.

@moreati

moreati commented Aug 5, 2025

Copy link
Copy Markdown
Member Author

lxml sppears to be pulled in by ncclient in

ncclient==0.6.13; python_version <= '2.7'
ncclient==0.6.16; python_version > '2.7'

@moreati

moreati commented Aug 6, 2025 •

Copy link
Copy Markdown
Member Author

Python 3.14 bytecode has changed in a way that affects import detection in mitogen.master.scan_code_imports(). Possible approaches (non exhaustive)

  • Update existing bytecode scanning
  • Switch to ast (on Python >= 2.6), removin a CPython-ism from Mitogen, bringing us a step closer to PyPy et al compatibility.
  • Switch to tokenize and possibly combine with mitogen.minify plumbing.
  • Remove import detection? Switch from mostly push strategy (parent sends modules before child attempts the import), to purely pull (child import triggers request, module sent on demand)
    • May break ansible_mitogen module_utils plumbing, particularly on Ansible 12 which closes connection earlier.

Possibly a good opportunity to revisit #733

@moreati
moreati force-pushed the issue1242-py3.14 branch 9 times, most recently from ec86adc to bd62936 Compare August 7, 2025 12:13
@moreati

moreati commented Aug 8, 2025

Copy link
Copy Markdown
Member Author

I'm currently inclined to stick with dis and bytecode scanning. The other approaches show some promise, but their scope quickly balloons and they introduce behaviour changes I'd prefer not to bundle in.

@moreati
moreati force-pushed the issue1242-py3.14 branch 3 times, most recently from 0785ff4 to 9ad0f12 Compare August 10, 2025 00:48
@moreati moreati changed the title Python 3.14 trials Python 3.14 support Aug 10, 2025
@moreati
moreati force-pushed the issue1242-py3.14 branch 3 times, most recently from 4ecb3e9 to a9901b9 Compare August 22, 2025 23:44
@moreati
moreati force-pushed the issue1242-py3.14 branch 3 times, most recently from 8b47e9a to 67a5210 Compare August 23, 2025 00:40
@moreati
moreati force-pushed the issue1242-py3.14 branch 7 times, most recently from c8dfd44 to a4fe240 Compare September 18, 2025 12:27
@moreati
moreati marked this pull request as ready for review September 18, 2025 17:27
@moreati
moreati merged commit f6451bf into mitogen-hq:master Sep 18, 2025
@moreati
moreati deleted the issue1242-py3.14 branch September 18, 2025 17:44
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