PEP Validation partis.pyproj.pep#
- class CompatibilityTags(py_tag, abi_tag, plat_tag)#
Bases:
tuple- abi_tag#
Alias for field number 1
- plat_tag#
Alias for field number 2
- py_tag#
Alias for field number 0
- exception PEPValidationError(*, pep, msg, val)[source]#
Bases:
ValidationErrorError from value incompatible with a PEP
- norm_printable(text=None)[source]#
Removes leading and trailing whitespace and all non-printable characters, except for newlines ‘\n’ and tabs ‘\t’.
Note
While not explicitly stated in any PEP, it is implied through referenced RFCs and other assumptions that text in package meta-data should only contain printable unicode characters.
Example
import re from partis.pyproj import norm_printable x = ''.join([ chr(i) for i in range(50) ]) print( x.isprintable() ) y = norm_printable(x) print( y.isprintable() ) z = re.sub(r'[\t\n]', '', y) print( z.isprintable() ) print( norm_printable(None) ) print( norm_printable('f\ubaaar') )
- norm_dist_name(name)[source]#
Normalizes a distribution name (PEP 503)
Note
The name should be lowercased with all runs of the characters ., -, or _ replaced with a single - character.
- norm_dist_filename(name)[source]#
Normalize distribution filename component (PEP 427)
Note
Each component of the filename is escaped by replacing runs of non-alphanumeric characters with an underscore ‘_’
- join_dist_filename(parts)[source]#
Joins distribution filename component (PEP 427)
Note
Each component of the filename is joined by ‘-’
- norm_dist_author(name=None, email=None)[source]#
Checks for valid distribution author/maintainer name/email (PEP 621)
The name value MUST be a valid email name (i.e. whatever can be put as a name, before an email, in RFC #822) and not contain commas.
If only name is provided, the value goes in Author/Maintainer as appropriate.
If only email is provided, the value goes in Author-email/Maintainer-email as appropriate.
If both email and name are provided, the value goes in Author-email/Maintainer-email as appropriate, with the format {name} <{email}> (with appropriate quoting, e.g. using email.headerregistry.Address).
Note
The returned name field will be empty in this case.
- norm_dist_extra(extra)[source]#
Normalize distribution ‘extra’ requirement
Note
No known PEP specifies this format, but is treated as