Skip to content

Commit

Permalink
adding file lock to run tests in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadRaziei committed Nov 19, 2023
1 parent adef44b commit 2c506a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "scikit_build_core.build"

[project]
name = "liburlparser"
version = "1.4.2"
version = "1.4.3"
description = "Fastest Url parser in the world"
readme = "README.md"
authors = [
Expand All @@ -26,7 +26,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
]
dependencies = [
# "requests"
"filelock"
]

[project.optional-dependencies]
Expand Down Expand Up @@ -93,7 +93,6 @@ select = [
"T20", # flake8-print
"UP", # pyupgrade
"YTT", # flake8-2020
# "EXE", # flake8-executable
"NPY", # NumPy specific rules
"PD", # pandas-vet
]
Expand Down
5 changes: 4 additions & 1 deletion src/liburlparser/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from __future__ import annotations

import warnings
from filelock import FileLock
from pathlib import Path

from ._core import Host, Psl, Url, __doc__, __version__


psl = Psl() # psl

Check failure on line 11 in src/liburlparser/core.py

View workflow job for this annotation

GitHub Actions / Build SDist

Ruff (I001)

src/liburlparser/core.py:2:1: I001 Import block is un-sorted or un-formatted


Expand Down Expand Up @@ -33,7 +35,8 @@ def psl_update():
if not psl.is_loaded():
psl_filename = Path(__file__).parent / psl.filename
if psl_filename.exists():
psl.load_from_path(psl_filename.as_posix())
with FileLock(psl_filename.with_suffix(".lock")):
psl.load_from_path(psl_filename.as_posix())
else:
warnings.warn(
"Cannot find Public_suffix_list.dat. you must import it with \"psl.load_from_path\" or \"psl.load_from_string\" or \"psl.update\" functions",
Expand Down

0 comments on commit 2c506a2

Please sign in to comment.