Skip to content

fix: normalize package names to lowercase and improve output formatting#517

Open
KushalLukhi wants to merge 1 commit intobndr:masterfrom
KushalLukhi:fix/package-name-normalization
Open

fix: normalize package names to lowercase and improve output formatting#517
KushalLukhi wants to merge 1 commit intobndr:masterfrom
KushalLukhi:fix/package-name-normalization

Conversation

@KushalLukhi
Copy link

This PR addresses three related issues:

Fixes #500 - Capitalization Issue:

  • Package names are now normalized to lowercase in requirements.txt
  • This fixes the issue where 'Requests' was output instead of 'requests'
  • All package names in requirements.txt are now consistently lowercase

Fixes #515 - FastAPI Resolution:

  • Added 'fastapi:fastapi' mapping to ensure proper package resolution
  • FastAPI imports are now correctly mapped to the 'fastapi' package

Fixes #504 - Malformed Requirements Output:

  • Added validation for proper requirements.txt formatting
  • Ensures exactly one '==' separator per line
  • Validates no leading/trailing whitespace
  • Confirms package names are lowercase

Changes:

  • Modified get_pkg_names() to normalize names to lowercase
  • Added 'fastapi:fastapi' to mapping file
  • Added comprehensive tests for normalization, mapping, and output format

Testing:

  • All existing tests pass
  • New tests added for lowercase normalization
  • New tests added for FastAPI mapping
  • New tests added for output format validation

Closes #500, #515, #504

This PR addresses three related issues:

**Fixes bndr#500 - Capitalization Issue:**
- Package names are now normalized to lowercase in
- This fixes the issue where 'Requests' was output instead of 'requests'
- All package names in requirements.txt are now consistently lowercase

**Fixes bndr#515 - FastAPI Resolution:**
- Added 'fastapi:fastapi' mapping to ensure proper package resolution
- FastAPI imports are now correctly mapped to the 'fastapi' package

**Fixes bndr#504 - Malformed Requirements Output:**
- Added validation for proper requirements.txt formatting
- Ensures exactly one '==' separator per line
- Validates no leading/trailing whitespace
- Confirms package names are lowercase

**Changes:**
- Modified  to normalize names to lowercase
- Added 'fastapi:fastapi' to mapping file
- Added comprehensive tests for normalization, mapping, and output format

**Testing:**
- All existing tests pass
- New tests added for lowercase normalization
- New tests added for FastAPI mapping
- New tests added for output format validation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fastapi doesn't get installed properly. Malformed requirements.txt created Wrongly capitalizes module name: "Requests"

1 participant