Skip to content

Commit

Permalink
Merge branch 'comictagger:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mizaki authored Sep 16, 2023
2 parents 87887fe + 9b5a8d7 commit 646ac70
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
pull_request:
push:
branches:
- '**'

jobs:
build-and-publish:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python_version: ['3.9']
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

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


- name: Install build dependencies
run: |
python -m pip install --upgrade --upgrade-strategy eager -r requirements-dev.txt
- name: Build and install wheel
run: |
tox run -m build
python -m pip install dist/*.whl
55 changes: 55 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI

on:
pull_request:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"

jobs:
build-and-publish:
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install build dependencies
run: |
python -m pip install --upgrade --upgrade-strategy eager -r requirements-dev.txt
- name: Build and install wheel
run: |
tox run -m build
python -m pip install dist/*.whl
- name: "Publish distribution 📦 to PyPI"
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@release/v1

- name: Get release name
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* # github is dumb
echo "release_name=$(git tag -l --format "%(refname:strip=2): %(contents:lines=1)" ${{ github.ref_name }})" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: "${{ env.release_name }}"
draft: false
files: |
dist/*.whl
85 changes: 85 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion

*.iml

## Directory-based project format:
.idea/

### Other editors
.*.swp
nbproject/
.vscode

*.exe
*.zip

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# for testing
temp/
tmp/
2 changes: 1 addition & 1 deletion metron_talker/metron.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MetronSeriesType(Enum):


class MetronEncoder(json.JSONEncoder):
def default(self, obj):
def default(self, obj: Any) -> Any:
if isinstance(obj, (datetime, date)):
return obj.isoformat()
if isinstance(obj, decimal.Decimal):
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
black>=22
build
flake8==4.*
flake8-black
flake8-encodings
Expand All @@ -8,4 +9,5 @@ isort>=5.10
pytest==7.*
setuptools>=42
setuptools_scm[toml]>=3.4
tox
wheel
72 changes: 72 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,75 @@ dev =
setuptools>=42
setuptools-scm[toml]>=3.4
wheel

[tox:tox]
envlist = py3.9

[testenv]
deps = -rrequirements-dev.txt
commands =
coverage erase
coverage run -m pytest {posargs:tests}
coverage report

[testenv:wheel]
description = Generate wheel and tar.gz
labels =
release
build
skip_install = true
deps =
build
commands_pre =
-python -c 'import shutil,pathlib; \
shutil.rmtree("./build/", ignore_errors=True); \
shutil.rmtree("./dist/", ignore_errors=True)'
commands =
python -m build

[testenv:pypi-upload]
description = Upload wheel to PyPi
platform = Linux
labels =
release
skip_install = true
depends = wheel
deps =
twine
passenv =
TWINE_*
setenv =
TWINE_NON_INTERACTIVE=true
commands =
python -m twine upload dist/*.whl dist/*.tar.gz

[pep8]
ignore = E265,E501
max_line_length = 120

[flake8]
extend-ignore = E501, A003
max_line_length = 120
per-file-ignores =
*_test.py: LN001

[coverage:run]
plugins = covdefaults

[coverage:report]
fail_under = 95

[mypy]
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true

[mypy-testing.*]
disallow_untyped_defs = false

[mypy-tests.*]
disallow_untyped_defs = false

0 comments on commit 646ac70

Please sign in to comment.