Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Registry
  • Getting started
    • All guides
    • Creating a registry
        • Setting up PyPI
  • Access management
  • Pricing policy
  • Terraform reference
  • Audit Trails events
  1. Step-by-step guides
  2. Managing artifacts
  3. Python artifact
  4. Setting up PyPI

Setting up PyPI

Written by
Yandex Cloud
Updated at January 20, 2026
  1. Create the following environment variables depending on the authentication method:

    IAM token
    OAuth token
    API key
    1. Get an IAM token for the Yandex account or service account you are going to use for authentication.

    2. Create the REGISTRY_USERNAME and REGISTRY_PASSWORD environment variables:

      export REGISTRY_USERNAME="iam"
      export REGISTRY_PASSWORD="<IAM_token>"
      

      Where:

      • REGISTRY_USERNAME: Authentication method.
      • REGISTRY_PASSWORD: Body of the previously obtained IAM token.

    Note

    The IAM token's lifetime is limited to 12 hours.

    1. Get an OAuth token for the Yandex account you are going to use for authentication.

    2. Create the REGISTRY_USERNAME and REGISTRY_PASSWORD environment variables:

      export REGISTRY_USERNAME="oauth"
      export REGISTRY_PASSWORD="<OAuth_token>"
      

      Where:

      • REGISTRY_USERNAME: Authentication method.
      • REGISTRY_PASSWORD: Body of the previously obtained OAuth token.

    Note

    The OAuth token is valid for one year.

    1. Create an API key for the service account you are going to use for authentication.

    2. Create the REGISTRY_USERNAME and REGISTRY_PASSWORD environment variables:

      export REGISTRY_USERNAME="api_key"
      export REGISTRY_PASSWORD="<API_key>"
      

      Where:

      • REGISTRY_USERNAME: Authentication method.
      • REGISTRY_PASSWORD: Body of the previously created API key.

    Note

    The API key maximum lifetime is set manually when you create the key.

  2. In the user’s root directory, create a file named ~/.pypirc with the following content and specify the token in it:

    IAM token
    OAuth token
    API key
    [distutils]
    index-servers =
        cloud-registry
    
    [cloud-registry]
    repository = https://registry.yandexcloud.net/pypi/<registry_ID>/legacy/
    username = iam
    password = <IAM_token>
    
    [distutils]
    index-servers =
        cloud-registry
    
    [cloud-registry]
    repository = https://registry.yandexcloud.net/pypi/<registry_ID>/legacy/
    username = oauth
    password = <OAuth_token>
    
    [distutils]
    index-servers =
        cloud-registry
    
    [cloud-registry]
    repository = https://registry.yandexcloud.net/pypi/<registry_ID>/legacy/
    username = api_key
    password = <API_key>
    

Was the article helpful?

Previous
Setting up NuGet
Next
Pushing a binary artifact to a registry
© 2026 Direct Cursus Technology L.L.C.