{"modulePath":"github.com/fossas/fossa-cli","version":"v1.1.10","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package python\n\nPackage python provides analysers for Python projects.\n\nA \\`BuildTarget\\` in Python is the directory of the Python project, generally containing \\`requirements.txt\\` or \\`setup.py\\`.\n\n## Constants\n\n```go\nconst (\n\tAnalyzerName = \"python\"\n\n\tSetupPyStrategy         = \"setuptools\"\n\tPipStrategy             = \"pip\"\n\tPipenvStrategy          = \"pipenv\"\n\tPipDepTreeStrategy      = \"deptree\"\n\tRequirementsTxtStrategy = \"requirements\"\n)\n```\n\n## Variables\n\n```go\nvar PythonAnalyzer = module.AnalyzerV2{\n\tName:         AnalyzerName,\n\tDiscoverFunc: NewDiscover,\n\tStrategies: module.Strategies{\n\t\tNamed: map[module.StrategyName]module.Strategy{\n\t\t\tSetupPyStrategy:         AnalyzeSetupPy,\n\t\t\tPipStrategy:             AnalyzePip,\n\t\t\tPipenvStrategy:          AnalyzePipenv,\n\t\t\tPipDepTreeStrategy:      AnalyzePipDepTree,\n\t\t\tRequirementsTxtStrategy: AnalyzeRequirementsTxt,\n\t\t},\n\t\tSortedNames: []module.StrategyName{PipenvStrategy, PipDepTreeStrategy, PipStrategy, RequirementsTxtStrategy, SetupPyStrategy},\n\t\tOptimal:     []module.StrategyName{PipenvStrategy},\n\t},\n}\n```\n\n## Functions\n\n```go\nfunc AnalyzePip(dir module.Filepath, target module.Filepath) (graph.Deps, *errors.Error)\n```\n\n```go\nfunc AnalyzePipDepTree(dir module.Filepath, target module.Filepath) (graph.Deps, *errors.Error)\n```\n\n```go\nfunc AnalyzePipenv(dir module.Filepath, target module.Filepath) (graph.Deps, *errors.Error)\n```\n\n```go\nfunc AnalyzeRequirementsTxt(dir module.Filepath, target module.Filepath) (graph.Deps, *errors.Error)\n```\n\n```go\nfunc AnalyzeSetupPy(dir module.Filepath, target module.Filepath) (graph.Deps, *errors.Error)\n```\n\n```go\nfunc Discover(dir string, options map[string]interface{}) ([]module.Module, error)\n```\nDiscover constructs modules in all directories with a \\`requirements.txt\\` or \\`setup.py\\`.\n\n```go\nfunc FromRequirements(reqs []pip.Requirement) []pkg.Import\n```\n\n```go\nfunc FromTree(tree []pip.DepTree) ([]pkg.Import, map[pkg.ID]pkg.Package)\n```\n\n```go\nfunc NewDiscover(dir module.Filepath) (map[module.Filepath]module.DiscoveredStrategies, *errors.Error)\n```\n\n## Types\n\n```go\ntype Analyzer struct {\n\tPythonCmd     string\n\tPythonVersion string\n\n\tPipenv  pipenv.Pipenv\n\tPip     pip.Pip\n\tModule  module.Module\n\tOptions Options\n}\n```\n\n```go\nfunc New(m module.Module) (*Analyzer, error)\n```\n\n```go\nfunc (a *Analyzer) Analyze() (graph.Deps, error)\n```\n\n```go\nfunc (a *Analyzer) Build() error\n```\n\n```go\nfunc (a *Analyzer) Clean() error\n```\nClean logs a warning and does nothing for Python.\n\n```go\nfunc (a *Analyzer) IsBuilt() (bool, error)\n```\n\n```go\ntype Options struct {\n\tStrategy         string `mapstructure:\"strategy\"`\n\tRequirementsPath string `mapstructure:\"requirements\"`\n\tVirtualEnv       string `mapstructure:\"venv\"`\n}\n```\n\n","path":"github.com/fossas/fossa-cli/analyzers/python","name":"python","synopsis":"Package python provides analysers for Python projects.","isRedistributable":true}
