Added flexpack build info support for poetry#140
Conversation
| // Create Poetry FlexPack instance | ||
| poetryFlex, err := flexpack.NewPoetryFlexPack(config) | ||
| if err != nil { | ||
| log.Warn("Failed to create Poetry FlexPack, falling back to standard method: " + err.Error()) |
There was a problem hiding this comment.
Do we need this warning message? the error can be returned and even the else statement can be removed since we are returning in if block
There was a problem hiding this comment.
ok will return error in this case
| err := pc.install(buildConfiguration, pythonBuildInfo) | ||
|
|
||
| // Get build name and number | ||
| buildName, err := buildConfiguration.GetBuildName() |
There was a problem hiding this comment.
Not on priority: we need to check if we really need to read buildName and number from project.yaml which is happening in buildConfiguration.GetBuildName()
| // Collect build info using FlexPack | ||
| flexBuildInfo, err := poetryFlex.CollectBuildInfo(buildName, buildNumber) | ||
| if err != nil { | ||
| log.Warn("Failed to collect build info with FlexPack, falling back to standard method: " + err.Error()) |
There was a problem hiding this comment.
we should return error since we failed collecting build info instead of warning
| err = pc.saveFlexPackBuildInfo(flexBuildInfo) | ||
| if err != nil { | ||
| log.Warn("Failed to save FlexPack build info: " + err.Error()) | ||
| } else { | ||
| log.Info("Successfully saved FlexPack build info with dependencies") | ||
| } |
There was a problem hiding this comment.
| err = pc.saveFlexPackBuildInfo(flexBuildInfo) | |
| if err != nil { | |
| log.Warn("Failed to save FlexPack build info: " + err.Error()) | |
| } else { | |
| log.Info("Successfully saved FlexPack build info with dependencies") | |
| } | |
| return pc.saveFlexPackBuildInfo(flexBuildInfo) |
| // Create FlexPack Poetry configuration | ||
| config := flexpack.PoetryConfig{ | ||
| WorkingDirectory: workingDir, | ||
| IncludeDevDependencies: false, // Match standard behavior |
There was a problem hiding this comment.
default should be false right do we need this?
| IncludeDevDependencies: false, // Match standard behavior |
There was a problem hiding this comment.
you are right, will update this
| err = bld.SaveBuildInfo(buildInfo) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to save build info: %w", err) | ||
| } | ||
|
|
||
| return nil |
There was a problem hiding this comment.
| err = bld.SaveBuildInfo(buildInfo) | |
| if err != nil { | |
| return fmt.Errorf("failed to save build info: %w", err) | |
| } | |
| return nil | |
| return bld.SaveBuildInfo(buildInfo) |
|
|
||
| // getProjectNameFromPyproject extracts project name from pyproject.toml | ||
| func (pc *PoetryCommand) getProjectNameFromPyproject(workingDir string) (string, error) { | ||
| pyprojectPath := filepath.Join(workingDir, "pyproject.toml") |
There was a problem hiding this comment.
Create a constant for "pyproject.toml".
| // collectPublishedArtifacts collects information about artifacts that were published | ||
| func (pc *PoetryCommand) collectPublishedArtifacts(buildConfiguration *buildUtils.BuildConfiguration, pythonBuildInfo *build.Build, workingDir string) error { | ||
| // Look for built artifacts in dist/ directory | ||
| distDir := filepath.Join(workingDir, "dist") |
There was a problem hiding this comment.
can poetry write published artifacts to a different directory instead of default?
| } | ||
|
|
||
| // findDistArtifacts finds and creates artifact entries for files in dist directory | ||
| func (pc *PoetryCommand) findDistArtifacts(distDir string) ([]entities.Artifact, error) { |
There was a problem hiding this comment.
cant this be read from pyproject.toml?
There was a problem hiding this comment.
Ok I can add a method for this
|
|
||
| filename := entry.Name() | ||
| // Only include wheel and tar.gz files | ||
| if !strings.HasSuffix(filename, ".whl") && !strings.HasSuffix(filename, ".tar.gz") { |
There was a problem hiding this comment.
just to improve readability
| if !strings.HasSuffix(filename, ".whl") && !strings.HasSuffix(filename, ".tar.gz") { | |
| if !(strings.HasSuffix(filename, ".whl") || !strings.HasSuffix(filename, ".tar.gz")) { |
There was a problem hiding this comment.
you can also reuse the function getArtifactType here
There was a problem hiding this comment.
yeah, great point, I will update this to use getArtifactType.
Uh oh!
There was an error while loading. Please reload this page.