Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UV Refactor with Docker CPU #944

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

UV Refactor with Docker CPU #944

wants to merge 2 commits into from

Conversation

alexnorell
Copy link
Contributor

@alexnorell alexnorell commented Jan 14, 2025

Key Changes

  • Migrated from setup.py to pyproject.toml for modern Python package management
  • Optimized Docker build process with multi-stage builds
  • Consolidated and updated dependency management
  • Removed redundant configuration files

Details

Package Management

  • Replaced setup.py with pyproject.toml for package configuration and dependency management
  • Introduced UV package manager for faster and more reliable dependency installation
  • Removed .isort.cfg and pytest.ini in favor of consolidated config in pyproject.toml

Docker Optimization

  • Optimized Dockerfile.onnx.cpu:
    • Switched to slim Python base image
    • Implemented multi-stage build to reduce final image size
    • Consolidated ENV variables
    • Updated to Python 3.13

Dependency Updates

  • Updated and standardized dependency versions across requirements files
  • Loosened version constraints on several packages while maintaining compatibility
  • Dependencies are now properly categorized in pyproject.toml under optional features

Technical Notes

  • Uses hatchling as the build backend
  • Maintains all existing optional dependencies but organizes them better
  • Dockerfile now uses UV for more efficient package installation

This change modernizes our Python package management approach and optimizes our container builds while maintaining all existing functionality.


Implementation Details
  • Replaced multiple requirements.txt files with pyproject.toml optional dependencies
  • Introduced multi-stage Docker build to optimize image size
  • Consolidated isort and pytest configurations into pyproject.toml
  • Updated dependency constraints to be more flexible while maintaining stability

pyproject.toml Outdated Show resolved Hide resolved
"torch>=2.0.1,<=2.4.0",
]

[project.optional-dependencies]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we duplicating these here and in the requirements.*.txt files? Is there a way to make sure we can keep them in sync or maybe we wouldnt need the requirement files anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes the needs for requirements.txt. Didn't remove them yet since I'm not done with the migration of the dockerfiles.

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.

2 participants