private void parseRequirementsTxt()

in doc-architect/doc-architect-core/src/main/java/com/docarchitect/core/scanner/impl/python/PipPoetryDependencyScanner.java [251:294]


    private void parseRequirementsTxt(Path file, String sourceComponentId, List<Dependency> dependencies) throws IOException {
        List<String> lines = readFileLines(file);

        for (String line : lines) {
            line = line.trim();

            // Skip comments and empty lines
            if (line.isEmpty() || line.startsWith(COMMENT_PREFIX)) {
                continue;
            }

            // Handle -e git+https://... editable installs
            if (line.startsWith(PREFIX_EDITABLE) || line.startsWith(PREFIX_EDITABLE_LONG)) {
                continue;
            }

            // Handle -r requirements-dev.txt includes
            if (line.startsWith(PREFIX_REQUIREMENT) || line.startsWith(PREFIX_REQUIREMENT_LONG)) {
                continue;
            }

            Matcher matcher = REQUIREMENTS_PATTERN.matcher(line);
            if (matcher.matches()) {
                String packageName = matcher.group(1);
                String versionSpec = matcher.group(3);

                if (packageName != null && !packageName.isEmpty()) {
                    Dependency dep = new Dependency(
                        sourceComponentId,
                        PYPI_GROUP_ID,
                        packageName,
                        versionSpec,
                        SCOPE_COMPILE,
                        true
                    );

                    dependencies.add(dep);
                    log.debug("Found dependency from {}: {} {}", file.getFileName(), packageName, versionSpec);
                } else {
                    log.warn("Matched requirements pattern but packageName is null/empty for line: {}", line);
                }
            }
        }
    }