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

Updated build code #38

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Updated build code #38

merged 1 commit into from
Oct 18, 2024

Conversation

ternaus
Copy link
Contributor

@ternaus ternaus commented Oct 18, 2024

Summary by Sourcery

Refactor setup.py to streamline version retrieval and package requirement selection, update dependencies, and modify package metadata. Update pre-commit hook versions in the configuration file.

Enhancements:

  • Refactor the get_version function to use os.path instead of pathlib for file path operations.
  • Simplify the choose_requirement function logic for selecting package requirements.

Build:

  • Update numpy dependency version to 1.24.4 in setup.py.
  • Modify package finding in setup.py to include 'albucore*' and exclude 'tests' and 'benchmark'.
  • Remove long description, author, license, and other metadata from setup.py.

CI:

  • Update pre-commit hook versions for pyproject-fmt to 2.4.3 and ruff to v0.7.0.

Copy link
Contributor

sourcery-ai bot commented Oct 18, 2024

Reviewer's Guide by Sourcery

This pull request updates the build code, focusing on the setup.py file and the pre-commit configuration. The changes include refactoring the version retrieval method, simplifying the package setup process, and updating dependencies.

Class diagram for updated setup.py functions

classDiagram
    class Setup {
        +List~str~ INSTALL_REQUIRES
        +str MIN_OPENCV_VERSION
        +List~Tuple~ CHOOSE_INSTALL_REQUIRES
        +List~str~ get_install_requirements(List~str~ install_requires, List~Tuple~ choose_install_requires)
    }
    class Version {
        +str get_version()
    }
    class Requirement {
        +str choose_requirement(Tuple~str~ mains, str secondary)
    }
    Setup --> Version : uses
    Setup --> Requirement : uses
    note for Version "Refactored to use os.path.join instead of Path"
    note for Requirement "Simplified logic for choosing requirements"
Loading

File-Level Changes

Change Details Files
Refactored version retrieval method
  • Replaced Path with os.path for file operations
  • Simplified regex matching for version string
  • Removed error handling for version not found
setup.py
Simplified package setup process
  • Removed long description retrieval
  • Removed package metadata (description, author, license, etc.)
  • Simplified package discovery with explicit include
  • Removed classifiers and keywords
setup.py
Updated dependency management
  • Updated numpy requirement to >=1.24.4
  • Modified choose_requirement function to always return a chosen requirement
  • Simplified logic in get_install_requirements function
setup.py
Updated pre-commit hooks
  • Updated pyproject-fmt to version 2.4.3
  • Updated ruff to version 0.7.0
.pre-commit-config.yaml

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 retaining important package metadata in setup.py (e.g., description, author, license, url). This information is crucial for proper package distribution and user information.
  • The new version retrieval function in setup.py seems less robust and harder to maintain than the previous implementation. Consider reverting this change or improving the new implementation for better clarity and error handling.
  • The removal of the long_description function may negatively impact the project's presentation on package indexes. Consider keeping this information, possibly by reading it from the README.md file.
Here's what I looked at during the review
  • 🟡 General issues: 2 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.

setup.py Show resolved Hide resolved
setup.py Show resolved Hide resolved
setup.py Show resolved Hide resolved
@ternaus ternaus merged commit 78da3ab into main Oct 18, 2024
4 of 19 checks passed
@ternaus ternaus deleted the update_build branch October 18, 2024 02:17
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