Skip to content

Commit

Permalink
fix local env
Browse files Browse the repository at this point in the history
  • Loading branch information
Philmod committed Mar 26, 2024
1 parent b89152e commit e91e072
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
38 changes: 31 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,42 @@ hatch run python
```

```python
Python 3.11.7 (main, Dec 8 2023, 14:22:46) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import kaggle
>>> from kaggle.api.kaggle_api_extended import KaggleApi
>>> api = KaggleApi()
>>> api.authenticate()
>>> api.model_list_cli()
import kaggle
from kaggle.api.kaggle_api_extended import KaggleApi
api = KaggleApi()
api.authenticate()
api.model_list_cli()

Next Page Token = [...]
[...]

```

Or in a single command:

```sh
hatch run python -c "import kaggle; from kaggle.api.kaggle_api_extended import KaggleApi; api = KaggleApi(); api.authenticate(); api.model_list_cli()"
```

### Example

Let's change the `model_list_cli` method in the source file:

```sh
❯ git diff src/kaggle/api/kaggle_api_extended.py
[...]
+ print('hello Kaggle CLI update')^M
models = self.model_list(sort_by, search, owner, page_size, page_token)
[...]

❯ hatch run compile
[...]

❯ hatch run python -c "import kaggle; from kaggle.api.kaggle_api_extended import KaggleApi; api = KaggleApi(); api.authenticate(); api.model_list_cli()"
hello Kaggle CLI update
Next Page Token = [...]
```

## License

The Kaggle API is released under the [Apache 2.0 license](LICENSE).
3 changes: 2 additions & 1 deletion tools/GeneratePythonLibrary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ cd $SELF_DIR

SWAGGER_YAML=$SELF_DIR/src/KaggleSwagger.yaml
SWAGGER_CONFIG=$SELF_DIR/src/KaggleSwaggerConfig.json
KAGGLE_DEV_CONFIG_DIR=$(realpath ~/.kaggle)
mkdir -p ~/.kaggle/dev
KAGGLE_DEV_CONFIG_DIR=$(realpath ~/.kaggle/dev)

trap cleanup EXIT

Expand Down

0 comments on commit e91e072

Please sign in to comment.