{"id":16992466,"url":"https://github.com/ogvalt/triton-testcontainer","last_synced_at":"2025-07-24T08:11:38.798Z","repository":{"id":231496106,"uuid":"781553243","full_name":"ogvalt/triton-testcontainer","owner":"ogvalt","description":"Package for running Nvidia Triton within python test with features like Dockerfile DSL and building images on fly.","archived":false,"fork":false,"pushed_at":"2024-05-21T15:16:52.000Z","size":376,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T11:52:04.831Z","etag":null,"topics":["docker","dockerfile","pytest","python","testcontainers","triton"],"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/ogvalt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-03T15:46:45.000Z","updated_at":"2024-09-30T14:19:30.000Z","dependencies_parsed_at":"2024-05-21T16:29:36.890Z","dependency_job_id":"991594dd-7f27-44ba-ac2a-343f1395afb8","html_url":"https://github.com/ogvalt/triton-testcontainer","commit_stats":null,"previous_names":["ogvalt/triton-testcontainer"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ogvalt/triton-testcontainer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogvalt%2Ftriton-testcontainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogvalt%2Ftriton-testcontainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogvalt%2Ftriton-testcontainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogvalt%2Ftriton-testcontainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ogvalt","download_url":"https://codeload.github.com/ogvalt/triton-testcontainer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ogvalt%2Ftriton-testcontainer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266813514,"owners_count":23988545,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["docker","dockerfile","pytest","python","testcontainers","triton"],"created_at":"2024-10-14T03:29:14.497Z","updated_at":"2025-07-24T08:11:38.749Z","avatar_url":"https://github.com/ogvalt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Triton Testcontainer\n\nThis package started as an implementation of testcontainer module for Nvidi Triton, but also added other functionality that extends beyond simply running containers withing pytest.\n\n## Usage\n\nThis package provides several functions:\n* triton container (class `TritonContainer`): manage tritonserver container within a testsuite.\n\n* dockerfile builder (class `DockerfileBuilder`): Dockerfile DSL for generating dockerfiles programatically.\n\n* docker image builder (class `ImageBuilder`): Builing images on fly, e.g. within a testsuite.\n\n## Installation\n\n```bash\npip3 install git+https://github.com/ogvalt/triton-testcontainer.git@v0.6.1\n```\n    \n## Examples\n\n```python\nimport pytest\nimport triton_testcontainer as tritoncontainer\n\n\n@pytest.fixture(scope=\"session\") # Specify scope of fixture\ndef setup_triton(request):\n    # start triton\n    triton = tritoncontainer.TritonContainer() # Create container instance\n\n    triton.start() # launches container, waits until it's ready\n\n    def remove_triton_container(): \n        triton.stop() # stops container\n\n    request.addfinalizer(remove_triton_container) # handles container at the end of testing session\n\n    return triton.get_client() # returns triton http client \n\ndef test_example(setup_triton):\n    triton_client: 'tritonclient.http.InferenceServerClient' = setup_triton\n    assert True\n\ndef test_example_two():\n    cmd = tritoncontainer.TritonCommand(model_repository=[\"/models\"]).build() # command to run tritonserver with\n\n    maps = [{\"host\": \"/path/to/repository\", \"container\": \"/models\"}] # map repository on host to container\n\n    # use context manager to run container on __enter__ and stop it on __exit__\n    with tritoncontainer.TritonContainer(with_gpus=True, volume_mapping=maps, command=cmd) as service:  \n        triton_client = service.get_client()\n        assert True     \n```\n\n```python\nfrom testcontainers.core.container import DockerContainer\nfrom testcontainers.core.waiting_utils import wait_for_logs\n\nfrom triton_testcontainer import ImageBuilder, DockerfileBuilder\n\n\ndef test_example_three():\n    dockerfile = (DockerfileBuilder() \\\n                  .from_(\"ubuntu:20.04\") \\\n                  .cmd(\"echo\", \"hello world\")\n                  .build())\n\n\n    with ImageBuilder(\"hello-world\").from_string(context=\".\", string_dockerfile=dockerfile).ctx_manager() as image:\n        with DockerContainer(image.tags[0]) as container:\n            delay = wait_for_logs(container, \"hello world\", 30)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fogvalt%2Ftriton-testcontainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fogvalt%2Ftriton-testcontainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fogvalt%2Ftriton-testcontainer/lists"}