Visitar URL original
improve julia language support by ericphanson · Pull Request #3494 · pre-commit/pre-commit · GitHub
Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 21, 2025
commit 9583b19216c66af72518ae84067d9f0fe55cc4ee
7 changes: 5 additions & 2 deletions pre_commit/languages/julia.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,24 @@ def run_hook(
color=color,
)


def get_env_patch(target_dir: str, version: str) -> PatchesT:
patches = [
('JULIA_LOAD_PATH', target_dir),
('JULIA_PROJECT', UNSET),
]
if version not in ("system", "default"):
if version not in ('system', 'default'):
patches.append(('JULIAUP_CHANNEL', version))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't quite right. to properly support language_version pre-commit must install the language itself into the hook environment (and not outside of it such as in the juliaup managed directories)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, pre-commit wants an entire copy of julia installed into the hook environment directory? that's very unusual for julia, which uses content-addressed read-only files and packages to allow reuse across environments. It would also make pre-commit install much slower for julia hooks than it currently is.

return tuple(patches)


@contextlib.contextmanager
def in_env(prefix: Prefix, version: str) -> Generator[None]:
envdir = lang_base.environment_dir(prefix, ENVIRONMENT_DIR, version)
with envcontext(get_env_patch(envdir, version)):
yield


def install_environment(
prefix: Prefix,
version: str,
Expand Down Expand Up @@ -95,7 +98,7 @@ def install_environment(
break

# copy `src` files if they exist
src_dir = prefix.path("src")
src_dir = prefix.path('src')
if os.path.isdir(src_dir):
shutil.copytree(src_dir, os.path.join(envdir, 'src'))

Expand Down