Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pidlock to public functions #45

Merged
merged 13 commits into from
Feb 9, 2025
Prev Previous commit
Next Next commit
ruff
  • Loading branch information
willow-ahrens committed Jan 6, 2025
commit 59243fd5e1f71262569ad64ef3d9b1d39a298f70
18 changes: 9 additions & 9 deletions src/juliapkg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from .deps import (
PkgSpec,
add,
executable,
offline,
project,
require_julia,
resolve,
rm,
status,
PkgSpec,
add,
executable,
offline,
project,
require_julia,
resolve,
rm,
status,
)

__all__ = [
5 changes: 3 additions & 2 deletions src/juliapkg/deps.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
from .compat import Compat, Version
from .find_julia import find_julia, julia_version
from .install_julia import log
from .state import STATE, thread_lock, process_lock
from .state import STATE, process_lock, thread_lock

logger = logging.getLogger("juliapkg")

@@ -314,7 +314,8 @@ def resolve(force=False, dry_run=False):
log(f"Using Julia project at {project}")
os.makedirs(project, exist_ok=True)
if not STATE["offline"]:
# write a Project.toml specifying UUIDs and compatibility of required packages
# write a Project.toml specifying UUIDs and compatibility of required
# packages
with open(os.path.join(project, "Project.toml"), "wt") as fp:
print("[deps]", file=fp)
for pkg in pkgs:
6 changes: 3 additions & 3 deletions src/juliapkg/find_julia.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

from .compat import Compat, Version
from .install_julia import best_julia_version, get_short_arch, install_julia, log
from .state import STATE, thread_lock, process_lock
from .state import STATE, process_lock, thread_lock


def julia_version(exe):
@@ -51,8 +51,8 @@ def find_julia(compat=None, prefix=None, install=False, upgrade=False):
else:
if compat is not None and ev_ver not in compat:
log(
f"WARNING: juliapkg_exe={ev_exe} is Julia {ev_ver} but {compat} is"
" required."
f"WARNING: juliapkg_exe={ev_exe} is Julia {ev_ver} but {compat}"
"is required."
)
return (ev_exe, ev_ver)
# first look in the prefix
1 change: 1 addition & 0 deletions src/juliapkg/state.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
from threading import RLock

from filelock import FileLock

thread_lock = RLock()
6 changes: 3 additions & 3 deletions test/test_all.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import json
import os
import subprocess
import tempfile
from multiprocessing import Pool

import juliapkg
import subprocess
from multiprocessing import Pool


def test_import():
@@ -25,7 +25,7 @@ def test_resolve():

def resolve_in_tempdir(tempdir):
subprocess.run(
["python", "-c", f"import juliapkg; juliapkg.resolve()"],
["python", "-c", "import juliapkg; juliapkg.resolve()"],
env=dict(os.environ, PYTHON_JULIAPKG_PROJECT=tempdir),
)