Skip to content

Commit 0660405

Browse files
authored
poetry and tox (#64)
* poetry and tox * 3.8+ * added cli scripts
1 parent a3714c1 commit 0660405

File tree

8 files changed

+180
-81
lines changed

8 files changed

+180
-81
lines changed

.circleci/circle_requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
poetry>=1.1.6
2+
tox>=3.23.1
3+
tox-poetry>=0.3.0

.circleci/config.yml

Lines changed: 107 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,137 @@
33
# Check https://circleci.com/docs/2.0/language-python/ for more details
44
#
55
version: 2.1
6-
jobs:
7-
build:
8-
docker:
9-
- image: circleci/python:3.6.1
106

11-
- image: redislabs/redisgraph:edge
7+
commands:
128

13-
working_directory: ~/repo
9+
abort_for_docs:
10+
steps:
11+
- run:
12+
name: Avoid tests for docs
13+
command: |
14+
if [[ $CIRCLE_BRANCH == *docs ]]; then
15+
echo "Identifies as documents PR, no testing required"
16+
circleci step halt
17+
fi
1418
19+
abort_for_noci:
1520
steps:
21+
- run:
22+
name: Ignore CI for specific branches
23+
command: |
24+
if [[ $CIRCLE_BRANCH == *noci ]]; then
25+
echo "Identifies as actively ignoring CI, no testing required."
26+
circleci step halt
27+
fi
28+
29+
30+
early_return_for_forked_pull_requests:
31+
description: >-
32+
If this build is from a fork, stop executing the current job and return success.
33+
This is useful to avoid steps that will fail due to missing credentials.
34+
steps:
35+
- run:
36+
name: Early return if this build is from a forked PR
37+
command: |
38+
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
39+
echo "Nothing to do for forked PRs, so marking this step successful"
40+
circleci step halt
41+
fi
42+
43+
build_and_test:
44+
steps:
45+
- abort_for_docs
46+
- abort_for_noci
1647
- checkout
1748

18-
# Download and cache dependencies
19-
- restore_cache:
49+
- restore_cache: # Download and cache dependencies
2050
keys:
21-
- v1-dependencies-{{ checksum "requirements.txt" }}
22-
# fallback to using the latest cache if no exact match is found
23-
- v1-dependencies-
51+
- v1-dependencies-{{ checksum "pyproject.toml" }}
52+
# fallback to using the latest cache if no exact match is found
53+
- v1-dependencies-
2454

2555
- run:
26-
name: install dependencies
56+
name: install tox dependencies
2757
command: |
28-
python3 -m venv venv
29-
. venv/bin/activate
30-
pip install .
58+
pip install --user --quiet -r .circleci/circle_requirements.txt
3159
32-
- save_cache:
33-
paths:
34-
- ./venv
35-
key: v1-dependencies-{{ checksum "requirements.txt" }}
60+
- run:
61+
name: install dependencies
62+
command: |
63+
poetry install
3664
3765
- run:
38-
name: build dist
39-
command: python setup.py sdist
66+
name: build sdist and wheels
67+
command: |
68+
poetry build
4069
4170
- run:
42-
name: run tests and upload coverage
71+
name: lint
4372
command: |
44-
. venv/bin/activate
45-
pip install -r test/requirements.txt
46-
pytest --cov redisgraph_bulk_loader
47-
codecov -t ${CODECOV_TOKEN}
73+
tox -e linters
74+
75+
- run:
76+
name: run tests
77+
command:
78+
tox -e cover
79+
80+
- save_cache:
81+
paths:
82+
- ./.tox
83+
- ~/.cache/pip
84+
key: v1-dependencies-{{ checksum "pyproject.toml" }}
85+
86+
- store_artifacts:
87+
path: test-reports
88+
destination: test-reports
89+
90+
91+
jobs:
92+
build:
93+
parameters:
94+
python_version:
95+
type: string
96+
default: latest
97+
docker:
98+
- image: circleci/python:<<parameters.python_version >>
99+
- image: redislabs/redisgraph:edge
100+
steps:
101+
- build_and_test
102+
103+
on-any-branch: &on-any-branch
104+
filters:
105+
branches:
106+
only: /.*/
107+
tags:
108+
only: /.*/
109+
110+
on-master: &on-master
111+
filters:
112+
branches:
113+
only:
114+
- master
115+
116+
# the is to build and test, per commit against all supported python versions
117+
python-versions: &python-versions
118+
matrix:
119+
parameters:
120+
python_version:
121+
- "3.8.9"
122+
- "3.9.4"
123+
- "latest"
48124

49125
workflows:
50126
version: 2
51127
commit:
52128
jobs:
53-
- build
129+
- build:
130+
<<: *on-any-branch
131+
<<: *python-versions
132+
54133
nightly:
55134
triggers:
56135
- schedule:
57136
cron: "0 0 * * *"
58-
filters:
59-
branches:
60-
only:
61-
- master
137+
<<: *on-master
62138
jobs:
63139
- build

pyproject.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[tool.poetry]
2+
name = "redisgraph-bulk-loader"
3+
version = "0.9.10"
4+
description = "RedisGraph Bulk Import Tool"
5+
authors = ["RedisLabs <oss@redislabs.com>"]
6+
license = "BSD-3-Clause"
7+
readme = "README.md"
8+
9+
classifiers = [
10+
'Topic :: Database',
11+
'Programming Language :: Python',
12+
'Intended Audience :: Developers',
13+
'Programming Language :: Python :: 3.8',
14+
'Programming Language :: Python :: 3.9',
15+
'License :: OSI Approved :: BSD License',
16+
'Development Status :: 5 - Production/Stable'
17+
18+
]
19+
keywords = ["Redis Graph Extension"]
20+
21+
[tool.poetry.scripts]
22+
redisgraph-bulk-update = "redisgraph_bulk_loader.bulk_update:bulk_update"
23+
redisgraph-bulk-insert = "redisgraph_bulk_loader.bulk_insert:bulk_insert"
24+
25+
[tool.poetry.urls]
26+
url = "https://redisgraph.io"
27+
repository = "https://github.com/RedisGraph/redigraph-bulk-loader"
28+
29+
[tool.poetry.dependencies]
30+
python = "^3.8.5"
31+
click = "^8.0.1"
32+
redis = "^3.5.3"
33+
34+
[tool.poetry.dev-dependencies]
35+
codecov = "^2.1.11"
36+
flake8 = "^3.9.2"
37+
tox = "^3.23.1"
38+
tox-poetry = "^0.3.0"
39+
bandit = "^1.7.0"
40+
vulture = "^2.3"
41+
pytest = "^6.2.4"
42+
pytest-cov = "^2.12.1"
43+
redisgraph = "^2.4.0"
44+
45+
[build-system]
46+
requires = ["poetry-core>=1.0.0"]
47+
build-backend = "poetry.core.masonry.api"

requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

test/requirements.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

tox.ini

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[tox]
2+
skipsdist = True
3+
envlist = linters
4+
5+
[flake8]
6+
max-complexity = 10
7+
ignore = E127,E265,E266,E301,E501
8+
show-source = true
9+
exclude =.git,.tox,dist,doc,*/__pycache__/*,*test*.py
10+
11+
[testenv:cover]
12+
whitelist_externals = find
13+
commands_pre =
14+
find . -type f -name "*.pyc" -delete
15+
commands =
16+
pytest --cov redisgraph_bulk_loader
17+
codecov
18+
19+
[testenv:linters]
20+
commands =
21+
# flake8 --show-source
22+
vulture redisgraph_bulk_loader/ --min-confidence 80
23+
bandit redisgraph_bulk_loader/

0 commit comments

Comments
 (0)