Skip to content

Improve dependency management with MANIFEST.in #8

@garotm

Description

@garotm

Improve dependency management with MANIFEST.in

Problem

Currently, the package dependencies are hardcoded in setup.py, which creates several issues:

  1. Dependencies are duplicated between setup.py and requirements.txt
  2. Version updates need to be synchronized in multiple files
  3. Dependabot can only manage versions in requirements.txt, not setup.py

Solution

Implement the same approach as used in datadog-monitor-deployer:

  1. Add a MANIFEST.in file to ensure requirements.txt is included in source distribution
  2. Modify setup.py to read dependencies from requirements.txt
  3. Keep requirements.txt as the single source of truth for dependencies

Implementation Steps

  1. Create MANIFEST.in with the following content:
include LICENSE
include README.md
include requirements.txt
include requirements-dev.txt
recursive-include src *.py
recursive-include tests *.py
recursive-include config *.yaml
  1. Update setup.py to read from requirements.txt:
# Read requirements
with open("requirements.txt", "r", encoding="utf-8") as f:
    requirements = [line.strip() for line in f if line.strip() and not line.startswith("#")]

setup(
    # ... other setup parameters ...
    install_requires=requirements,
    # ... rest of setup ...
)

Benefits

  • Single source of truth for dependencies
  • Better integration with Dependabot
  • Cleaner dependency management
  • Consistent with Python packaging best practices
  • Matches the approach used in datadog-monitor-deployer

Testing

  1. Delete existing tag
  2. Create new tag
  3. Verify package builds and publishes correctly
  4. Verify all dependencies are correctly included

References

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions