Use PyPI Enforce Layout

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

The PyPI Enforce Layout feature ensures that uploaded packages adhere to a standardized physical directory structure, filenames, and internal metadata, to promote a consistent and compliant repository.

JFrog recommends using this feature in conjunction with File Path Name Normalization. For more information, see Use File Path Name Normalization and Using Both File Path Name Normalization and Enforce Layout.

PyPI Enforce Layout is available in Artifactory starting from version 7.70.2.

Backward Compatibility

Enforce Layout applies to all PyPI repositories in your Artifactory instance. Previously uploaded packages that already exist in your instance will not be updated but if you attempt to upload a newer version or overwrite an existing one you will be prevented from doing so since the file path name sections must match the metadata values.

This feature enables you to restrict uploads to artifacts where the file name and version in the path match the package name and version stored in the artifact’s metadata.

The following examples explain how this feature applies without File Path Name Normalization:

enforce_layout_table.png

To enable PyPI Enforce Layout, in the artifactory.system.properties settings file set the system property:

artifactory.pypi.enforce.layout = true 

Artifactory will return an error when trying to perform actions on an artifact with a name that does not match the package metadata, with a description of the issue:

Error

Description

403

Action prevented due to Enforce Layout policy - package file name/version <ARTIFACT_NAME> does not match the ” + package internal name/version <ARTIFACT_NAME> in the metadata file

403

Action prevented due to Enforce Layout policy - could not find metadata file to compare