1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. artifactregistry
  5. getPythonPackage
Google Cloud v9.0.0 published on Thursday, Sep 18, 2025 by Pulumi

gcp.artifactregistry.getPythonPackage

Explore with Pulumi AI

gcp logo
Google Cloud v9.0.0 published on Thursday, Sep 18, 2025 by Pulumi

    This data source fetches information from a provided Artifact Registry repository, based on a the latest version of the package and optional version.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const pythonRepo = new gcp.artifactregistry.Repository("python_repo", {
        location: "us-central1",
        repositoryId: "my-python-repo",
        format: "PYTHON",
    });
    const latest = gcp.artifactregistry.getPythonPackageOutput({
        location: pythonRepo.location,
        repositoryId: pythonRepo.repositoryId,
        packageName: "example_pkg",
    });
    const withVersion = gcp.artifactregistry.getPythonPackageOutput({
        location: pythonRepo.location,
        repositoryId: pythonRepo.repositoryId,
        packageName: "example_pkg:1.0.0",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    python_repo = gcp.artifactregistry.Repository("python_repo",
        location="us-central1",
        repository_id="my-python-repo",
        format="PYTHON")
    latest = gcp.artifactregistry.get_python_package_output(location=python_repo.location,
        repository_id=python_repo.repository_id,
        package_name="example_pkg")
    with_version = gcp.artifactregistry.get_python_package_output(location=python_repo.location,
        repository_id=python_repo.repository_id,
        package_name="example_pkg:1.0.0")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/artifactregistry"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		pythonRepo, err := artifactregistry.NewRepository(ctx, "python_repo", &artifactregistry.RepositoryArgs{
    			Location:     pulumi.String("us-central1"),
    			RepositoryId: pulumi.String("my-python-repo"),
    			Format:       pulumi.String("PYTHON"),
    		})
    		if err != nil {
    			return err
    		}
    		_ = artifactregistry.GetPythonPackageOutput(ctx, artifactregistry.GetPythonPackageOutputArgs{
    			Location:     pythonRepo.Location,
    			RepositoryId: pythonRepo.RepositoryId,
    			PackageName:  pulumi.String("example_pkg"),
    		}, nil)
    		_ = artifactregistry.GetPythonPackageOutput(ctx, artifactregistry.GetPythonPackageOutputArgs{
    			Location:     pythonRepo.Location,
    			RepositoryId: pythonRepo.RepositoryId,
    			PackageName:  pulumi.String("example_pkg:1.0.0"),
    		}, nil)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var pythonRepo = new Gcp.ArtifactRegistry.Repository("python_repo", new()
        {
            Location = "us-central1",
            RepositoryId = "my-python-repo",
            Format = "PYTHON",
        });
    
        var latest = Gcp.ArtifactRegistry.GetPythonPackage.Invoke(new()
        {
            Location = pythonRepo.Location,
            RepositoryId = pythonRepo.RepositoryId,
            PackageName = "example_pkg",
        });
    
        var withVersion = Gcp.ArtifactRegistry.GetPythonPackage.Invoke(new()
        {
            Location = pythonRepo.Location,
            RepositoryId = pythonRepo.RepositoryId,
            PackageName = "example_pkg:1.0.0",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.artifactregistry.Repository;
    import com.pulumi.gcp.artifactregistry.RepositoryArgs;
    import com.pulumi.gcp.artifactregistry.ArtifactregistryFunctions;
    import com.pulumi.gcp.artifactregistry.inputs.GetPythonPackageArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var pythonRepo = new Repository("pythonRepo", RepositoryArgs.builder()
                .location("us-central1")
                .repositoryId("my-python-repo")
                .format("PYTHON")
                .build());
    
            final var latest = ArtifactregistryFunctions.getPythonPackage(GetPythonPackageArgs.builder()
                .location(pythonRepo.location())
                .repositoryId(pythonRepo.repositoryId())
                .packageName("example_pkg")
                .build());
    
            final var withVersion = ArtifactregistryFunctions.getPythonPackage(GetPythonPackageArgs.builder()
                .location(pythonRepo.location())
                .repositoryId(pythonRepo.repositoryId())
                .packageName("example_pkg:1.0.0")
                .build());
    
        }
    }
    
    resources:
      pythonRepo:
        type: gcp:artifactregistry:Repository
        name: python_repo
        properties:
          location: us-central1
          repositoryId: my-python-repo
          format: PYTHON
    variables:
      latest:
        fn::invoke:
          function: gcp:artifactregistry:getPythonPackage
          arguments:
            location: ${pythonRepo.location}
            repositoryId: ${pythonRepo.repositoryId}
            packageName: example_pkg
      withVersion:
        fn::invoke:
          function: gcp:artifactregistry:getPythonPackage
          arguments:
            location: ${pythonRepo.location}
            repositoryId: ${pythonRepo.repositoryId}
            packageName: example_pkg:1.0.0
    

    Using getPythonPackage

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getPythonPackage(args: GetPythonPackageArgs, opts?: InvokeOptions): Promise<GetPythonPackageResult>
    function getPythonPackageOutput(args: GetPythonPackageOutputArgs, opts?: InvokeOptions): Output<GetPythonPackageResult>
    def get_python_package(location: Optional[str] = None,
                           package_name: Optional[str] = None,
                           project: Optional[str] = None,
                           repository_id: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetPythonPackageResult
    def get_python_package_output(location: Optional[pulumi.Input[str]] = None,
                           package_name: Optional[pulumi.Input[str]] = None,
                           project: Optional[pulumi.Input[str]] = None,
                           repository_id: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetPythonPackageResult]
    func GetPythonPackage(ctx *Context, args *GetPythonPackageArgs, opts ...InvokeOption) (*GetPythonPackageResult, error)
    func GetPythonPackageOutput(ctx *Context, args *GetPythonPackageOutputArgs, opts ...InvokeOption) GetPythonPackageResultOutput

    > Note: This function is named GetPythonPackage in the Go SDK.

    public static class GetPythonPackage 
    {
        public static Task<GetPythonPackageResult> InvokeAsync(GetPythonPackageArgs args, InvokeOptions? opts = null)
        public static Output<GetPythonPackageResult> Invoke(GetPythonPackageInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPythonPackageResult> getPythonPackage(GetPythonPackageArgs args, InvokeOptions options)
    public static Output<GetPythonPackageResult> getPythonPackage(GetPythonPackageArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:artifactregistry/getPythonPackage:getPythonPackage
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Location string
    The location of the Artifact Registry repository.
    PackageName string
    The name of the package to fetch. Can optionally include a specific version (e.g., my_pkg:1.2.3). If no version is provided, the latest version is used.
    RepositoryId string
    The ID of the repository containing the Python package.
    Project string
    The ID of the project that owns the repository. If not provided, the provider-level project is used.
    Location string
    The location of the Artifact Registry repository.
    PackageName string
    The name of the package to fetch. Can optionally include a specific version (e.g., my_pkg:1.2.3). If no version is provided, the latest version is used.
    RepositoryId string
    The ID of the repository containing the Python package.
    Project string
    The ID of the project that owns the repository. If not provided, the provider-level project is used.
    location String
    The location of the Artifact Registry repository.
    packageName String
    The name of the package to fetch. Can optionally include a specific version (e.g., my_pkg:1.2.3). If no version is provided, the latest version is used.
    repositoryId String
    The ID of the repository containing the Python package.
    project String
    The ID of the project that owns the repository. If not provided, the provider-level project is used.
    location string
    The location of the Artifact Registry repository.
    packageName string
    The name of the package to fetch. Can optionally include a specific version (e.g., my_pkg:1.2.3). If no version is provided, the latest version is used.
    repositoryId string
    The ID of the repository containing the Python package.
    project string
    The ID of the project that owns the repository. If not provided, the provider-level project is used.
    location str
    The location of the Artifact Registry repository.
    package_name str
    The name of the package to fetch. Can optionally include a specific version (e.g., my_pkg:1.2.3). If no version is provided, the latest version is used.
    repository_id str
    The ID of the repository containing the Python package.
    project str
    The ID of the project that owns the repository. If not provided, the provider-level project is used.
    location String
    The location of the Artifact Registry repository.
    packageName String
    The name of the package to fetch. Can optionally include a specific version (e.g., my_pkg:1.2.3). If no version is provided, the latest version is used.
    repositoryId String
    The ID of the repository containing the Python package.
    project String
    The ID of the project that owns the repository. If not provided, the provider-level project is used.

    getPythonPackage Result

    The following output properties are available:

    CreateTime string
    The time the package was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    Name string
    The fully qualified name of the fetched package. Format:

    projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/pythonPackages/{{package}}:{{version}}
    
    PackageName string
    RepositoryId string
    UpdateTime string
    The time the package was last updated.
    Version string
    The version of the Python package.
    Project string
    CreateTime string
    The time the package was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    Name string
    The fully qualified name of the fetched package. Format:

    projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/pythonPackages/{{package}}:{{version}}
    
    PackageName string
    RepositoryId string
    UpdateTime string
    The time the package was last updated.
    Version string
    The version of the Python package.
    Project string
    createTime String
    The time the package was created.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    name String
    The fully qualified name of the fetched package. Format:

    projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/pythonPackages/{{package}}:{{version}}
    
    packageName String
    repositoryId String
    updateTime String
    The time the package was last updated.
    version String
    The version of the Python package.
    project String
    createTime string
    The time the package was created.
    id string
    The provider-assigned unique ID for this managed resource.
    location string
    name string
    The fully qualified name of the fetched package. Format:

    projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/pythonPackages/{{package}}:{{version}}
    
    packageName string
    repositoryId string
    updateTime string
    The time the package was last updated.
    version string
    The version of the Python package.
    project string
    create_time str
    The time the package was created.
    id str
    The provider-assigned unique ID for this managed resource.
    location str
    name str
    The fully qualified name of the fetched package. Format:

    projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/pythonPackages/{{package}}:{{version}}
    
    package_name str
    repository_id str
    update_time str
    The time the package was last updated.
    version str
    The version of the Python package.
    project str
    createTime String
    The time the package was created.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    name String
    The fully qualified name of the fetched package. Format:

    projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/pythonPackages/{{package}}:{{version}}
    
    packageName String
    repositoryId String
    updateTime String
    The time the package was last updated.
    version String
    The version of the Python package.
    project String

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud v9.0.0 published on Thursday, Sep 18, 2025 by Pulumi