{"id":13484669,"url":"https://github.com/Kaggle/kaggle-api","last_synced_at":"2025-03-27T16:31:12.100Z","repository":{"id":37418503,"uuid":"118854343","full_name":"Kaggle/kaggle-api","owner":"Kaggle","description":"Official Kaggle API","archived":false,"fork":false,"pushed_at":"2024-05-21T08:03:20.000Z","size":13354,"stargazers_count":5948,"open_issues_count":151,"forks_count":1050,"subscribers_count":198,"default_branch":"main","last_synced_at":"2024-05-22T04:32:29.779Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kaggle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-25T03:02:39.000Z","updated_at":"2024-06-06T16:30:36.895Z","dependencies_parsed_at":"2022-07-07T23:11:35.571Z","dependency_job_id":"c83174fc-409e-4d74-898e-785237ca24ce","html_url":"https://github.com/Kaggle/kaggle-api","commit_stats":{"total_commits":144,"total_committers":38,"mean_commits":3.789473684210526,"dds":0.7291666666666667,"last_synced_commit":"75dfa27d3c2886ea46e4d0c6bfcc0cc322af554b"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaggle%2Fkaggle-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaggle%2Fkaggle-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaggle%2Fkaggle-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaggle%2Fkaggle-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kaggle","download_url":"https://codeload.github.com/Kaggle/kaggle-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245882338,"owners_count":20687868,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:01:29.166Z","updated_at":"2025-03-27T16:31:12.094Z","avatar_url":"https://github.com/Kaggle.png","language":"Python","readme":"# Kaggle API\r\n\r\nOfficial API for https://www.kaggle.com, accessible using a command line tool implemented in Python 3.  \r\n\r\n[User documentation](docs/README.md)\r\n\r\n## Installation\r\n\r\nEnsure you have Python 3 and the package manager `pip` installed.\r\n\r\nRun the following command to access the Kaggle API using the command line:\r\n\r\n```sh\r\npip install kaggle\r\n```\r\n\r\n## Development\r\n\r\n### Kaggle Internal\r\n\r\nObviously, this depends on Kaggle services. When you're extending the API and modifying\r\nor adding to those services, you should be working in your Kaggle mid-tier development\r\nenvironment. You'll run Kaggle locally, in the container, and test the Python code by\r\nrunning it in the container so it can connect to your local testing environment.\r\n\r\nAlso, run the following command to get `autogen.sh` installed:\r\n```bash\r\nrm -rf /tmp/autogen \u0026\u0026 mkdir -p /tmp/autogen \u0026\u0026 unzip -qo /tmp/autogen.zip -d /tmp/autogen \u0026\u0026\r\nmv /tmp/autogen/autogen-*/* /tmp/autogen \u0026\u0026 rm -rf /tmp/autogen/autogen-* \u0026\u0026\r\nsudo chmod a+rx /tmp/autogen/autogen.sh\r\n```\r\n\r\n### Prerequisites\r\n\r\nWe use [hatch](https://hatch.pypa.io) to manage this project.\r\n\r\nFollow these [instructions](https://hatch.pypa.io/latest/install/) to install it.\r\n\r\nIf you are working in a managed environment, you may want to use `pipx`. If it isn't already installed\r\ntry `sudo apt install pipx`. Then you should be able to proceed with `pipx install hatch`.\r\n\r\n### Dependencies\r\n\r\n```sh\r\nhatch run install-deps\r\n```\r\n\r\n### Compile\r\n\r\n```sh\r\nhatch run compile\r\n```\r\n\r\nThe compiled files are generated in the `kaggle/` directory from the `src/` directory.\r\n\r\nAll the changes must be done in the `src/` directory.\r\n\r\n### Run\r\n\r\nYou can also run the code in python directly:\r\n\r\n```sh\r\nhatch run python\r\n```\r\n\r\n```python\r\nimport kaggle\r\nfrom kaggle.api.kaggle_api_extended import KaggleApi\r\napi = KaggleApi()\r\napi.authenticate()\r\napi.model_list_cli()\r\n\r\nNext Page Token = [...]\r\n[...]\r\n\r\n```\r\n\r\nOr in a single command:\r\n\r\n```sh\r\nhatch run python -c \"import kaggle; from kaggle.api.kaggle_api_extended import KaggleApi; api = KaggleApi(); api.authenticate(); api.model_list_cli()\"\r\n```\r\n\r\n### Example\r\n\r\nLet's change the `model_list_cli` method in the source file: \r\n\r\n```sh\r\n❯ git diff src/kaggle/api/kaggle_api_extended.py\r\n[...]\r\n+        print('hello Kaggle CLI update')^M\r\n         models = self.model_list(sort_by, search, owner, page_size, page_token)\r\n[...]\r\n\r\n❯ hatch run compile\r\n[...]\r\n\r\n❯ hatch run python -c \"import kaggle; from kaggle.api.kaggle_api_extended import KaggleApi; api = KaggleApi(); api.authenticate(); api.model_list_cli()\"\r\nhello Kaggle CLI update\r\nNext Page Token = [...]\r\n```\r\n\r\n### Integration Tests\r\n\r\nTo run integration tests on your local machine, you need to set up your Kaggle API credentials. You can do this in one of these two ways described [this doc](docs/README.md). Refer to the sections: \r\n- Using environment variables\r\n- Using credentials file\r\n\r\nAfter setting up your credentials by any of these methods, you can run the integration tests as follows:\r\n\r\n```sh\r\n# Run all tests\r\nhatch run integration-test\r\n```\r\n\r\n## License\r\n\r\nThe Kaggle API is released under the [Apache 2.0 license](LICENSE).\r\n","funding_links":[],"categories":["Python","工作流程和实验跟踪","其他_机器学习与深度学习"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKaggle%2Fkaggle-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKaggle%2Fkaggle-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKaggle%2Fkaggle-api/lists"}