Skip to content

Commit

Permalink
Merge branch 'main' into python-312
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson committed Jul 5, 2024
2 parents 979955d + 3fe7a1c commit 7e07b7a
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 55 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .git-blame-ignore-revs
# Initial formatting with Ruff
2b56cd434a129fe0ab1311f7fe9a65767ed88b9e
57 changes: 21 additions & 36 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,27 @@ on:
push:

jobs:
# cqa:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v3

# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.10"
# cache: pip
# cache-dependency-path: '**/setup.cfg'

# - name: Install test dependencies
# run: |
# python -m pip install --upgrade pip
# pip install --use-deprecated=legacy-resolver -e .[dev]

# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

# - name: Format check with isort
# run: |
# isort --check src

# - name: Format check with black
# run: |
# black --check src

# - name: Security check with bandit
# run: |
# bandit -ll -r src
cqa:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: '**/setup.cfg'

- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install --use-deprecated=legacy-resolver -e .[dev]
- name: Format check with ruff
run: |
ruff format --check src
test:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
- id: ruff-format
args: [ --check ]

8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ build: %:
cqa:
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics
isort --profile black --check src
black --check src
ruff format --check src
bandit -ll -r src

#=> test: execute tests
Expand Down Expand Up @@ -93,13 +93,13 @@ tox:
############################################################################
#= UTILITY TARGETS

#=> reformat: reformat code with yapf and commit
#=> reformat: reformat code with ruff/isort and commit
.PHONY: reformat
reformat:
@if ! git diff --cached --exit-code >/dev/null; then echo "Repository not clean" 1>&2; exit 1; fi
black src tests
ruff format src tests
isort src tests
git commit -a -m "reformatted with black and isort"
git commit -a -m "reformatted with ruff and isort"

#=> rename: rename files and substitute content for new repo name
.PHONY: rename
Expand Down
12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
]
dynamic = ["version"]
Expand All @@ -26,7 +26,6 @@ dependencies = [
[project.optional-dependencies]
dev = [
"bandit ~= 1.7",
"black ~= 22.3",
"build ~= 0.8",
"flake8 ~= 4.0",
"ipython ~= 8.4",
Expand All @@ -38,6 +37,7 @@ dev = [
"pytest-optional-tests",
"pytest ~= 7.1",
"pyright~=1.1",
"ruff == 0.4.4",
"tox ~= 3.25",
"vcrpy",
]
Expand Down Expand Up @@ -111,9 +111,6 @@ exclude_lines = [
"if __name__ == .__main__.:",
]

[tool.black]
line-length = 100

[tool.isort]
profile = "black"
src_paths = ["src", "tests"]
Expand All @@ -128,3 +125,8 @@ disable = "R0913"

[tool.pylint.format]
max-line-length = 100

[tool.ruff]
src = ["src", "tests"]
line-length = 100

4 changes: 1 addition & 3 deletions src/seqrepo_rest_service/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""start seqrepo rest service
"""
"""start seqrepo rest service"""

import argparse
import importlib.resources
Expand Down
3 changes: 1 addition & 2 deletions src/seqrepo_rest_service/refget/routes/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from connexion import NoContent, request

from ...threadglobals import get_seqrepo
from ...utils import (base64url_to_hex, get_sequence_id, problem,
valid_content_types)
from ...utils import base64url_to_hex, get_sequence_id, problem, valid_content_types

_logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions src/seqrepo_rest_service/seqrepo/routes/ping.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import biocommons.seqrepo
import bioutils
from pkg_resources import get_distribution
from importlib import metadata

from ...threadglobals import get_seqrepo

Expand All @@ -9,7 +9,7 @@ def get():
sr = get_seqrepo()

return {
"version": get_distribution("seqrepo-rest-service").version,
"version": metadata.version("seqrepo-rest-service"),
"url": "https://github.com/biocommons/seqrepo-rest-service/",
"dependencies": {
"seqrepo": {
Expand Down
4 changes: 1 addition & 3 deletions src/seqrepo_rest_service/threadglobals.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""per-thread globals for seqrepo REST APIs
"""
"""per-thread globals for seqrepo REST APIs"""

import logging

Expand Down

0 comments on commit 7e07b7a

Please sign in to comment.