@@ -72,69 +72,69 @@ class PythonPackageContentSerializer(core_serializers.SingleArtifactContentUploa
7272 """
7373 A Serializer for PythonPackageContent.
7474 """
75-
76- filename = serializers .CharField (
77- help_text = _ ('The name of the distribution package, usually of the format:'
78- ' {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}'
79- '-{platform tag}.{packagetype}' ),
80- read_only = True ,
81- )
82- packagetype = serializers .CharField (
83- help_text = _ ('The type of the distribution package '
84- '(e.g. sdist, bdist_wheel, bdist_egg, etc)' ),
85- read_only = True ,
86- )
87- name = serializers .CharField (
88- help_text = _ ('The name of the python project.' ),
89- read_only = True ,
90- )
91- version = serializers .CharField (
92- help_text = _ ('The packages version number.' ),
93- read_only = True ,
94- )
95- sha256 = serializers .CharField (
96- default = '' ,
97- help_text = _ ('The SHA256 digest of this package.' ),
98- )
99- metadata_version = serializers .CharField (
100- help_text = _ ('Version of the file format' ),
101- read_only = True ,
75+ # Core metadata
76+ # Version 1.0
77+ author = serializers .CharField (
78+ required = False , allow_blank = True ,
79+ help_text = _ ('Text containing the author\' s name. Contact information can also be added,'
80+ ' separated with newlines.' )
10281 )
103- summary = serializers .CharField (
82+ author_email = serializers .CharField (
10483 required = False , allow_blank = True ,
105- help_text = _ ('A one-line summary of what the package does. ' )
84+ help_text = _ ('The author \' s e-mail address. ' )
10685 )
10786 description = serializers .CharField (
10887 required = False , allow_blank = True ,
10988 help_text = _ ('A longer description of the package that can run to several paragraphs.' )
11089 )
111- description_content_type = serializers .CharField (
90+ home_page = serializers .CharField (
11291 required = False , allow_blank = True ,
113- help_text = _ ('A string stating the markup syntax (if any) used in the distribution’s'
114- ' description, so that tools can intelligently render the description.' )
92+ help_text = _ ('The URL for the package\' s home page.' )
11593 )
11694 keywords = serializers .CharField (
11795 required = False , allow_blank = True ,
11896 help_text = _ ('Additional keywords to be used to assist searching for the '
11997 'package in a larger catalog.' )
12098 )
121- home_page = serializers .CharField (
99+ license = serializers .CharField (
122100 required = False , allow_blank = True ,
123- help_text = _ ('The URL for the package \' s home page. ' )
101+ help_text = _ ('Text indicating the license covering the distribution ' )
124102 )
125- download_url = serializers .CharField (
103+ metadata_version = serializers .CharField (
104+ help_text = _ ('Version of the file format' ),
105+ read_only = True ,
106+ )
107+ name = serializers .CharField (
108+ help_text = _ ('The name of the python project.' ),
109+ read_only = True ,
110+ )
111+ platform = serializers .CharField (
126112 required = False , allow_blank = True ,
127- help_text = _ ('Legacy field denoting the URL from which this package can be downloaded.' )
113+ help_text = _ ('A comma-separated list of platform specifications, '
114+ 'summarizing the operating systems supported by the package.' )
128115 )
129- author = serializers .CharField (
116+ summary = serializers .CharField (
130117 required = False , allow_blank = True ,
131- help_text = _ ('Text containing the author\' s name. Contact information can also be added,'
132- ' separated with newlines.' )
118+ help_text = _ ('A one-line summary of what the package does.' )
133119 )
134- author_email = serializers .CharField (
120+ version = serializers .CharField (
121+ help_text = _ ('The packages version number.' ),
122+ read_only = True ,
123+ )
124+ # Version 1.1
125+ classifiers = serializers .JSONField (
126+ required = False , default = list ,
127+ help_text = _ ('A JSON list containing classification values for a Python package.' )
128+ )
129+ download_url = serializers .CharField (
135130 required = False , allow_blank = True ,
136- help_text = _ ('The author \' s e-mail address. ' )
131+ help_text = _ ('Legacy field denoting the URL from which this package can be downloaded. ' )
137132 )
133+ supported_platform = serializers .CharField (
134+ required = False , allow_blank = True ,
135+ help_text = _ ('Field to specify the OS and CPU for which the binary package was compiled. ' )
136+ )
137+ # Version 1.2
138138 maintainer = serializers .CharField (
139139 required = False , allow_blank = True ,
140140 help_text = _ ('The maintainer\' s name at a minimum; '
@@ -144,14 +144,11 @@ class PythonPackageContentSerializer(core_serializers.SingleArtifactContentUploa
144144 required = False , allow_blank = True ,
145145 help_text = _ ('The maintainer\' s e-mail address.' )
146146 )
147- license = serializers .CharField (
148- required = False , allow_blank = True ,
149- help_text = _ ('Text indicating the license covering the distribution' )
150- )
151- requires_python = serializers .CharField (
152- required = False , allow_blank = True ,
153- help_text = _ ('The Python version(s) that the distribution is guaranteed to be '
154- 'compatible with.' )
147+ obsoletes_dist = serializers .JSONField (
148+ required = False , default = list ,
149+ help_text = _ ('A JSON list containing names of a distutils project\' s distribution which '
150+ 'this distribution renders obsolete, meaning that the two projects should not '
151+ 'be installed at the same time.' )
155152 )
156153 project_url = serializers .CharField (
157154 required = False , allow_blank = True ,
@@ -161,39 +158,47 @@ class PythonPackageContentSerializer(core_serializers.SingleArtifactContentUploa
161158 required = False , default = dict ,
162159 help_text = _ ('A dictionary of labels and URLs for the project.' )
163160 )
164- platform = serializers .CharField (
165- required = False , allow_blank = True ,
166- help_text = _ ('A comma-separated list of platform specifications, '
167- 'summarizing the operating systems supported by the package.' )
168- )
169- supported_platform = serializers .CharField (
170- required = False , allow_blank = True ,
171- help_text = _ ('Field to specify the OS and CPU for which the binary package was compiled. ' )
172- )
173- requires_dist = serializers .JSONField (
174- required = False , default = list ,
175- help_text = _ ('A JSON list containing names of some other distutils project '
176- 'required by this distribution.' )
177- )
178161 provides_dist = serializers .JSONField (
179162 required = False , default = list ,
180163 help_text = _ ('A JSON list containing names of a Distutils project which is contained'
181164 ' within this distribution.' )
182165 )
183- obsoletes_dist = serializers .JSONField (
184- required = False , default = list ,
185- help_text = _ ('A JSON list containing names of a distutils project\' s distribution which '
186- 'this distribution renders obsolete, meaning that the two projects should not '
187- 'be installed at the same time.' )
188- )
189166 requires_external = serializers .JSONField (
190167 required = False , default = list ,
191168 help_text = _ ('A JSON list containing some dependency in the system that the distribution '
192169 'is to be used.' )
193170 )
194- classifiers = serializers .JSONField (
171+ requires_dist = serializers .JSONField (
195172 required = False , default = list ,
196- help_text = _ ('A JSON list containing classification values for a Python package.' )
173+ help_text = _ ('A JSON list containing names of some other distutils project '
174+ 'required by this distribution.' )
175+ )
176+ requires_python = serializers .CharField (
177+ required = False , allow_blank = True ,
178+ help_text = _ ('The Python version(s) that the distribution is guaranteed to be '
179+ 'compatible with.' )
180+ )
181+ # Version 2.1
182+ description_content_type = serializers .CharField (
183+ required = False , allow_blank = True ,
184+ help_text = _ ('A string stating the markup syntax (if any) used in the distribution’s'
185+ ' description, so that tools can intelligently render the description.' )
186+ )
187+ # Release metadata
188+ filename = serializers .CharField (
189+ help_text = _ ('The name of the distribution package, usually of the format:'
190+ ' {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}'
191+ '-{platform tag}.{packagetype}' ),
192+ read_only = True ,
193+ )
194+ packagetype = serializers .CharField (
195+ help_text = _ ('The type of the distribution package '
196+ '(e.g. sdist, bdist_wheel, bdist_egg, etc)' ),
197+ read_only = True ,
198+ )
199+ sha256 = serializers .CharField (
200+ default = '' ,
201+ help_text = _ ('The SHA256 digest of this package.' ),
197202 )
198203
199204 def deferred_validate (self , data ):
@@ -242,11 +247,12 @@ def retrieve(self, validated_data):
242247
243248 class Meta :
244249 fields = core_serializers .SingleArtifactContentUploadSerializer .Meta .fields + (
245- 'filename' , 'packagetype' , 'name' , 'version' , 'sha256' , 'metadata_version' , 'summary' ,
246- 'description' , 'description_content_type' , 'keywords' , 'home_page' , 'download_url' ,
247- 'author' , 'author_email' , 'maintainer' , 'maintainer_email' , 'license' ,
248- 'requires_python' , 'project_url' , 'project_urls' , 'platform' , 'supported_platform' ,
249- 'requires_dist' , 'provides_dist' , 'obsoletes_dist' , 'requires_external' , 'classifiers'
250+ 'author' , 'author_email' , 'description' , 'home_page' , 'keywords' , 'license' ,
251+ 'metadata_version' , 'name' , 'platform' , 'summary' , 'version' , 'classifiers' ,
252+ 'download_url' , 'supported_platform' , 'maintainer' , 'maintainer_email' ,
253+ 'obsoletes_dist' , 'project_url' , 'project_urls' , 'provides_dist' , 'requires_external' ,
254+ 'requires_dist' , 'requires_python' , 'description_content_type' ,
255+ 'filename' , 'packagetype' , 'sha256'
250256 )
251257 model = python_models .PythonPackageContent
252258
0 commit comments