diff --git a/README.md b/README.md index 30478fb..6462596 100644 --- a/README.md +++ b/README.md @@ -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 | @@ -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 diff --git a/setup.cfg b/setup.cfg index 2518fce..a51110a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/spacy_huggingface_hub/push.py b/spacy_huggingface_hub/push.py index 3583a2b..6046fa3 100644 --- a/spacy_huggingface_hub/push.py +++ b/spacy_huggingface_hub/push.py @@ -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( @@ -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) @@ -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}'")