Skip to content

poetry and tox #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/circle_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
poetry>=1.1.6
tox>=3.23.1
tox-poetry>=0.3.0
138 changes: 107 additions & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,137 @@
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2.1
jobs:
build:
docker:
- image: circleci/python:3.6.1

- image: redislabs/redisgraph:edge
commands:

working_directory: ~/repo
abort_for_docs:
steps:
- run:
name: Avoid tests for docs
command: |
if [[ $CIRCLE_BRANCH == *docs ]]; then
echo "Identifies as documents PR, no testing required"
circleci step halt
fi

abort_for_noci:
steps:
- run:
name: Ignore CI for specific branches
command: |
if [[ $CIRCLE_BRANCH == *noci ]]; then
echo "Identifies as actively ignoring CI, no testing required."
circleci step halt
fi


early_return_for_forked_pull_requests:
description: >-
If this build is from a fork, stop executing the current job and return success.
This is useful to avoid steps that will fail due to missing credentials.
steps:
- run:
name: Early return if this build is from a forked PR
command: |
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi

build_and_test:
steps:
- abort_for_docs
- abort_for_noci
- checkout

# Download and cache dependencies
- restore_cache:
- restore_cache: # Download and cache dependencies
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- v1-dependencies-{{ checksum "pyproject.toml" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run:
name: install dependencies
name: install tox dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install .
pip install --user --quiet -r .circleci/circle_requirements.txt

- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements.txt" }}
- run:
name: install dependencies
command: |
poetry install

- run:
name: build dist
command: python setup.py sdist
name: build sdist and wheels
command: |
poetry build

- run:
name: run tests and upload coverage
name: lint
command: |
. venv/bin/activate
pip install -r test/requirements.txt
pytest --cov redisgraph_bulk_loader
codecov -t ${CODECOV_TOKEN}
tox -e linters

- run:
name: run tests
command:
tox -e cover

- save_cache:
paths:
- ./.tox
- ~/.cache/pip
key: v1-dependencies-{{ checksum "pyproject.toml" }}

- store_artifacts:
path: test-reports
destination: test-reports


jobs:
build:
parameters:
python_version:
type: string
default: latest
docker:
- image: circleci/python:<<parameters.python_version >>
- image: redislabs/redisgraph:edge
steps:
- build_and_test

on-any-branch: &on-any-branch
filters:
branches:
only: /.*/
tags:
only: /.*/

on-master: &on-master
filters:
branches:
only:
- master

# the is to build and test, per commit against all supported python versions
python-versions: &python-versions
matrix:
parameters:
python_version:
- "3.8.9"
- "3.9.4"
- "latest"

workflows:
version: 2
commit:
jobs:
- build
- build:
<<: *on-any-branch
<<: *python-versions

nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
<<: *on-master
jobs:
- build
47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[tool.poetry]
name = "redisgraph-bulk-loader"
version = "0.9.10"
description = "RedisGraph Bulk Import Tool"
authors = ["RedisLabs <oss@redislabs.com>"]
license = "BSD-3-Clause"
readme = "README.md"

classifiers = [
'Topic :: Database',
'Programming Language :: Python',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'License :: OSI Approved :: BSD License',
'Development Status :: 5 - Production/Stable'

]
keywords = ["Redis Graph Extension"]

[tool.poetry.scripts]
redisgraph-bulk-update = "redisgraph_bulk_loader.bulk_update:bulk_update"
redisgraph-bulk-insert = "redisgraph_bulk_loader.bulk_insert:bulk_insert"

[tool.poetry.urls]
url = "https://redisgraph.io"
repository = "https://github.com/RedisGraph/redigraph-bulk-loader"

[tool.poetry.dependencies]
python = "^3.8.5"
click = "^8.0.1"
redis = "^3.5.3"

[tool.poetry.dev-dependencies]
codecov = "^2.1.11"
flake8 = "^3.9.2"
tox = "^3.23.1"
tox-poetry = "^0.3.0"
bandit = "^1.7.0"
vulture = "^2.3"
pytest = "^6.2.4"
pytest-cov = "^2.12.1"
redisgraph = "^2.4.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

39 changes: 0 additions & 39 deletions setup.py

This file was deleted.

7 changes: 0 additions & 7 deletions test/requirements.txt

This file was deleted.

23 changes: 23 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tox]
skipsdist = True
envlist = linters

[flake8]
max-complexity = 10
ignore = E127,E265,E266,E301,E501
show-source = true
exclude =.git,.tox,dist,doc,*/__pycache__/*,*test*.py

[testenv:cover]
whitelist_externals = find
commands_pre =
find . -type f -name "*.pyc" -delete
commands =
pytest --cov redisgraph_bulk_loader
codecov

[testenv:linters]
commands =
# flake8 --show-source
vulture redisgraph_bulk_loader/ --min-confidence 80
bandit redisgraph_bulk_loader/