Skip to content

Conversation

@bernhardkaindl
Copy link
Contributor

@bernhardkaindl bernhardkaindl commented Sep 24, 2025

Switch from using Python 2.7 to Python 3.6 on XenServer 8.4:

  • Switch the Python shebang to use Python 3.6 on XS 8.4
    • XS9 only has Python 3.11 (and bugtool has run on XS9 since February 2024)
  • Update pyproject.toml from >=2.7 to >=3.6
  • Update README.md
  • Update doc/pre-commit.md
  • Remove the Python 2 tests
  • Convert the Container-based tests to use Python 3

Reviewer's Guide

File-Level Changes

Change Details Files
Switches script entrypoint to Python 3
  • Replaced shebang with “#!/usr/bin/env python3”
xen-bugtool
Updates documentation to drop Python 2 support and explain the migration
  • Rewrote FAQ sections to remove Python2 details
  • Added stability/test coverage notes for Python 3
  • Outlined implementation steps for the Python3 switch
README.md
doc/pre-commit.md
Removed Python 2 test runs in CI
  • Removed Python2 job from GitHub Actions workflow
.github/workflows/ci.yml

How stable and well-tested is the Python3 support in xen-bugtool?

  • It is completely stable and well-tested on XS9:
    • The last Python3 issue was fixed on 25 March 2024, and since then, there have been no further Python3 issues.
  • The test suite runs with very high code coverage on both Python 2 and Python 3 and is run on every commit by GitHub Actions.

Is Python 2 support still needed?

No. As regular support for XenServer 8.2 has ended, and there are no plans to backport big changes to XenServer 8.2, Python 2 support is no longer needed.

Why was Python 2 support kept for so long?

In the case of backporting complex changes to XenServer 8.2, using Python 2 on XenServer 8.4 provided confidence that Python 2 support was still functioning.

But this aspect is no longer a concern since the end-of-life of XS 8.2.

What are the benefits of dropping Python 2 support?

  • Switching xen-bugtool to Python3 on XenServer 8.4 too should de-risk it from
    breaking its Python2 support accidentally when making changes to xen-bugtool:

  • As developers now use Python3, the risk of accidentally breaking Python2 support
    exists. With Python 2 support dropped, this risk is gone.

  • Also, more friendly Python3 features become available:

    • contextlib context manager suppress instead of try-except or try-finally.
    • f-strings instead of the older % formatting and "str1" + "str1", etc.
    • pathlib instead of os.path
    • Type annotations that can use type aliases for better readability

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR transitions the xen-bugtool project from supporting both Python 2.7 and Python 3 to Python 3.6+ only, targeting deployment on XenServer 8.4 and later versions.

Key changes:

  • Updates the main script shebang to use Python 3
  • Removes Python 2 test infrastructure from CI workflows
  • Updates project configuration and documentation to reflect Python 3.6+ requirement

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
xen-bugtool Changed shebang from python to python3
tests/integration/xenserver-config-systemd.sh Updated default Python version and removed Python 2 references
tests/integration/sar-file-collection.test.sh Updated default Python version and fixed typo
pyproject.toml Updated Python version requirement from >=2.7 to >=3.6 with exclusions
doc/pre-commit.md Updated documentation to reflect Python 3 focus
README.md Rewrote FAQ sections to explain Python 3 migration and benefits
.github/workflows/main.yml Removed Python 2 test job and updated container tests to use Python 3

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@bernhardkaindl bernhardkaindl force-pushed the switch-shebang-to-use-python3-on-xs84-as-well branch from 37cea4b to ce73e45 Compare September 24, 2025 07:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@bernhardkaindl bernhardkaindl force-pushed the switch-shebang-to-use-python3-on-xs84-as-well branch from ce73e45 to dfdd718 Compare September 24, 2025 07:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@bernhardkaindl
Copy link
Contributor Author

Split into PRs 157, 158, 159, and 160

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