Skip to content

Commit

Permalink
Drop Python 3.7 support and upgrade dependencies (#350)
Browse files Browse the repository at this point in the history
## Description

<!-- Provide a brief description of the PR's purpose here. -->

Python 3.7 is now end of life; thus v0.6.0 will drop support for it.
Note that most dependencies can remain the same since the versions we
depend on support Python 3.7 and up, which includes Python 3.8.

## TODO

<!-- Notable points that this PR has either accomplished or will
accomplish. -->

- [x]  Upgrade all CI to use at least python 3.8
- [x]  Update tags in [setup.py](http://setup.py/)
- [x]  Update documentation to only start at python 3.8
- [x] Upgrade scikit learn to 1.1.0 as we had a breaking change that we
had to account for in cvt archive. This upgrade is feasible since scikit
learn 1.1.0 requires Python 3.8+. This upgrade also allows us to remove
semantic version as a dependency.
- [x] Upgrade pinned reqs for visualize test to closely match the
versions we develop with. This also necessitates updating the baseline
images.

### Website

- [x]  Update website to mention supporting python 3.8 and up

## Questions

<!-- Any concerns or points of confusion? -->

## Status

- [x] I have read the guidelines in
[CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md)
- [x] I have formatted my code using `yapf`
- [x] I have tested my code by running `pytest`
- [x] I have linted my code with `pylint`
- [x] I have added a one-line description of my change to the changelog
in `HISTORY.md`
- [x] This PR is ready to go
  • Loading branch information
btjanaka committed Sep 2, 2023
1 parent dbcf604 commit daeae2e
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 37 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ jobs:
max-parallel: 12 # All in parallel.
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
exclude:
# To cut down on runtime since Mac seems to take the longest.
- os: macos-latest
python-version: "3.8"
- os: macos-latest
python-version: "3.9"
- os: macos-latest
Expand All @@ -45,10 +43,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.8"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install core deps
Expand All @@ -64,10 +62,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.8"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install deps
Expand All @@ -80,10 +78,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.8"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install deps
Expand All @@ -94,10 +92,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.8"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install deps
Expand Down Expand Up @@ -139,10 +137,10 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.8"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Ready to contribute? Here's how to set up pyribs for local development.

```bash
cd pyribs
conda create --prefix ./env python=3.7 # 3.7 is the minimum version pyribs supports.
conda create --prefix ./env python=3.8 # 3.8 is the minimum version pyribs supports.
conda activate ./env
pip install -e .[dev]
```
Expand Down Expand Up @@ -116,7 +116,7 @@ Before submitting a pull request, check that it meets these guidelines:
1. The pull request should include tests.
1. If the pull request adds functionality, corresponding docstrings and other
documentation should be updated.
1. The pull request should work for Python 3.7 and higher. GitHub Actions will
1. The pull request should work for Python 3.8 and higher. GitHub Actions will
display test results at the bottom of the pull request page. Check there for
test results.

Expand Down
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### Changelog

#### API

- Drop Python 3.7 support and upgrade dependencies (#350)

#### Documentation

- Use dask instead of multiprocessing for lunar lander tutorial (#346)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ For more information, refer to the [documentation](https://docs.pyribs.org/).

## Installation

pyribs supports Python 3.7 and above. Earlier Python versions may work but are
pyribs supports Python 3.8 and above. Earlier Python versions may work but are
not officially supported. To find the installation command for your system
(including for installing from source), visit the
[installation selector](https://pyribs.org/#installation) on our website.
Expand Down
2 changes: 1 addition & 1 deletion pinned_reqs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pinned Requirements

This directory contains pinned requirements for testing pyribs on Python >= 3.7.
This directory contains pinned requirements for testing pyribs on Python >= 3.8.
In general, the requirements are as close to the minimum version from `setup.py`
as possible.
17 changes: 14 additions & 3 deletions pinned_reqs/extras_visualize.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# The reference images in the repo were created with Matplotlib 3.5.1 -- images
# created with earlier versions are slightly different.
matplotlib==3.5.1
# The reference images in the repo were created with these dependencies --
# in general, it's quite hard to make the visualization tests robust because
# they are vulnerable to various API changes and even internal implementation
# decisions of these libraries (e.g., changes in random number generator usage),
# but by keeping these dependencies fairly recent, we can minimize these issues
# since these are roughly the versions that we develop with.
numpy==1.24.4
numba==0.57.1
pandas==2.0.3
sortedcontainers==2.4.0
scikit-learn==1.3.0
scipy==1.10.1
threadpoolctl==3.0.0
matplotlib==3.7.2
5 changes: 2 additions & 3 deletions pinned_reqs/install.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
numpy==1.17.0
numpy==1.17.3
numba==0.51.0
pandas==1.0.0
sortedcontainers==2.0.0
scikit-learn==0.20.0
scikit-learn==1.1.0
scipy==1.4.0
threadpoolctl==3.0.0
semantic-version==2.10
10 changes: 1 addition & 9 deletions ribs/archives/_cvt_archive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Contains the CVTArchive class."""
import numpy as np
import semantic_version
import sklearn
from scipy.spatial import cKDTree # pylint: disable=no-name-in-module
from sklearn.cluster import k_means
Expand Down Expand Up @@ -151,14 +150,7 @@ def __init__(self,
# The default, "k-means++", takes very long to init.
self._k_means_kwargs["init"] = "random"
if "algorithm" not in self._k_means_kwargs:
if semantic_version.Version(
sklearn.__version__) >= semantic_version.Version("1.1.0"):
# In the newer versions, "full" has been deprecated in favor of
# "lloyd".
self._k_means_kwargs["algorithm"] = "lloyd"
else:
# The default, "auto"/"elkan", allocates a huge array.
self._k_means_kwargs["algorithm"] = "full"
self._k_means_kwargs["algorithm"] = "lloyd"
if "random_state" not in self._k_means_kwargs:
self._k_means_kwargs["random_state"] = seed

Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@

# NOTE: Update pinned_reqs whenever install_requires or extras_require changes.
install_requires = [
"numpy>=1.17.0", # >=1.17.0 is when default_rng becomes available.
# numpy>=1.17.0 is when default_rng becomes available;
# scikit-learn 1.1.0 requires numpy 1.17.3+
"numpy>=1.17.3",
"numpy_groupies>=0.9.16", # Supports Python 3.7 and up.
"numba>=0.51.0",
"pandas>=1.0.0",
"sortedcontainers>=2.0.0", # Primarily used in SlidingBoundariesArchive.
"scikit-learn>=0.20.0", # Primarily used in CVTArchive.
"scikit-learn>=1.1.0", # Primarily used in CVTArchive.
"scipy>=1.4.0", # Primarily used in CVTArchive.
"threadpoolctl>=3.0.0",
"semantic-version>=2.10"
]

extras_require = {
Expand Down Expand Up @@ -70,7 +71,6 @@
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -90,7 +90,7 @@
keywords="ribs",
name="ribs",
packages=find_packages(include=["ribs", "ribs.*"]),
python_requires=">=3.7.0",
python_requires=">=3.8.0",
test_suite="tests",
url="https://github.com/icaros-usc/pyribs",
version="0.5.2",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit daeae2e

Please sign in to comment.