Skip to content

Commit

Permalink
[SYNPY-1517] Deprecate Python 3.8 Support (#1134)
Browse files Browse the repository at this point in the history
* Run in py 3.12

* Swap to `sysconfig` instead of distutils

* Swap to use `get_path`

* Unit test patching

* Remove kwarg

* Run on 3.8 and 3.12

* Test patch

* bump up timeout

* deprecates python 3.8

* pre-commit

* fix importlib import

* adds importlib_resources dependency

* bump cache version

* fix CI

* revert  docs to 5.0

* remove secrets dupe

* fix formatting

* updates Pipfile.lock

* fix docs versions

* restricts 3.13

* undo importlib_resources

* revert pandas changes

* revert importlib_resources

* bump cache

* pre-commit

---------

Co-authored-by: BryanFauble <[email protected]>
  • Loading branch information
BWMac and BryanFauble authored Sep 26, 2024
1 parent 97085de commit 47e8709
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 382 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

# if changing the below change the run-integration-tests versions and the check-deploy versions
# Make sure that we are running the integration tests on the first and last versions of the matrix
python: [3.8, '3.9', '3.10', '3.11', '3.12']
python: ['3.9', '3.10', '3.11', '3.12']

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
path: |
${{ steps.get-dependencies.outputs.site_packages_loc }}
${{ steps.get-dependencies.outputs.site_bin_dir }}
key: ${{ runner.os }}-${{ matrix.python }}-build-${{ env.cache-name }}-${{ hashFiles('setup.py') }}-v18
key: ${{ runner.os }}-${{ matrix.python }}-build-${{ env.cache-name }}-${{ hashFiles('setup.py') }}-v20

- name: Install py-dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
Expand All @@ -101,7 +101,7 @@ jobs:
pytest -sv --cov-append --cov=. --cov-report xml tests/unit
- name: Check for Secret availability
id: secret-check
if: ${{ contains(fromJSON('["3.8"]'), matrix.python) || contains(fromJSON('["3.12"]'), matrix.python) }}
if: ${{ contains(fromJSON('["3.9"]'), matrix.python) || contains(fromJSON('["3.12"]'), matrix.python) }}
# perform secret check & put boolean result as an output
shell: bash
run: |
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
shell: bash

# keep versions consistent with the first and last from the strategy matrix
if: ${{ (contains(fromJSON('["3.8"]'), matrix.python) || contains(fromJSON('["3.12"]'), matrix.python)) && steps.secret-check.outputs.secrets_available == 'true'}}
if: ${{ (contains(fromJSON('["3.9"]'), matrix.python) || contains(fromJSON('["3.12"]'), matrix.python)) && steps.secret-check.outputs.secrets_available == 'true'}}
run: |
# decrypt the encrypted test synapse configuration
openssl aes-256-cbc -K ${{ secrets.encrypted_d17283647768_key }} -iv ${{ secrets.encrypted_d17283647768_iv }} -in test.synapseConfig.enc -out test.synapseConfig -d
Expand Down Expand Up @@ -264,7 +264,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9

- name: set-release-env
shell: bash
Expand Down Expand Up @@ -402,7 +402,7 @@ jobs:
os: [ubuntu-20.04, macos-12, windows-2022]

# python versions should be consistent with the strategy matrix and the runs-integration-tests versions
python: [3.8, '3.9', '3.10', '3.11', '3.12']
python: ['3.9', '3.10', '3.11', '3.12']

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ copied to forks).
#### Installing the Python Client in a virtual environment with pipenv
Perform the following one-time steps to set up your local environment.

1. This package uses Python, if you have not already, please install [pyenv](https://github.com/pyenv/pyenv#installation) to manage your Python versions. Versions supported by this package are all versions >=3.8 and <=3.11. If you do not install `pyenv` make sure that Python and `pip` are installed correctly and have been added to your PATH by running `python3 --version` and `pip3 --version`. If your installation was successful, your terminal will return the versions of Python and `pip` that you installed. **Note**: If you have `pyenv` it will install a specific version of Python for you.
1. This package uses Python, if you have not already, please install [pyenv](https://github.com/pyenv/pyenv#installation) to manage your Python versions. Versions supported by this package are all versions >=3.9 and <=3.12. If you do not install `pyenv` make sure that Python and `pip` are installed correctly and have been added to your PATH by running `python3 --version` and `pip3 --version`. If your installation was successful, your terminal will return the versions of Python and `pip` that you installed. **Note**: If you have `pyenv` it will install a specific version of Python for you.

2. Install `pipenv` by running `pip install pipenv`.
- If you already have `pipenv` installed, ensure that the version is >=2023.9.8 to avoid compatibility issues.
Expand Down
426 changes: 69 additions & 357 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ or by sending an email to [[email protected]](mailto:python
Installation
------------

The Python Synapse client has been tested on 3.8, 3.9, 3.10 and 3.11 on Mac OS X, Ubuntu Linux and Windows.
The Python Synapse client has been tested on versions 3.9, 3.10, 3.11 and 3.12 on Mac OS X, Ubuntu Linux and Windows.

**Starting from Synapse Python client version 3.0, Synapse Python client requires Python >= 3.8**
**Starting from Synapse Python client version 3.0, Synapse Python client requires Python >= 3.9**

### Install using pip

Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ prefer-stubs=no

# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.8
py-version=3.9

# Discover python modules and packages in the file system subtree.
recursive=no
Expand Down
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ platforms = any
classifiers =
Development Status :: 5 - Production/Stable
Programming Language :: Python
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Expand All @@ -43,7 +42,7 @@ classifiers =
zip_safe = False
include_package_data = True
packages = find:
python_requires = >=3.8
python_requires = >=3.9, <3.13
install_requires =
# "requests>=2.22.0,<2.30.0; python_version<'3.10'",
requests>=2.22.0,<3.0
Expand Down Expand Up @@ -104,7 +103,6 @@ tests =

pandas =
pandas>=1.5,<3.0
numpy<2.0.0

pysftp =
pysftp>=0.2.8,<0.3
Expand Down
9 changes: 3 additions & 6 deletions synapseclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,9 @@
from .team import Team, TeamMember, UserGroupHeader, UserProfile
from .wiki import Wiki

# ref = importlib.resources.files(__name__).joinpath("synapsePythonClient")
# with ref.open("r") as fp:
# __version__ = json.load(fp)["latestVersion"]
# TODO: switch to the above after python 3.8 is deprecated
with importlib.resources.path(__name__, "synapsePythonClient") as ref:
__version__ = json.load(open(ref))["latestVersion"]
ref = importlib.resources.files(__name__).joinpath("synapsePythonClient")
with ref.open("r") as fp:
__version__ = json.load(fp)["latestVersion"]

__all__ = [
# objects
Expand Down
9 changes: 3 additions & 6 deletions synapseclient/core/version_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,9 @@ def _version_tuple(version, levels=2):

def _get_version_info(version_url=_VERSION_URL):
if version_url is None:
# ref = importlib_resources.files("synapseclient").joinpath("synapsePythonClient")
# with ref.open("r") as fp:
# pkg_metadata = json.loads(fp.read())
# TODO: switch to the above after python 3.8 is deprecated
with importlib.resources.path(__name__, "synapsePythonClient") as ref:
pkg_metadata = json.load(ref)
ref = importlib.resources.files("synapseclient").joinpath("synapsePythonClient")
with ref.open("r") as fp:
pkg_metadata = json.loads(fp.read())
return pkg_metadata
else:
headers = {"Accept": "application/json; charset=UTF-8"}
Expand Down

0 comments on commit 47e8709

Please sign in to comment.