Skip to content

Add custom download URL - #13848

Merged
honnibal merged 3 commits into
explosion:masterfrom
etiennebonnafoux:master
Oct 28, 2025
Merged

Add custom download URL#13848
honnibal merged 3 commits into
explosion:masterfrom
etiennebonnafoux:master

Conversation

@etiennebonnafoux

@etiennebonnafoux etiennebonnafoux commented Jul 11, 2025

Copy link
Copy Markdown
Contributor

Description

I add a cli option in the download command to specify a custom url. This is usefuls for people in air gapped environment that should download models from mirror.

Types of change

It is a small enhancement

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

@etiennebonnafoux

Copy link
Copy Markdown
Contributor Author

WIP, I have to write documentation and run the tests.

@etiennebonnafoux

etiennebonnafoux commented Jul 12, 2025

Copy link
Copy Markdown
Contributor Author
  • I ran the tests, and all new and existing tests passed.

@etiennebonnafoux

etiennebonnafoux commented Jul 12, 2025

Copy link
Copy Markdown
Contributor Author
  • I've added all required information in documentation

@honnibal
honnibal merged commit 68679d6 into explosion:master Oct 28, 2025
shaun0927 added a commit to shaun0927/spaCy that referenced this pull request Apr 17, 2026
The custom-URL feature added in explosion#13848 has been broken since release: any
value passed via `--url` is silently dropped (when the URL has no trailing
slash) or rejected by the post-construction guard (when it does), so the
flag cannot succeed under any input.

Two interlocking defects in `download_model`:

1. When `base_url` (= the user's custom URL) lacked a trailing slash, line
   183 reassigned it to `about.__download_url__ + "/"`, discarding the
   user's choice instead of just appending `/`.
2. The line-185 `startswith(about.__download_url__)` guard then rejected
   any URL that *was* preserved, because a custom mirror by definition
   does not start with the GitHub URL.

This change:

  * Appends `/` to the actual `base_url` instead of swapping it for the
    default.
  * Skips the GitHub-origin guard when `custom_url` is provided. The user
    has explicitly opted into a custom source via `--url`; the relative-
    path guard is still in force when no `--url` is passed, preserving
    the protection from explosion#13848's review thread.

Adds a regression test exercising both trailing-slash variants of `--url`
plus the default-URL path so the relative-path rejection from
`test_download_rejects_relative_urls` keeps working.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants