diff --git a/README.md b/README.md index c81f6af93..9bdb83bae 100644 --- a/README.md +++ b/README.md @@ -188,8 +188,9 @@ command, or manually by pointing pip to a path or URL. # Download best-matching version of specific model for your spaCy installation python -m spacy download en_core_web_sm -# pip install .tar.gz archive from path or URL +# pip install .tar.gz archive or .whl from path or URL pip install /Users/you/en_core_web_sm-3.0.0.tar.gz +pip install /Users/you/en_core_web_sm-3.0.0-py3-none-any.whl pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz ``` diff --git a/spacy/cli/download.py b/spacy/cli/download.py index 1555531da..dbda8578a 100644 --- a/spacy/cli/download.py +++ b/spacy/cli/download.py @@ -19,7 +19,7 @@ def download_cli( ctx: typer.Context, model: str = Arg(..., help="Name of pipeline package to download"), direct: bool = Opt(False, "--direct", "-d", "-D", help="Force direct download of name + version"), - wheel: bool = Opt(False, "--wheel", "-W", help="Download binary wheel") + sdist: bool = Opt(False, "--sdist", "-S", help="Download sdist (.tar.gz) archive instead of pre-built binary wheel") # fmt: on ): """ @@ -32,10 +32,10 @@ def download_cli( DOCS: https://spacy.io/api/cli#download AVAILABLE PACKAGES: https://spacy.io/models """ - download(model, direct, wheel, *ctx.args) + download(model, direct, sdist, *ctx.args) -def download(model: str, direct: bool = False, wheel: bool = False, *pip_args) -> None: +def download(model: str, direct: bool = False, sdist: bool = False, *pip_args) -> None: if ( not (is_package("spacy") or is_package("spacy-nightly")) and "--no-deps" not in pip_args @@ -49,7 +49,7 @@ def download(model: str, direct: bool = False, wheel: bool = False, *pip_args) - "dependencies, you'll have to install them manually." ) pip_args = pip_args + ("--no-deps",) - suffix = WHEEL_SUFFIX if wheel else SDIST_SUFFIX + suffix = SDIST_SUFFIX if sdist else WHEEL_SUFFIX dl_tpl = "{m}-{v}/{m}-{v}{s}#egg={m}=={v}" if direct: components = model.split("-") diff --git a/website/docs/api/cli.md b/website/docs/api/cli.md index e53fda733..ee70f85b5 100644 --- a/website/docs/api/cli.md +++ b/website/docs/api/cli.md @@ -29,8 +29,6 @@ Download [trained pipelines](/usage/models) for spaCy. The downloader finds the best-matching compatible version and uses `pip install` to download the Python package. Direct downloads don't perform any compatibility checks and require the pipeline name to be specified with its version (e.g. `en_core_web_sm-3.0.0`). -Setting the `--wheel` flag will download a binary wheel file instead of an -archive, which can be faster and more memory efficient. > #### Downloading best practices > @@ -44,14 +42,14 @@ archive, which can be faster and more memory efficient. > project. ```cli -$ python -m spacy download [model] [--wheel] [--direct] [pip_args] +$ python -m spacy download [model] [--direct] [--sdist] [pip_args] ``` | Name | Description | | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `model` | Pipeline package name, e.g. [`en_core_web_sm`](/models/en#en_core_web_sm). ~~str (positional)~~ | -| `--wheel`, `-W` 3 | Download binary wheel package instead of `.tar.gz` archive. Can make download and installation faster and more memory efficient. ~~bool (flag)~~ | | `--direct`, `-D` | Force direct download of exact package version. ~~bool (flag)~~ | +| `--sdist`, `-S` 3 | Download the source package (`.tar.gz` archive) instead of the default pre-built binary wheel. ~~bool (flag)~~ | | `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | | pip args 2.1 | Additional installation options to be passed to `pip install` when installing the pipeline package. For example, `--user` to install to the user home directory or `--no-deps` to not install package dependencies. ~~Any (option/flag)~~ | | **CREATES** | The installed pipeline package in your `site-packages` directory. | diff --git a/website/docs/usage/models.md b/website/docs/usage/models.md index f6f7ff81a..4cfa60151 100644 --- a/website/docs/usage/models.md +++ b/website/docs/usage/models.md @@ -283,9 +283,6 @@ $ python -m spacy download en_core_web_sm # Download exact package version $ python -m spacy download en_core_web_sm-3.0.0 --direct - -# Download binary wheel (can be more efficient) -$ python -m spacy download en_core_web_sm --wheel ``` The download command will [install the package](/usage/models#download-pip) via @@ -306,15 +303,18 @@ doc = nlp("This is a sentence.") To download a trained pipeline directly using [pip](https://pypi.python.org/pypi/pip), point `pip install` to the URL or local -path of the archive file. To find the direct link to a package, head over to the +path of the wheel file or archive. Installing the wheel is usually more +efficient. To find the direct link to a package, head over to the [releases](https://github.com/explosion/spacy-models/releases), right click on the archive link and copy it to your clipboard. ```bash # With external URL +$ pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0-py3-none-any.whl $ pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz # With local file +$ pip install /Users/you/en_core_web_sm-3.0.0-py3-none-any.whl $ pip install /Users/you/en_core_web_sm-3.0.0.tar.gz ``` diff --git a/website/docs/usage/saving-loading.md b/website/docs/usage/saving-loading.md index 38e80db40..f15493fd7 100644 --- a/website/docs/usage/saving-loading.md +++ b/website/docs/usage/saving-loading.md @@ -658,8 +658,9 @@ $ python -m spacy package ./en_example_pipeline ./packages ``` This command will create a pipeline package directory and will run -`python setup.py sdist` in that directory to create `.tar.gz` archive of your -package that can be installed using `pip install`. +`python setup.py sdist` in that directory to create a binary `.whl` file or +`.tar.gz` archive of your package that can be installed using `pip install`. +Installing the binary wheel is usually more efficient. ```yaml ### Directory structure diff --git a/website/src/widgets/quickstart-models.js b/website/src/widgets/quickstart-models.js index 7ed3b911e..5f94c60cb 100644 --- a/website/src/widgets/quickstart-models.js +++ b/website/src/widgets/quickstart-models.js @@ -51,25 +51,16 @@ const data = [ id: 'config', title: 'Options', multiple: true, - options: [ - { - id: 'wheel', - title: 'Download binary wheel', - help: 'Can make download and installation more efficient', - }, - { id: 'example', title: 'Show text example' }, - ], + options: [{ id: 'example', title: 'Show text example' }], }, ] const QuickstartInstall = ({ id, title, description, children }) => { const [lang, setLang] = useState(DEFAULT_LANG) - const [wheel, setWheel] = useState(false) const [efficiency, setEfficiency] = useState(DEFAULT_OPT === 'efficiency') const setters = { lang: setLang, optimize: v => setEfficiency(v.includes('efficiency')), - config: v => setWheel(v.includes('wheel')), } return ( { const exampleText = example || 'No text available yet' return lang !== code ? null : ( - - python -m spacy download {pkg} - {wheel ? ' --wheel' : ''} - + python -m spacy download {pkg} import spacy