Skip to content

Commit

Permalink
Drop Python 3.6 and 3.7 support, add 3.12 (#2121)
Browse files Browse the repository at this point in the history
* Fix python python 3.12: use shutil instead of removed distuil to copy tree with time and mode unpreserved

* [automated] Update CHANGELOG.md

* Remove more disutils from modules

* Replace more distutil.copy_tree with shutil.copytree

* Fix overriding parent template

* [automated] Update CHANGELOG.md

* [automated] Fix code linting

* Move strtobool into utils

* Fix

* Bundle lzstring to fix Python 3.12

* [automated] Update CHANGELOG.md

* [automated] Update CHANGELOG.md

* Same style of bundling packages

* dirs_exist_ok missing for Py 3.6 and 3.7

* Drop Python 3.6 and 3.7 support, add 3.12

* [automated] Update CHANGELOG.md

---------

Co-authored-by: MultiQC Bot <multiqc-bot@seqera.io>
Co-authored-by: Phil Ewels <phil.ewels@seqera.io>
  • Loading branch information
3 people committed Oct 16, 2023
1 parent ffc7421 commit 38af35e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/multiqc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
# To reduce code duplication between Win and Linux jobs
core_python_dependencies: "pip setuptools beautifulsoup4"
# No need to run test variations across all Python versions
latest_python: "3.11"
latest_python: "3.12"

jobs:
changes:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
strategy:
matrix:
# Just test the oldest and newest supported Python versions
python-version: ["3.6", "3.11"]
python-version: ["3.8", "3.12"]
timeout-minutes: 10

steps:
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11"
python-version: "3.12"

# Update core packages
- name: Install dependencies for CI tests
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Fix adding changelog entries with backticks from PR titles ([#2115](https://github.com/ewels/MultiQC/pull/2115))
- Fix for python 3.12: replace removed `distutils` ([#2113](https://github.com/ewels/MultiQC/pull/2113))
- Bundle lzstring to fix Python 3.12 ([#2119](https://github.com/ewels/MultiQC/pull/2119))
- Drop Python 3.6 and 3.7 support, add 3.12 ([#2121](https://github.com/ewels/MultiQC/pull/2121))
- <img src="./multiqc/templates/default/assets/img/favicon-16x16.png" alt="///" width="10px"/> New logo

### New Modules
Expand Down
5 changes: 3 additions & 2 deletions multiqc/multiqc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,8 +1049,9 @@ def __rich_measure__(self, console: rich.console.Console, options: rich.console.
except AttributeError:
pass # Not a child theme

# Copy the template files to the tmp directory
util_functions.copytree_overwrite(template_mod.template_dir, tmp_dir)
# Copy the template files to the tmp directory (`dirs_exist_ok` makes sure
# parent template files are overwritten)
shutil.copytree(template_mod.template_dir, tmp_dir, dirs_exist_ok=True)

# Function to include file contents in Jinja template
def include_file(name, fdir=tmp_dir, b64=False):
Expand Down
15 changes: 0 additions & 15 deletions multiqc/utils/util_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,3 @@ def strtobool(val):
return 0
else:
raise ValueError("invalid truth value %r" % (val,))


def copytree_overwrite(parent_dir, child_dir):
"""
Replicates the behaviour of `shutil.copytree(..., dirs_exist_ok=True)` (which is
not available before Python 3.8) to overwrite files in `parent_dir` with files
in `child_dir`.
"""
# Copy files from src to dst that already exist in dst (i.e., overwrite them)
for dir_name, sub_dirs, filenames in os.walk(parent_dir):
for filename in filenames:
src_file_path = os.path.join(dir_name, filename)
dst_file_path = os.path.join(child_dir, os.path.relpath(src_file_path, parent_dir))
os.makedirs(os.path.dirname(dst_file_path), exist_ok=True)
shutil.copy2(src_file_path, dst_file_path)

0 comments on commit 38af35e

Please sign in to comment.