Skip to content

Commit

Permalink
Ct 2183/setup tools distro info (#561)
Browse files Browse the repository at this point in the history
* unpin dev requirements
* remove duplicated downstream dependencies to reduce version conflicts
* add docker image for development purposes
* add tox to the image
* add py3.9 and py3.8 containers to research broken test
  • Loading branch information
mikealfare authored Feb 27, 2023
1 parent 93303d4 commit 626bf16
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!docker_dev
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DEFAULT_GOAL:=help

.PHONY: dev
dev: ## Installs adapter in develop mode along with development dependencies
@\
pip install -e . -r dev-requirements.txt && pre-commit install

.PHONY: ubuntu-py311
ubuntu-py311: ## Builds and runs an Ubuntu Python 3.11 development container
docker build -f docker_dev/ubuntu.Dockerfile -t dbt-bigquery-ubuntu-py311 .
docker run --rm -it --name dbt-bigquery-ubuntu-py311 -v $(shell pwd):/opt/code dbt-bigquery-ubuntu-py311

.PHONY: ubuntu-py39
ubuntu-py39: ## Builds and runs an Ubuntu Python 3.9 development container
docker build -f docker_dev/ubuntu.Dockerfile -t dbt-bigquery-ubuntu-py39 . --build-arg version=3.9
docker run --rm -it --name dbt-bigquery-ubuntu-py39 -v $(shell pwd):/opt/code dbt-bigquery-ubuntu-py39

.PHONY: ubuntu-py38
ubuntu-py38: ## Builds and runs an Ubuntu Python 3.8 development container
docker build -f docker_dev/ubuntu.Dockerfile -t dbt-bigquery-ubuntu-py38 . --build-arg version=3.8
docker run --rm -it --name dbt-bigquery-ubuntu-py38 -v $(shell pwd):/opt/code dbt-bigquery-ubuntu-py38
37 changes: 19 additions & 18 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
# TODO: how to automate switching from develop to version branches?
git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core
git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-tests-adapter&subdirectory=tests/adapter
black~=22.8.0
bumpversion~=0.6.0

black
bumpversion
flake8
flaky~=3.7.0
freezegun~=1.1.0
ipdb~=0.13.9
mypy~=0.971.0
pip-tools~=6.11.0
pre-commit~=2.20.0
pytest~=7.2.0
pytest-dotenv~=0.5.2
pytest-logbook~=1.2.0
pytest-csv~=3.0.0
pytest-xdist~=3.1.0
pytz~=2022.6.0
tox~=3.13
types-requests~=2.28.11
twine~=4.0.2
wheel~=0.37.1
flaky
freezegun
ipdb
mypy
pip-tools
pre-commit
pytest
pytest-dotenv
pytest-logbook
pytest-csv
pytest-xdist
pytz
tox
types-requests
twine
wheel
5 changes: 5 additions & 0 deletions docker_dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Docker Dev Images

These images are solely for development purposes. They are
saved here for convenience. There should be no expectation
of stability or maintenance.
50 changes: 50 additions & 0 deletions docker_dev/ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM ubuntu:latest

# default to py3.11, this can be overridden at build, e.g. `docker build ... --build-arg version=3.10`
ARG version=3.11

# prevent python installation from asking for time zone region
ARG DEBIAN_FRONTEND=noninteractive

# get add-apt-repository
RUN apt-get update && \
apt-get install -y software-properties-common

# add the python repository
RUN apt-get update && \
add-apt-repository -y ppa:deadsnakes/ppa

# install python and git (for installing dbt-core)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python$version \
python$version-dev \
python$version-distutils \
python$version-venv \
python3-pip \
python3-wheel \
build-essential \
git-all

# clean up
RUN apt-get clean && \
rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*

# update the default system interpreter to the newly installed version
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python$version 1

# setup mount for our code
WORKDIR /opt/code
VOLUME /opt/code

# install tox in the system interpreter (it creates it's own virtual environments)
RUN pip install tox

# explicitly create a virtual environment as well for interactive testing
RUN python3 -m venv /opt/venv

# send stdout/stderr to terminal
ENV PYTHONUNBUFFERED=1
6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,10 @@ def _dbt_core_version(plugin_version: str) -> str:
include_package_data=True,
install_requires=[
f"dbt-core~={_dbt_core_version(_dbt_bigquery_version())}",
"protobuf>=3.13.0,<4",
"google-cloud-core~=2.0",
"google-cloud-bigquery~=3.0",
"google-api-core~=2.0",
"googleapis-common-protos~=1.6",
"google-cloud-storage~=2.4",
"google-cloud-dataproc~=5.0",
"agate>=1.6.3,<1.7",
"agate~=1.6.3",
],
zip_safe=False,
classifiers=[
Expand Down

0 comments on commit 626bf16

Please sign in to comment.