github.com/replit/upm@v0.0.0-20240423230255-9ce4fc3ea24c/internal/backends/python/gen_pypi_map/package.go (about) 1 package main 2 3 import ( 4 "regexp" 5 "strings" 6 ) 7 8 var normalizationPattern = regexp.MustCompile(`[-_.]+`) 9 10 // normalizePackageName implements NormalizePackageName for the Python 11 // backends. 12 // See https://packaging.python.org/en/latest/specifications/name-normalization/ 13 func normalizePackageName(name string) string { 14 name = strings.ToLower(name) 15 name = normalizationPattern.ReplaceAllString(name, "-") 16 return name 17 }