Skip to content

Commit

Permalink
Drop Python 2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Dec 12, 2024
1 parent 84ea117 commit ced187b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 36 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ directory of your tutorial. For the `main` branch of your tutorial, use
For other branches such as `develop`, use `github-develop.yml` instead.

The `build.yml` config file will ensure the tutorial tests
get run every time the tutorial is changed (pushed to GitHub) using both
Python 2 and Python 3, and for the current IMP nightly build and also the
latest stable release (if applicable).
get run every time the tutorial is changed (pushed to GitHub) for the current
IMP nightly build and also the latest stable release (if applicable).

## Tutorial text

Expand Down
5 changes: 1 addition & 4 deletions doxygen/make-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
import glob
import re
import argparse
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
from urllib.request import urlopen

# Latest IMP stable release
IMP_STABLE_RELEASE = '2.22.0'
Expand Down
4 changes: 0 additions & 4 deletions github-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:
os: [ubuntu-latest]
python-version: ["3.12"]
imp-branch: [main, develop]
include:
- os: [ubuntu-latest]
python-version: "2.7"
imp-branch: main
runs-on: ${{ matrix.os }}

steps:
Expand Down
4 changes: 0 additions & 4 deletions github-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:
os: [ubuntu-latest]
python-version: ["3.12"]
imp-branch: [main, develop]
include:
- os: [ubuntu-latest]
python-version: "2.7"
imp-branch: main
runs-on: ${{ matrix.os }}

steps:
Expand Down
15 changes: 4 additions & 11 deletions setup_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,12 @@ else
fi

if [ ${python_version} = "2.7" ]; then
pip="pip<=19.3.1"
else
pip="pip"
echo "IMP no longer supports Python 2; please fix your workflow"
exit 1
fi

conda create --yes -q -n python${python_version} -c salilab python=${python_version} scipy matplotlib ${pip} ${IMP_CONDA}
conda create --yes -q -n python${python_version} -c salilab python=${python_version} scipy matplotlib pip ${IMP_CONDA}
eval "$(conda shell.bash hook)"
conda activate python${python_version}

if [ ${python_version} = "2.7" ]; then
# pytest-flake8 1.1.0 tries to import contextlib.redirect_stdout, which
# isn't present in Python 2
pip install pytest-cov coverage 'pytest-flake8<1.1'
else
pip install pytest-cov coverage pytest-flake8
fi
pip install pytest-cov coverage pytest-flake8
16 changes: 6 additions & 10 deletions test/test_make_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@
TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

def import_make_docs():
import importlib.util
make_docs = os.path.join(TOPDIR, "doxygen", "make-docs.py")
name = os.path.splitext(make_docs)[0]
try:
import importlib.util
spec = importlib.util.spec_from_file_location(name, make_docs)
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
spec.loader.exec_module(module)
return module
except ImportError:
import imp
return imp.load_source(name, make_docs)
spec = importlib.util.spec_from_file_location(name, make_docs)
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
spec.loader.exec_module(module)
return module

# Python script to simulate running doxygen
DOXYGEN = """
Expand Down

0 comments on commit ced187b

Please sign in to comment.