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

请求协助配置JFrog Artifactory远程PyPI仓库自定义布局映射

Alright, let's sort out that PyPI remote repo layout problem in Artifactory. I’ve tackled this exact issue a few times, so here’s a clear, step-by-step guide to get your custom layout configured properly and fix those versioning headaches:

Step 1: Create a Custom PyPI Repository Layout

Head to your Artifactory admin panel, then navigate to Admin > Repositories > Repository Layouts. Click the New button to start building your custom layout.

Fill out the form with these settings (tailored to match PyPI’s standard structure):

  • Layout Name: Use something like pypi-custom (pick any name that makes sense for your team)
  • Package Type: Select Generic (since we’re building a custom layout specific to PyPI)
  • Path Pattern: Set this to {1}/{0}
    • This maps to PyPI’s typical structure where packages are stored as package-name/versioned-file.tar.gz
  • Folder Integration: Check this box—this ensures Artifactory handles folder-based package structures correctly
  • Regex Capture Groups: Add these two groups to extract package names and versions:
    1. ([^/]+) → Captures the package name (e.g., django from the path segment before the file)
    2. (.+) → Captures the full filename, which includes the version (e.g., Django-4.2.5.tar.gz)

Now attach this layout to your existing (or new) remote PyPI repo:

  1. Go to Admin > Repositories > Remote Repositories. Either create a new remote PyPI repository or edit the one you’re having issues with.
  2. In the Basic Settings tab, look for the Repository Layout dropdown menu.
  3. Select your newly created pypi-custom layout from the list.
  4. Hit Save to apply the changes.
Step 3: Test to Ensure Everything Works

Verify the setup to make sure versioning and caching behave as expected:

  • Install a test package using your Artifactory repo as the index. For example:
    pip install django --index-url http://your-artifactory-instance/api/pypi/your-pypi-remote-repo/simple/
    
  • Open the Artifactory repo browser and check the cached package structure. You should see a folder named after the package (e.g., django) with the versioned package files inside it.
  • Try installing a different version of the same package (like django==4.1.10) and confirm Artifactory caches it separately instead of overwriting the existing one.
Quick Notes to Avoid Headaches
  • Double-check the regex capture groups if some packages aren’t caching correctly. Most PyPI packages follow the standard structure, but a few edge cases might need minor tweaks—adjust the regex if you spot inconsistencies.
  • This process works the same for both self-hosted Artifactory and Artifactory Cloud; the admin panel options are identical.
  • Stick to using a custom layout instead of modifying default ones—this keeps your standard repo configurations intact and avoids unintended side effects.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 09:13:12