Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ CodeArts Artifact/ Getting Started/ Releasing/Obtaining a PyPI Component via a Build Task

Releasing/Obtaining a PyPI Component via a Build Task

Updated on 2024-12-06 GMT+08:00

This section describes how to release a component to a PyPI repository via a build task and obtain a dependency from the repository for deployment.

Prerequisites

Releasing a Component to a PyPI Repository

  1. Download the configuration file.

    1. Log in to CodeArts Artifact and access the PyPI repository. Click Tutorial on the right of the page.
    2. In the displayed dialog box, find the For Publishing and click Download Configuration File.

    3. Save the downloaded PYPIRC file as a .pypirc file.

  2. Configure a repository.

    1. Go to Repo and create a Python repository. For details, see Creating a Repository. This procedure uses the Python3 Demo template.
    2. Go to the repository and upload the .pypirc file to the root directory of the repository. For details, see .

  3. Configure and run a build task.

    1. On the Repo page, select a repository and click Create Build Task in the upper right.

      Select Blank Template and click OK.

    2. Add the Build with Setuptools action.

    3. Edit the Build with Setuptools action.
      • Select the desired tool version. In this example, python3.6 is used.
      • Delete the existing commands and run the following instead:
        # Ensure that the setup.py file exists in the root directory of the code, and run the following command to pack the project into a WHL package.
        python setup.py bdist_wheel
        # Set the .pypirc file in the root directory of the current project as the configuration file.
        cp -rf .pypirc ~/
        # Upload the component to the PyPI repository.
        twine upload -r pypi dist/* 
        NOTE:

        If certificate verification fails during the upload, add the following command to the first line of the preceding command to skip certificate verification:

        export CURL_CA_BUNDLE=""

    4. Click Save and Run on the right of the page to start the build task.

      After the task is successfully executed, go to the self-hosted repo page and find the uploaded PyPI component.

Obtaining a Dependency from a PyPI Repository

The following procedure uses the PyPI component released in Releasing a Component to a PyPI Repository as an example to describe how to obtain a dependency from a PyPI repository.

  1. Download the configuration file.

    1. Go to the PyPI repository and click Tutorial on the right of the page.
    2. In the displayed dialog box, find the For Download and click Download Configuration File.

    3. Save the downloaded pip.ini file as a pip.conf file.

  2. Configure a repository.

    1. Go to Repo and create a Python repository. For details, see Creating a Repository. This procedure uses the Python3 Demo template.
    2. Go to Repo, and upload the pip.conf file to the root directory of the repository where the PyPI dependency is to be used.
    3. Find the requirements.txt file in the repository and open it. If the file is not found, create it by referring to Managing Files. Add the dependency configuration to this file, as shown in the following figure.
      demo ==1.0

  3. Configure and run a build task.

    1. On the Repo page, select a repository and click Create Build Task in the upper right.

      Select Blank Template and click OK.

    2. Add the Build with Setuptools action.

    3. Edit the Build with Setuptools action.
      • Select the desired tool version. In this example, python3.6 is used.
      • Delete the existing commands and run the following instead:
        # Set the pip.conf file in the root directory of the current project as the configuration file.
         export PIP_CONFIG_FILE=./pip.conf
        # Download the PyPI component.
         pip install -r requirements.txt --no-cache-dir

  4. Click Save and Run on the right of the page to start the build task.

    After the task is successfully executed, view the task details. If information similar to the following is found in the log, the dependency has been downloaded from the self-hosted repo.

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback