Skip to content

Commit

Permalink
Merge pull request #11 from Der-Henning/dev
Browse files Browse the repository at this point in the history
version 0.5.2
  • Loading branch information
Der-Henning authored Jul 17, 2023
2 parents 74426e1 + 01b89e8 commit 374dab6
Show file tree
Hide file tree
Showing 31 changed files with 2,204 additions and 181 deletions.
13 changes: 9 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

# Poetry
ARG POETRY_VERSION="none"
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
RUN if [ "${POETRY_VERSION}" != "none" ]; then su vscode -c "umask 0002 && pip3 install poetry==${POETRY_VERSION}"; fi

# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
COPY requirements.txt /tmp/pip-tmp/
COPY requirements-dev.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements-dev.txt \
&& rm -rf /tmp/pip-tmp
# COPY requirements.txt /tmp/pip-tmp/
# COPY requirements-dev.txt /tmp/pip-tmp/
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements-dev.txt \
# && rm -rf /tmp/pip-tmp

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
Expand Down
31 changes: 7 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,23 @@
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.10",
// Options
"NODE_VERSION": "none"
// "NODE_VERSION": "lts/*",
"POETRY_VERSION": "1.5.1"
}
},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "autopep8",
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": ["tests"],
"isort.check": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
"python.defaultInterpreterPath": "./.venv/bin/python",
"python.terminal.activateEnvironment": true,
"python.terminal.activateEnvInCurrentTerminal": true
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"jock.svg",
"njpwerner.autodocstring"
"GitHub.vscode-pull-request-github"
]
}
},
Expand All @@ -53,7 +36,7 @@
"forwardPorts": [8050],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pre-commit install --install-hooks",
"postCreateCommand": "poetry install && poetry run pre-commit install --install-hooks",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
Expand Down
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: pip # See documentation for possible values
directory: / # Location of package manifests
schedule:
interval: weekly
35 changes: 16 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
name: Tests

on:
push:
branches: ["main", "dev"]
pull_request:
branches: ["main", "dev"]
branches: [main, dev]

jobs:
tests:
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
python: ['3.9', '3.10', '3.11']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest-cov pre-commit
pip install -e .
- name: Run linting
run: pre-commit run -a
- name: Run unit tests
run: python -m pytest --cov tki/ --cov-report=xml
- uses: codecov/codecov-action@v3
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.5.1
- name: Install dependencies
run: poetry install --without dev
- name: Run linting
run: poetry run pre-commit run -a
- name: Run tests
run: poetry run pytest -v --cov tki/ --cov-report=xml
- uses: codecov/codecov-action@v3
60 changes: 40 additions & 20 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.1
hooks:
- id: autopep8
- repo: https://github.com/PyCQA/isort
rev: 5.11.4
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
exclude: tki/tki.py
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: check-case-conflict
- id: detect-private-key
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-added-large-files

- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.2
hooks:
- id: autopep8
args:
- --in-place
- --max-line-length=120

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args:
- --max-line-length=120

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.10.0
hooks:
- id: pretty-format-toml
args: [--autofix]
exclude: poetry.lock
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
8 changes: 4 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: 2

build:
os: "ubuntu-20.04"
os: ubuntu-20.04
tools:
python: "3.10"
python: '3.10'

python:
install:
- method: pip
path: .
- method: pip
path: .
system_packages: true
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
install:
pip install -r requirements-dev.txt
poetry install

test:
python -m pytest --cov tki/
poetry run pytest -v --cov tki/

lint:
pre-commit run -a
poetry run pre-commit run -a
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The package contains an implementation of the article 'Extracting Top-K Insights

## Requirements

- Python3.8+
- Python3.9+

## Setup

Expand Down
Loading

0 comments on commit 374dab6

Please sign in to comment.