You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何克隆已有Poetry开发的GitHub项目并继续开发?

Work on a Forked Poetry-Based GitHub Project

Follow these steps to clone your forked repo, set up the Poetry environment, and start developing:

1. Clone Your Forked Repository

First, clone your fork to your local machine:

git clone https://github.com/your-username/your-forked-repo.git
cd your-forked-repo

2. Set Up the Poetry Environment

Poetry automatically detects existing pyproject.toml and poetry.lock files. To configure the project's virtual environment:

  • If you need to use a specific Python version, run:
    poetry env use python3.11  # Replace with your target Python version
    
  • Poetry creates a dedicated virtual environment for the project if one doesn’t already exist.

3. Install Dependencies

Install all project dependencies (including dev dependencies) using the lock file for version consistency:

poetry install

4. Activate the Environment

To work within the project’s virtual environment:

  • Start a persistent shell session in the environment:
    poetry shell
    
  • Or run individual commands without activating the shell (prefix with poetry run):
    poetry run python your-script.py
    

5. Run and Debug the Project

  • Check the [scripts] section in pyproject.toml for predefined run commands (e.g., poetry run start).
  • For debugging, activate the Poetry shell first—your IDE will automatically use the project’s virtual environment for debugging sessions.

6. Make Changes and Commit to Git

After modifying code:

  1. Stage your changes:
    git add .
    
  2. Commit with a descriptive message:
    git commit -m "Fix bug in X feature"
    
  3. Push changes to your forked repo:
    git push origin main  # Replace "main" with your working branch if needed
    

7. Sync with Upstream Repository (Optional)

If the original repository has updates, add it as an upstream remote and sync your fork:

git remote add upstream https://github.com/original-owner/original-repo.git
git fetch upstream
git merge upstream/main  # Merge upstream changes into your local branch

内容的提问来源于stack exchange,提问作者Johannes Linkels

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 21:12:42