Skip to content

Commit

Permalink
Require Python 3.7 or later (#674)
Browse files Browse the repository at this point in the history
* Require Python 3.7 or later

* Upgrade to actions/setup-python@v4

* Remove Python 3.12 builds for this PR

* Make dev container work
  • Loading branch information
pietern committed Oct 4, 2023
1 parent f5d7cf9 commit 682dc6f
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 54 deletions.
7 changes: 3 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.231.3/containers/python-3/.devcontainer/base.Dockerfile

# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster
ARG VARIANT="3.10-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

Expand All @@ -13,9 +13,8 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

RUN /usr/local/bin/python3 -m pip install --upgrade pip
COPY requirements.txt /tmp/pip-tmp/
COPY dev-requirements*.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/dev-requirements-py3.txt
&& rm -rf /tmp/pip-tmp
COPY dev-requirements.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/dev-requirements.txt && rm -rf /tmp/pip-tmp

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
10 changes: 5 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.6-bullseye",
"VARIANT": "3.7-bullseye",
// Options
"NODE_VERSION": "lts/*"
}
Expand All @@ -19,9 +19,9 @@
// mount databricks config
"source=${localEnv:HOME}/.databrickscfg,target=/home/vscode/.databrickscfg,type=bind,consistency=cached"
],

// Set *default* container specific settings.json values on container create.
"settings": {
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,32 @@ on:

jobs:
test:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04
strategy:
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
os: [ ubuntu-20.04 ]
- '3.11'

env:
OS: ${{ matrix.os }}
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install --upgrade pip

- name: Install development dependencies (Python 2)
if: ${{ startsWith(matrix.python-version, '2.') }}
run: pip install --upgrade -r dev-requirements-py2.txt

- name: Install development dependencies (Python 3)
if: ${{ startsWith(matrix.python-version, '3.') }}
run: pip install --upgrade -r dev-requirements-py3.txt
- name: Install development dependencies
run: pip install --upgrade -r dev-requirements.txt

- name: Log package versions
run: pip freeze
Expand All @@ -54,22 +49,27 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
env_vars: OS,PYTHON_VERSION
env_vars: PYTHON_VERSION

build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'

env:
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
compat:
name: Public API compatibility
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -133,13 +133,13 @@ jobs:
path: databricks-cli-main

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4

- name: Install pip
run: pip install --upgrade pip

- name: Install development dependencies (Python 3)
run: pip install --upgrade -r dev-requirements-py3.txt
- name: Install development dependencies
run: pip install --upgrade -r dev-requirements.txt

- name: Run compatibility test
run: |
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ To isolate dependencies from your global python installation, it is important to
[virtualenv](https://virtualenv.pypa.io/en/stable/). With `virtualenv` you can install the dev environment by doing the following.

Another option would be to use docker directly, i.e.
```bash
docker run -it -v `echo $PWD`:/root python:3.6.8 bash

```bash
docker run -it -v `echo $PWD`:/root python:3.7 bash
```

- `pip install -e .`
- `pip install -r dev-requirements-py3.txt`
- `pip install -r dev-requirements.txt`

To verify that the installation of `databricks-cli` is the one checked out from VCS, you can check by doing `python -c "import databricks_cli; print databricks_cli.__file__"`.
To verify that the installation of `databricks-cli` is the one checked out from VCS, you can check by doing `python -c "import databricks_cli; print(databricks_cli.__file__)"`.

Developing using VSCode dev containers
--------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM python:3.6
FROM python:3.7

WORKDIR /usr/src/databricks-cli

COPY . .

RUN pip install --upgrade pip && \
pip install -r dev-requirements-py3.txt && \
pip install -r dev-requirements.txt && \
pip list && \
./lint.sh && \
pip install . && \
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Please leave bug reports as issues on our `GitHub project <https://github.com/da
Requirements
------------

- Python Version > 3.6
- Python Version >= 3.7

Installation
---------------
Expand Down
2 changes: 1 addition & 1 deletion databricks_cli/sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Currently supports services including clusters, clusters policies and jobs.
Requires Python 3.6 or above.
Requires Python 3.7 or above.
To get started, below is an example usage of the Python API client.
Expand Down
13 changes: 0 additions & 13 deletions dev-requirements-py3.txt

This file was deleted.

12 changes: 12 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@ mock
decorator
requests_mock
rstcheck
prospector[with_pyroma]

# More recent versions of these linters introduce rules that make it fail.
# Pin these versions to keep the ruleset fixed.
dodgy==0.2.1
flake8==4.0.1
flake8-polyfill==1.0.2
mccabe==0.6.1
prospector==1.7.7
pycodestyle==2.8.0
pyflakes==2.4.0
pylint==2.13.9
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ oauthlib>=3.1.0
requests>=2.17.3
tabulate>=0.7.7
six>=1.10.0
configparser>=0.3.5;python_version < "3.6"
urllib3>=1.26.7,<3
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
name='databricks-cli',
version=version,
packages=find_packages(include=['databricks_cli*']),
python_requires=">=3.7",
install_requires=[
# Note: please keep this in sync with `requirements.txt`.
'click>=7.0',
Expand All @@ -41,7 +42,6 @@
'requests>=2.17.3',
'tabulate>=0.7.7',
'six>=1.10.0',
'configparser>=0.3.5;python_version < "3.6"',
'urllib3>=1.26.7,<3'
],
entry_points='''
Expand All @@ -58,8 +58,13 @@
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: Apache Software License',
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
keywords='databricks cli',
url='https://github.com/databricks/databricks-cli'
Expand Down
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[tox]
envlist = py27, py36
envlist = py37

[testenv]
deps =
py27: -rdev-requirements-py2.txt
py36: -rdev-requirements-py3.txt
py37: -rdev-requirements.txt
commands =
pytest tests --cov=./
./lint.sh

0 comments on commit 682dc6f

Please sign in to comment.