Skip to content

Commit

Permalink
Require Python 3.7 or later
Browse files Browse the repository at this point in the history
  • Loading branch information
pietern committed Oct 4, 2023
1 parent f5d7cf9 commit 4e6a046
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 50 deletions.
6 changes: 3 additions & 3 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,8 +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
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.
Expand Down
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
32 changes: 17 additions & 15 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ 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'
- '3.12'

env:
OS: ${{ matrix.os }}
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- name: Checkout
Expand All @@ -31,13 +32,8 @@ jobs:
- 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,14 +50,20 @@ 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'
- '3.12'

env:
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
Expand Down Expand Up @@ -121,7 +123,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 @@ -138,8 +140,8 @@ jobs:
- 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 4e6a046

Please sign in to comment.