Skip to content

Refactor to separate envicornments#20

Merged
ternaus merged 10 commits intomainfrom
refactor_to_separate_envicornments
Jan 22, 2025
Merged

Refactor to separate envicornments#20
ternaus merged 10 commits intomainfrom
refactor_to_separate_envicornments

Conversation

@ternaus
Copy link
Owner

@ternaus ternaus commented Jan 22, 2025

Summary by Sourcery

Update the benchmark to use separate virtual environments for each library and add a new script to run the benchmarks.

Enhancements:

  • Standardize image formats to RGB for consistent comparisons across libraries.
  • Improve the documentation to include system requirements, Python setup instructions, and details about the libraries being benchmarked.
  • Update the project to Python 3.12.

Build:

  • Introduce a new script run_benchmarks.sh to manage virtual environments and run benchmarks for different libraries.

Tests:

  • Add a new script benchmark_single.py to run benchmarks independently for each library.
  • Add a new script analyze_images.py to analyze image characteristics.
  • Add a new script create_plots.py to generate performance plots.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 22, 2025

Reviewer's Guide by Sourcery

This pull request refactors the project to use separate virtual environments for each library being benchmarked. It also updates the benchmark script to use uv for faster package installation and adds a new script to generate plots from the benchmark results.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Refactor to use separate virtual environments for each library.
  • The benchmark script now creates a separate virtual environment for each library.
  • The script uses uv for faster package installation.
  • The script now deactivates the virtual environment after each benchmark run.
run_benchmarks.sh
Update the benchmark script to use uv for faster package installation.
  • The script now uses uv to install dependencies.
  • The script sets UV_LINK_MODE to copy to avoid issues with hardlinks.
run_benchmarks.sh
Add a new script to generate plots from the benchmark results.
  • A new script was added to generate plots from the benchmark results.
  • The script uses matplotlib and seaborn to create the plots.
  • The script saves the plots as PNG files.
tools/create_plots.py
Update the README to reflect the changes.
  • The README was updated to reflect the new virtual environment setup.
  • The README was updated to include instructions on how to run the benchmark.
  • The README was updated to include a description of the benchmark results structure.
  • The README was updated to include a description of the libraries being benchmarked.
  • The README was updated to include performance considerations.
  • The README was updated to include recommendations.
README.md
Update pyproject.toml to use Python 3.12.
  • The target-version for black and ruff was updated to py312.
  • The python_version for mypy was updated to 3.12.
pyproject.toml
Remove markdownlint from pre-commit config.
  • The markdownlint hook was removed from the pre-commit config.
.pre-commit-config.yaml
Add a new script to run a single benchmark.
  • A new script was added to run a single benchmark.
  • The script takes the library to benchmark as an environment variable.
  • The script saves the results as a JSON file.
imread_benchmark/benchmark_single.py
Add a new script to analyze images.
  • A new script was added to analyze images.
  • The script calculates the average, median, and range of file sizes and resolutions.
tools/analyze_images.py
Add new requirements files for each library.
  • New requirements files were added for each library.
  • The base requirements file was added.
requirements/base.txt
requirements/imageio.txt
requirements/jpeg4py.txt
requirements/kornia.txt
requirements/opencv.txt
requirements/pillow-simd.txt
requirements/pillow.txt
requirements/skimage.txt
requirements/tensorflow.txt
requirements/torchvision.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ternaus - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider keeping more specific linting rules rather than using 'ALL' with ignores - this helps maintain consistent code quality standards and makes the rules more explicit
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ternaus ternaus merged commit 94d5d81 into main Jan 22, 2025
1 check passed
@ternaus ternaus deleted the refactor_to_separate_envicornments branch January 22, 2025 02:04
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.

1 participant