Skip to content

Commit

Permalink
Merge pull request #4 from simonsobs/dev
Browse files Browse the repository at this point in the history
Update `pyproject.toml` and GitHub Actions workflows
  • Loading branch information
TaiSakuma authored Feb 8, 2024
2 parents 726485e + d816a9c commit a276674
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 122 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/test.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check static types

on:
push:
branches:
- "**"
pull_request:
branches:
- "**"

jobs:
run:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install packages
run: |
pip install --upgrade pip
pip install -e '.[tests]'
pip install --upgrade mypy
- name: Run mypy
run: mypy --show-traceback src/
50 changes: 50 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Run unit tests

on:
push:
branches:
- "**"
pull_request:
branches:
- "**"

concurrency:
group: unit-test-${{ github.head_ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
run:
name: Python ${{ matrix.python-version }} on Linux
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3

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

- name: Install packages
run: |
pip install --upgrade pip
pip install -e '.[tests]'
pip list
- name: Run tests
run: pytest -vv --cov --cov-report=xml

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# fail_ci_if_error: true
# verbose: true
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[![PyPI - Version](https://img.shields.io/pypi/v/nextline-alert.svg)](https://pypi.org/project/nextline-alert)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nextline-alert.svg)](https://pypi.org/project/nextline-alert)
[![Test Status](https://github.com/simonsobs/nextline-alert/actions/workflows/unit-test.yml/badge.svg)](https://github.com/simonsobs/nextline-alert/actions/workflows/unit-test.yml)
[![Test Status](https://github.com/simonsobs/nextline-alert/actions/workflows/type-check.yml/badge.svg)](https://github.com/simonsobs/nextline-alert/actions/workflows/type-check.yml)

A plugin for [nextline-graphql](https://github.com/simonsobs/nextline-graphql).
Emit alerts to [Campana](https://github.com/simonsobs/campana)
Expand Down
84 changes: 1 addition & 83 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = ["httpx>=0.26"]
dependencies = ["nextline-graphql>=0.7.3", "httpx>=0.26"]
dynamic = ["version"]

[project.optional-dependencies]
Expand All @@ -46,91 +46,10 @@ source = "regex_commit"
path = "src/nextline_alert/__about__.py"
tag_sign = false

[tool.hatch.envs.default]
dependencies = ["coverage[toml]>=6.5", "pytest"]
[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
test-cov = "coverage run -m pytest {args:tests}"
cov-report = ["- coverage combine", "coverage report"]
cov = ["test-cov", "cov-report"]

[[tool.hatch.envs.all.matrix]]
python = ["3.10", "3.11", "3.12"]

[tool.hatch.envs.lint]
detached = true
dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive {args:src/nextline_alert tests}"
style = ["ruff {args:.}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff --fix {args:.}", "style"]
all = ["style", "typing"]

[tool.black]
skip-string-normalization = true
target_version = ['py310', 'py311', 'py312']

[tool.ruff]
target-version = "py37"
line-length = 120
select = [
"A",
"ARG",
"B",
"C",
"DTZ",
"E",
"EM",
"F",
"FBT",
"I",
"ICN",
"ISC",
"N",
"PLC",
"PLE",
"PLR",
"PLW",
"Q",
"RUF",
"S",
"T",
"TID",
"UP",
"W",
"YTT",
]
ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
# Ignore checks for possible passwords
"S105",
"S106",
"S107",
# Ignore complexity
"C901",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
]
unfixable = [
# Don't touch unused imports
"F401",
]

[tool.ruff.isort]
known-first-party = ["nextline_alert"]

[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = ["PLR2004", "S101", "TID252"]

[tool.coverage.run]
source_pkgs = ["nextline_alert", "tests"]
branch = true
Expand All @@ -144,7 +63,6 @@ tests = ["tests", "*/nextline-alert/tests"]
[tool.coverage.report]
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]


[tool.isort]
profile = "black"

Expand Down

0 comments on commit a276674

Please sign in to comment.