Skip to content

Commit

Permalink
Merge pull request #3 from iamtatsuki05/develop
Browse files Browse the repository at this point in the history
deploy test env update
  • Loading branch information
iamtatsuki05 authored May 19, 2024
2 parents 2eca788 + 27f6614 commit 3d9a0d5
Show file tree
Hide file tree
Showing 9 changed files with 375 additions and 278 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Tests

on:
pull_request:
branches:
- '**'
workflow_call:
inputs:
check-service-test:
required: false
default: false
type: boolean

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.10.11]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install MeCab dependencies
run: |
sudo apt-get update
sudo apt-get install -y mecab libmecab-dev mecab-ipadic-utf8
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
poetry install
- name: Run tests
run: |
poetry run tox
544 changes: 269 additions & 275 deletions poetry.lock

Large diffs are not rendered by default.

24 changes: 23 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,41 @@ flake8-isort = ">=4.1.1"
flake8-quotes = ">=3.3.1"
flake8-print = ">=4.0.0"
isort = ">=5.10.1"
black = ">=22.10.0"
black = {extras = ["jupyter"], version = "^22.6.0"}
mypy = ">=0.971"
tox = ">=3.25.1"
pre-commit = ">=3.3.3"
nbstripout = "0.6.1"

[tool.isort]
profile = "black"
line_length = 88
multi_line_output = 3
include_trailing_comma = true
skip = [".venv", ".tox"]

[tool.black]
skip-string-normalization = true
include = '\.py$'

[tool.pytest.ini_options]
testpaths = "tests/"

[tool.mypy]
python_version=3.10
files = "src/unlock_pdf_password"
ignore_missing_imports = true
disallow_untyped_defs = true
no_implicit_optional = true
allow_redefinition = true
show_error_codes = true
pretty = true
allow_untyped_globals = true

[tool.flake8]
max-line-length = 119
ignore = "D, E203, W391, W503"
exclude = " .git, .venv, __pycache__, data, dist, misc, notebooks, prof, tmp, workspacea, .tox"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
6 changes: 4 additions & 2 deletions scripts/unlock_pdf_password.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import logging
from typing import Union, Optional
from pathlib import Path
from typing import Optional, Union

import fire

from unlock_pdf_password.unlock_pdf_password import unlock_pdf_password, unlock_pdf
from unlock_pdf_password.unlock_pdf_password import unlock_pdf, unlock_pdf_password

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


def unlock_pdf_password_wrapper(
input_pdf_path: Union[str, Path],
output_pdf_path: Union[str, Path],
Expand Down Expand Up @@ -42,5 +43,6 @@ def unlock_pdf_password_wrapper(
logger.info(f'PDF unlocked successfully! Password: {password}')
logger.error('Password not found')


if __name__ == '__main__':
fire.Fire(unlock_pdf_password)
1 change: 1 addition & 0 deletions src/unlock_pdf_password/env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = '0.1.0'
Empty file added tests/__init__.py
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions tests/unlock_pdf_password/test_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from unlock_pdf_password.env import VERSION


def test_version():
assert VERSION == '0.1.0'
26 changes: 26 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[tox]
envlist = py310, lint

[gh-actions]
python =
3.10: py310, lint

[testenv]
allowlist_externals =
pytest
skip_install = true
commands =
pytest tests/

[testenv:lint]
allowlist_externals =
pflake8
mypy
black
isort
skip_install = true
commands =
# pflake8 --show-source --statistics src/ tests {posargs}
# mypy . {posargs}
black --check . {posargs}
isort --check-only . {posargs}

0 comments on commit 3d9a0d5

Please sign in to comment.