GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — improve julia language support by ericphanson · Pull Request #3494 · pre-commit/pre-commit

Conversation

@ericphanson

@ericphanson ericphanson commented Jul 21, 2025

Copy link
Copy Markdown
Contributor

This PR fixes three issues I ran into when trying to use pre-commit's native Julia language support for ExplicitImports.jl (JuliaTesting/ExplicitImports.jl#100) in Pkg (JuliaLang/Pkg.jl#4326):

  1. Adds --startup-file=no to both invocations of Julia (install & run). The startup file is a Julia script that users can configure to run commands before the start of their Julia session. It is typically used to load developer packages like Revise and not used "in-production". Here when we run our pre-commit hooks we do not want to run the user's startup file which could have dependencies the current environment does not have.
  2. Copies src files in addition to Project/Manifest. This allows pre-commit hooks to live inside a package (like https://github.com/JuliaTesting/ExplicitImports.jl/blob/main/.pre-commit-hooks.yaml) instead of being in a separate repo (like https://github.com/fredrikekre/runic-pre-commit).
  3. Adds basic support for customizing the Julia version by setting the JULIAUP_CHANNEL environmental variable. This support is limited in a couple ways:
    • We don't check that the user is using juliaup. They could have installed julia some other way in which case the JULIAUP_CHANNEL does not do anything and setting the language_version will not have any effect. That however is the status quo (currently setting the language_version does not have any effect) and many users use juliaup, so I think we could just document that language_version support requires your julia to be from juliaup.
    • If the user passes a channel which is not installed, they will get a juliaup error that the channel can not be found. If we were confident they were using juliaup we could install it on their behalf instead, but I'm not sure this is necessary.

With these changes, JuliaLang/Pkg.jl#4329 can run successfully.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ericphanson and others added 2 commits July 21, 2025 15:57
@ericphanson
improve julia support
a7f8efa
@pre-commit-ci
[pre-commit.ci] auto fixes from pre-commit.com hooks
9583b19
for more information, see https://pre-commit.ci
@ericphanson ericphanson mentioned this pull request Jul 21, 2025
Add explicit-imports pre-commit hook JuliaLang/Pkg.jl#4329
Closed
@ericphanson
make flake and mypy happier
0c54b47
@ericphanson ericphanson mentioned this pull request Jul 21, 2025
Add native-julia pre-commit hook JuliaTesting/ExplicitImports.jl#128
Draft
ericphanson added 3 commits July 21, 2025 16:37
@ericphanson
add
5501721
@ericphanson
add test for julia version support
ae6f19d
@ericphanson
add channel
f2837cf
asottile
asottile reviewed Jul 21, 2025
View reviewed changes

@asottile asottile left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

rather than doing 3 or 4 things in a pr please split this up to do one thing at a time with clear tests demonstrating the reason for changes

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ericphanson reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread pre_commit/languages/julia.py Outdated
)
]
if version not in ('system', 'default'):
patches.append(('JULIAUP_CHANNEL', version))

@asottile asottile Jul 21, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ericphanson ericphanson Jul 21, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pre_commit/languages/julia.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pre_commit/languages/julia.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/languages/julia_test.py

def _make_src_hook(tmp_path, pkg_code, script_code):
# here we have a package with a src dir and a script dir
src_dir = tmp_path.joinpath('src')

@asottile asottile Jul 21, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

feels like from this test this should get handled by the install process. the precedence of copying little bits out of this seems not great and we should find a way to do this step by step

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ericphanson ericphanson Jul 21, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

this is in the tests, so we're setting up an example with test files which do get copied as part of the install process

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ericphanson added 2 commits July 21, 2025 17:42
@ericphanson
copy rust's pattern for conditional env
9a04b39
@ericphanson
restore comment
1ba5581
This was referenced Jul 21, 2025
Julia language: skip startup.jl file #3496
Merged
Julia: copy src files #3497
Open
Julia: support language_version #3498
Open
@ericphanson

ericphanson commented Jul 21, 2025

Copy link
Copy Markdown
Contributor Author

split into

  • Julia language: skip startup.jl file #3496
  • Julia: copy src files #3497
  • Julia: support language_version #3498
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ericphanson ericphanson closed this Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@asottile asottile asottile left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ericphanson @asottile
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.