Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ If spaCy is already installed in the same environment, this package automaticall
### `push`

```bash
python -m spacy huggingface-hub push [whl_path] [--org] [--msg] [--local-repo] [--verbose]
python -m spacy huggingface-hub push [whl_path] [--org] [--msg] [--local-repo] [--verbose] [--private]
```

```bash
python -m spacy_huggingface_hub push [whl_path] [--org] [--msg] [--local-repo] [--verbose]
python -m spacy_huggingface_hub push [whl_path] [--org] [--msg] [--local-repo] [--verbose] [--private]
```

| Argument | Type | Description |
Expand All @@ -68,6 +68,7 @@ python -m spacy_huggingface_hub push [whl_path] [--org] [--msg] [--local-repo] [
| `--org`, `-o` | str | Optional name of organization to which the pipeline should be uploaded. |
| `--msg`, `-m` | str | Commit message to use for update. Defaults to `"Update spaCy pipeline"`. |
| `--verbose`, `-V` | bool | Output additional info for debugging, e.g. the full generated hub metadata. |
| `--private` | bool | Make the repository private. |

### Usage from Python

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
version = 0.0.10
version = 0.0.11
description = Quickly push your spaCy pipelines to the Hugging Face Hub
url = https://spacy.io
author = Explosion and Hugging Face
Expand Down
7 changes: 4 additions & 3 deletions spacy_huggingface_hub/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ def huggingface_hub_push_cli(
organization: Optional[str] = typer.Option(None, "--org", "-o", help="Name of organization to which the pipeline should be uploaded"),
commit_msg: str = typer.Option("Update spaCy pipeline", "--msg", "-m", help="Commit message to use for update"),
verbose: bool = typer.Option(False, "--verbose", "-V", help="Output additional info for debugging, e.g. the full generated hub metadata"),
private: bool = typer.Option(False, "--private", "-p", help="Make the repository private"),
# fmt: on
):
"""
Push a spaCy pipeline (.whl) to the Hugging Face Hub.
"""
push(whl_path, organization, commit_msg, verbose=verbose)
push(whl_path, organization, commit_msg, verbose=verbose, private=private)


def push(
Expand All @@ -60,6 +61,7 @@ def push(
*,
silent: bool = False,
verbose: bool = False,
private: bool = False,
) -> Dict[str, str]:
msg = Printer(no_print=silent)
whl_path = Path(whl_path)
Expand All @@ -81,8 +83,7 @@ def push(
# Create the repo (or clone its content if it's nonempty)
HfApi().create_repo(
repo_id=repo_id,
# TODO: Can we support private packages as well via a flag?
private=False,
private=private,
exist_ok=True,
)
msg.info(f"Publishing to repository '{repo_id}'")
Expand Down