Skip to content

Commit b292d49

Browse files
committed
added initial poetry files
linked docs/development.md as README.md, required for build/realease moved yapf to dev dependencies (from production), added toml for yapf to parse pyproject.toml removed requirements.txt modified run_tests.sh to use poetry required tools from non-slim docker image use bash to utilize alias commands
1 parent bc36f9c commit b292d49

File tree

6 files changed

+501
-17
lines changed

6 files changed

+501
-17
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/development.md

cloudbuild.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
steps:
22
- id: api_python
3-
name: python:3.7-slim
4-
entrypoint: /bin/sh
3+
name: python:3.7
4+
entrypoint: /bin/bash
55
args:
66
- -c
77
- "./run_tests.sh -p"

poetry.lock

+463
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[tool.poetry]
2+
name = "datacommons"
3+
version = "1.4.3"
4+
description = "Python client library to access Data Commons"
5+
authors = ["Prashanth R <pradh@dev>"]
6+
license = "Apache-2.0"
7+
readme = "README.md"
8+
9+
[tool.poetry.dependencies]
10+
python = "^3.7.1"
11+
requests = "^2.28.1"
12+
typing-extensions = "^4.4.0"
13+
pandas = "^1.2.2"
14+
15+
[tool.poetry.group.dev.dependencies]
16+
mock = "^4.0.3"
17+
pytest = "^7.2.0"
18+
toml = "^0.10.2"
19+
yapf = "^0.32.0"
20+
21+
[build-system]
22+
requires = ["poetry-core"]
23+
build-backend = "poetry.core.masonry.api"

requirements.txt

-6
This file was deleted.

run_tests.sh

+12-9
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,21 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
function setup_python {
17-
python3 -m venv .env
18-
source .env/bin/activate
19-
pip install --upgrade pip
20-
pip3 install -r requirements.txt -q
16+
function setup_poetry {
17+
export PATH="$HOME/.local/bin:$PATH"
18+
alias pyrun='poetry run python3 -m'
19+
20+
if ! which poetry; then
21+
curl -sSL https://install.python-poetry.org | python
22+
fi
23+
poetry install
2124
}
2225

2326
function run_py_test {
24-
setup_python
25-
python3 -m pytest -vv
27+
setup_poetry
28+
pyrun pytest -vv
2629
echo -e "#### Checking Python style"
27-
if ! yapf --recursive --diff --style='{based_on_style: google, indent_width: 2}' -p datacommons/ datacommons_pandas/; then
30+
if ! pyrun yapf --recursive --diff --style='{based_on_style: google, indent_width: 2}' -p datacommons/ datacommons_pandas/; then
2831
echo "Fix lint errors by running: ./run_test.sh -f"
2932
exit 1
3033
fi
@@ -67,4 +70,4 @@ done
6770
if [ $OPTIND -eq 1 ]
6871
then
6972
help
70-
fi
73+
fi

0 commit comments

Comments
 (0)