{"id":13523876,"url":"https://github.com/dfinity/pocketic-py","last_synced_at":"2025-09-02T16:56:25.251Z","repository":{"id":191805031,"uuid":"681071607","full_name":"dfinity/pocketic-py","owner":"dfinity","description":"PocketIC Python: A Canister Testing Library for the Internet Computer","archived":false,"fork":false,"pushed_at":"2025-03-17T21:21:43.000Z","size":732,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T11:15:39.366Z","etag":null,"topics":["canister","canisters","dfinity","icp","internet-computer","internet-computer-protocol","python","smart-contract","smart-contracts","testing","testing-tools"],"latest_commit_sha":null,"homepage":"https://internetcomputer.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dfinity.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-21T07:46:07.000Z","updated_at":"2025-02-27T19:11:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"4dba3e80-1000-42cb-82ef-582c0a13cb78","html_url":"https://github.com/dfinity/pocketic-py","commit_stats":{"total_commits":84,"total_committers":7,"mean_commits":12.0,"dds":0.6666666666666667,"last_synced_commit":"609569d4f1cab76c7bb34029cf9194ae0085fba8"},"previous_names":["dfinity/pocketic-py"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfinity%2Fpocketic-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfinity%2Fpocketic-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfinity%2Fpocketic-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfinity%2Fpocketic-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dfinity","download_url":"https://codeload.github.com/dfinity/pocketic-py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246567435,"owners_count":20798171,"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":["canister","canisters","dfinity","icp","internet-computer","internet-computer-protocol","python","smart-contract","smart-contracts","testing","testing-tools"],"created_at":"2024-08-01T06:01:04.706Z","updated_at":"2025-09-02T16:56:25.242Z","avatar_url":"https://github.com/dfinity.png","language":"Python","readme":"# PocketIC Python: A Canister Testing Library\n\n[PocketIC](https://github.com/dfinity/pocketic) is a local canister testing solution for the [Internet Computer](https://internetcomputer.org/).  \nThis testing library works together with the **PocketIC server**, allowing you to interact with your local IC instances and the canisters thereon. \n\nWith PocketIC Python, you can test your canisters with just a few lines of code, either by interacting with an IC instance:\n\n```python\nfrom pocket_ic import PocketIC\n\npic = PocketIC()\ncanister_id = pic.create_canister()\npic.add_cycles(canister_id, 2_000_000_000_000)  # 2T cycles\npic.install_code(...)\n\n# make canister calls\nresponse = pic.update_call(canister_id, method=\"greet\", ...)\nassert(response == 'Hello, PocketIC!')\n```\n... or even directly with a canister object:\n```python\nmy_canister = pic.create_and_install_canister_with_candid(...)\n# call your canister methods with native Python syntax\nresponse = my_canister.greet()\nassert(response == 'Hello, PocketIC!')\n```\n\n## Getting Started\n\n### Quickstart\n* Download the latest **PocketIC server** from the [PocketIC repo](https://github.com/dfinity/pocketic) that is [compatible](https://docs.google.com/document/d/1VYmHUTjrgbzRHtsAyRrI5cj-gWGs7ktTnutPvUMJioU) with the library version you're using.\n* Leave the binary in your current working directory, or specify the path to the binary by setting the `POCKET_IC_BIN` environment variable before running your tests.\n* Run `pip3 install pocket-ic` in your (virtual) environment to get the Python library. \n* Use `from pocket_ic import PocketIC` in your Python code and start testing!\n\n### Examples\n\nTo see some working code, see the [examples/](https://github.com/dfinity/pocketic-py/tree/main/examples) folder, or check out the [how to use this library](https://github.com/dfinity/pocketic-py/blob/main/HOWTO.md) guide.\nTo run an example, clone this repo and run `python3 examples/counter_canister/counter_canister_test.py` from the repository's root directory.\nTo see a minimalistic setup of PocketIC in a Motoko project, check out the [ICP Hello World Motoko](https://github.com/dfinity/icp-hello-world-motoko/blob/main/README.md#testing-your-project) repository. \n\n## Documentation\n* [How to use this library](https://github.com/dfinity/pocketic-py/blob/main/HOWTO.md)\n* [PocketIC repo](https://github.com/dfinity/pocketic)\n* [PocketIC server compatibility](https://docs.google.com/document/d/1VYmHUTjrgbzRHtsAyRrI5cj-gWGs7ktTnutPvUMJioU)\n* [Why PocketIC](https://github.com/dfinity/pocketic#why-pocketic)\n* [Changelog of PocketIC Python](https://github.com/dfinity/pocketic-py/blob/main/CHANGELOG.md)\n\n\n## Contributing\nSee [CONTRIBUTING.md](https://github.com/dfinity/pocketic-py/blob/main/CONTRIBUTING.md)\n\n","funding_links":[],"categories":["Developer Tooling"],"sub_categories":["Testing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfinity%2Fpocketic-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdfinity%2Fpocketic-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfinity%2Fpocketic-py/lists"}