Skip to content

Commit

Permalink
Merge pull request #13 from pomponchik/develop
Browse files Browse the repository at this point in the history
0.0.11
  • Loading branch information
pomponchik authored Jan 7, 2024
2 parents 8c3259d + 99aae3a commit 7988ada
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- name: Run mypy
shell: bash
run: mypy locklib --check-untyped-defs
run: mypy locklib --strict

- name: Run ruff
shell: bash
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release

on:
push:
branches:
- main

jobs:
pypi-publish:
name: upload release to PyPI
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

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

- name: Install dependencies
shell: bash
run: pip install -r requirements_dev.txt

- name: Build the project
shell: bash
run: python -m build .

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Downloads](https://static.pepy.tech/badge/locklib/month)](https://pepy.tech/project/locklib)
[![Downloads](https://static.pepy.tech/badge/locklib)](https://pepy.tech/project/locklib)
[![codecov](https://codecov.io/gh/pomponchik/locklib/graph/badge.svg?token=O9G4FD8QFC)](https://codecov.io/gh/pomponchik/locklib)
[![Hits-of-Code](https://hitsofcode.com/github/pomponchik/locklib?branch=main)](https://hitsofcode.com/github/pomponchik/locklib/view?branch=main)
[![Test-Package](https://github.com/pomponchik/locklib/actions/workflows/tests_and_coverage.yml/badge.svg)](https://github.com/pomponchik/locklib/actions/workflows/tests_and_coverage.yml)
[![Python versions](https://img.shields.io/pypi/pyversions/locklib.svg)](https://pypi.python.org/pypi/locklib)
[![PyPI version](https://badge.fury.io/py/locklib.svg)](https://badge.fury.io/py/locklib)
Expand Down
4 changes: 2 additions & 2 deletions locklib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from locklib.locks.smart_lock.lock import SmartLock # noqa: F401
from locklib.errors import DeadLockError # noqa: F401
from locklib.locks.smart_lock.lock import SmartLock as SmartLock # noqa: F401
from locklib.errors import DeadLockError as DeadLockError # noqa: F401
2 changes: 1 addition & 1 deletion locklib/locks/smart_lock/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class LocksGraph:
def __init__(self):
def __init__(self) -> None:
self.links: DefaultDict[int, Set[int]] = defaultdict(set)
self.lock: Lock = Lock()

Expand Down
9 changes: 5 additions & 4 deletions locklib/locks/smart_lock/lock.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
try:
from threading import Lock, get_native_id # type: ignore
from threading import Lock, get_native_id # type: ignore[attr-defined]
except ImportError: # pragma: no cover
from threading import Lock, get_ident as get_native_id # get_native_id is available only since python 3.8

from collections import deque
from typing import Deque, Dict
from typing import Type, Deque, Dict
from types import TracebackType

from locklib.locks.smart_lock.graph import LocksGraph

Expand Down Expand Up @@ -57,8 +58,8 @@ def release(self) -> None:

lock.release()

def __enter__(self):
def __enter__(self) -> None:
self.acquire()

def __exit__(self, exception_type, exception_value, traceback):
def __exit__(self, exception_type: Type[BaseException], exception_value: BaseException, traceback: TracebackType) -> None:
self.release()
Empty file added locklib/py.typed
Empty file.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'

[project]
name = 'locklib'
version = '0.0.10'
version = '0.0.11'
authors = [
{ name='Evgeniy Blinov', email='zheni-b@yandex.ru' },
]
Expand All @@ -27,6 +27,9 @@ classifiers = [
'Intended Audience :: Developers',
]

[tool.setuptools.package-data]
"locklib" = ["py.typed"]

[project.urls]
'Source' = 'https://github.com/pomponchik/locklib'
'Tracker' = 'https://github.com/pomponchik/locklib/issues'

0 comments on commit 7988ada

Please sign in to comment.