Skip to content

[DISCUSSION] Include numpy as a dependency in pyrpoject.toml #738

@genedan

Description

@genedan

Description

My IDE warns me every time we use import numpy as np that numpy isn't listed in the project dependencies. I can see why it's not in listed in pyproject.toml, because by installing pandas, we already install numpy. For the last few years I've also just ignored the warning, because it seems unlikely that it'll be an issue.

However, is it a best practice to include numpy in pyproject.toml, even if it gets installed indirectly by our other dependencies? A Google search indicates yes, but the answers tend to be from sources like discussion forums or AI summaries, rather than authoritative sources like PEPs or the Python Packaging guide.

Therefore, I can't just say hey, we gotta follow this, it's open to discussion.

Reasons for

  • Declaring numpy as a dependency means that chainladder will continue to work in the event that the other dependencies drop it as a dependency.
  • Reduce the chance that IDEs and code review tools will issue warnings about not listing it, and it feels really nice when there are 0 warnings.
  • We can fine-tune the version number, if needed
  • Easy, low-hanging fruit as a first PR for new contributors

Reasons against

  • Pandas already has it as a dependency, and it seems unlikely that they'll drop it
  • Keeps pyrpoject.toml short and tidy
  • No lengthy discussions about version numbers, until we need to have one

Is your feature request aligned with the scope of the package?

  • Yes, absolutely!
  • No, but it's still worth discussing.
  • N/A (this request is not a codebase enhancement).

Describe the solution you'd like, or your current workaround.

No response

Do you have any additional supporting notes?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentation 📚Changes to docstrings or the documentation site. No codebase changes.Effort > Brief 🐇Small tasks expected to take a few hours up to a couple of days.Great First Contribution! 🌱Beginner friendly tickets with narrow scope and huge impact. Perfect to join our community!Impact > Minor 🔷Small, backward compatible change. Treat like a patch release (e.g., 0.5.8 → 0.5.9).dependenciesPull requests that update a dependency filepython:uvPull requests that update python:uv code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions