Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • 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
        • Setting up PyPI
        • Creating a Python package
        • Pushing a Python package to a registry
        • Pulling a Python package from a registry
        • Examples of working with PyPI registries
      • Deleting an artifact from a registry
    • Creating a lifecycle policy
  • Access management
  • Pricing policy
  • Terraform reference
  • Audit Trails events

In this article:

  • Creating and using registries
  • Local registry
  • Remote registry
  • Virtual registry
  1. Step-by-step guides
  2. Managing artifacts
  3. Python artifact
  4. Examples of working with PyPI registries

Examples of working with PyPI registries

Written by
Yandex Cloud
Updated at July 8, 2026
View in Markdown
  • Creating and using registries
    • Local registry
    • Remote registry
    • Virtual registry

This section provides step-by-step examples for different types of PyPI registries.

Creating and using registriesCreating and using registries

Local registryLocal registry

  1. Create a registry:

    yc cloud-registry registry create \
      --name my-pypi-local \
      --registry-kind pypi \
      --registry-type local \
      --description "Local PyPI registry"
    

    Result:

    id: e5o6a2blpkb6********
    name: my-pypi-local
    kind: PYPI
    type: LOCAL
    
  2. Create a package:

    mkdir -p my_package/my_package
    cd my_package
    

    Create a file named my_package/__init__.py:

    def hello():
        return "Hello from my package!"
    

    Create a pyproject.toml:

    [build-system]
    requires = ["setuptools"]
    
    [project]
    name = "my_package"
    version = "0.0.1"
    authors = [{ name="Example Author", email="author@example.com" }]
    description = "A small example package"
    readme = "README.md"
    requires-python = ">=3.9"
    classifiers = [
        "Programming Language :: Python :: 3",
        "Operating System :: OS Independent",
    ]
    

    Create a README.md:

    # My Package
    This is an example of a Python package.
    
  3. Set up authentication:

    Create a ~/.pypirc:

    [distutils]
    index-servers = cloud-registry
    
    [cloud-registry]
    repository = https://registry.yandexcloud.net/pypi/e5o6a2b********/legacy/
    username = iam
    password = <IAM_token>
    
  4. Build and publish the package:

    python3 -m venv my-venv && source my-venv/bin/activate
    python3 -m pip install build twine
    python3 -m build
    python3 -m twine upload --repository cloud-registry dist/*
    
  5. Install a package:

    pip install my_package \
      --index-url https://iam:$(yc iam create-token)@registry.yandexcloud.net/pypi/e5o6a2blpkb6********/simple/ \
      --no-cache
    

    Check:

    python3 -c "from my_package import hello; print(hello())"
    # Hello from my package!
    

Remote registryRemote registry

  1. Create a registry:

    yc cloud-registry registry create \
      --name my-pypi-remote \
      --registry-kind pypi \
      --registry-type remote \
      --description "Remote PyPI proxy" \
      --properties source=@pypi
    

    Result:

    id: e5o7b3cmqlc7********
    name: my-pypi-remote
    kind: PYPI
    type: REMOTE
    
  2. Install the package (first time):

    When first installed, the package is uploaded from the public PyPI and stored in the cache:

    pip install pytest==9.0.1 \
      --index-url https://iam:$(yc iam create-token)@registry.yandexcloud.net/pypi/e5o7b3cmqlc7********/simple/ \
      --no-cache
    
  3. Install the package (once more):

    When reinstalling, the package is uploaded from the cache:

    pip install pytest==9.0.1 \
      --index-url https://iam:$(yc iam create-token)@registry.yandexcloud.net/pypi/e5o7b3cmqlc7********/simple/ \
      --no-cache
    
  4. Install another package:

    pip install requests==2.31.0 \
      --index-url https://iam:$(yc iam create-token)@registry.yandexcloud.net/pypi/e5o7b3cmqlc7********/simple/ \
      --no-cache
    

Note

All installed packages are cached in the registry. On next installation they will be uploaded from the cache.

Virtual registryVirtual registry

  1. Create a registry:

    Merge the local (cn1mfr50********) and remote (cn1ihsdl********) registries:

    yc cloud-registry registry create \
      --name my-pypi-virtual \
      --description "Virtual registry" \
      --registry-kind pypi \
      --registry-type virtual \
      --properties "readOnly=false,deploymentRegistryId=cn1mfr50********,registryIds=cn1mfr50********;cn1ihsdl********"
    

    Result:

    id: e5o9d5eosne9********
    name: my-pypi-virtual
    kind: PYPI
    type: VIRTUAL
    
  2. Install the internal package:

    The virtual registry first searches the local registry:

    pip install my_package \
      --index-url https://iam:$(yc iam create-token)@registry.yandexcloud.net/pypi/e5o9d5eosne9********/simple/ \
      --no-cache
    
  3. Install the public package:

    If the package is not found in the local registry, searches the remote one:

    pip install pytest==9.0.1 \
      --index-url https://iam:$(yc iam create-token)@registry.yandexcloud.net/pypi/e5o9d5eosne9********/simple/ \
      --no-cache
    
  4. Install multiple packages:

    pip install my_package pytest==9.0.1 requests==2.31.0 \
      --index-url https://iam:$(yc iam create-token)@registry.yandexcloud.net/pypi/e5o9d5eosne9********/simple/ \
      --no-cache
    

Useful linksUseful links

  • Creating a Python package
  • Pushing a Python package to a local registry in Cloud Registry
  • Pulling a Python package from a Cloud Registry
  • Lifecycle policy in Yandex Cloud Registry
  • Configuring lifecycle policies

Was the article helpful?

Previous
Pulling a Python package from a registry
Next
Pushing a binary artifact to a registry
© 2026 Direct Cursus Technology L.L.C.