Skip to content

Commit

Permalink
chore: move to poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
fspot committed Jun 10, 2022
1 parent 29d4e0a commit 3ca5aeb
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 94 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/ci-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.10']

defaults:
run:
Expand All @@ -35,18 +35,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
- name: Install poetry
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('server/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-
pip install poetry
poetry config virtualenvs.create false
- name: Install dependencies
run: make install-dev
Expand Down
6 changes: 6 additions & 0 deletions server/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
exclude = __init__.py
inline-quotes = single
multiline-quotes = double
max-line-length = 100
ignore = E203, E266, E501, W503, W605
24 changes: 5 additions & 19 deletions server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ clean:

.PHONY: install
install:
pip install -U pip
pip install .
poetry install

.PHONY: install-dev
install-dev:
pip install -e ".[dev]"
poetry install -E dev

.PHONY: install-playground
install-playground:
pip install ".[playground]"
poetry install -E playground

.PHONY: format
format:
Expand All @@ -43,24 +42,11 @@ all: test lint

.PHONY: build
build:
pip install build
python -m build
poetry build

.PHONY: upload
upload:
pip install twine
twine upload dist/*

# Easy mode to use locally with pyCharm
.PHONY: install_local
install_local:
rm -rf dist/*
make build
FILENAME="$(shell ls -1t dist/*.gz | head -1)"; echo $$FILENAME
FILENAME="$(shell ls -1t dist/*.gz | head -1)"; pip install $$FILENAME

.PHONY: execute_local_test
execute_local_test: install_local test
poetry publish --build

.PHONY: start_docker_playground
start_docker_playground:
Expand Down
2 changes: 1 addition & 1 deletion server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ See [docs about purpose and usage](../docs/_docs/tech/python-package.md).

## Development

We use [setuptools](https://setuptools.pypa.io/en/latest/) for managing dependencies.
We use [poetry](https://python-poetry.org/) for managing dependencies.

Main commands are available through `make`:

Expand Down
59 changes: 56 additions & 3 deletions server/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,54 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "weaverbird"
version = "0.12.7"
description = "Weaverbird"
authors = ["Toucan Toco <dev@toucantoco.com>"]
license = "BSD"
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.10"
pandas = "^1.2.5"
pydantic = "^1.9.1"
numexpr = "^2.8.1"
typing_extensions = "^4.2"

# Dependencies for extras
quart = {version = "^0.17", optional = true}
hypercorn = {version = "^0.13", optional = true}
pymongo = {version = "^4.0", optional = true, extras = ["srv", "tls"]}
snowflake-connector-python = {version = "^2.7.6", extras = ["pandas"], optional = true}

[tool.poetry.dev-dependencies]
pytest-cov = "^2.10.1"
pytest-mock = "^3.3.1"
toucan-connectors = ">= 3.8" # required so we can use nosql_apply_parameters_to_query during tests
pytest-benchmark = "^3.4.1"
snowflake-sqlalchemy = "^1.3.1"
types-python-dateutil = "^2.8"
snowflake-connector-python = {version = "^2.7.6", extras = ["pandas"]}
pytest = "6.1.1"
black = "22.3.0"
flake8 = "3.8.4"
isort = "5.6.4"
mypy = "0.910"
docker = "5.0.0"
sqlalchemy = "1.4.22"
pymysql = "1.0.2"
psycopg2 = "2.9.2"
cryptography = "3.4.7"
pymongo = "4.0.1"

[tool.poetry.extras]
playground = ["quart", "hypercorn", "pymongo", "snowflake-connector-python"]

[tool.black]
line-length = 100
target-version = ["py38"]
target-version = ["py310"]
skip-string-normalization = true

[tool.isort]
Expand All @@ -13,6 +57,15 @@ multi_line_output = 3
include_trailing_comma = true
line_length = 100

[tool.mypy]
files = "src/"
exclude = "weaverbird/backends/sql_translator"
plugins = "pydantic.mypy"
follow_imports = "silent"
ignore_missing_imports = true
allow_redefinition = true
check_untyped_defs = true

[tool.pytest.ini_options]
testpaths = [
"tests",
Expand Down
59 changes: 0 additions & 59 deletions server/setup.cfg

This file was deleted.

0 comments on commit 3ca5aeb

Please sign in to comment.