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

major refactoring #59

Merged
merged 7 commits into from
Feb 8, 2025
Merged

major refactoring #59

merged 7 commits into from
Feb 8, 2025

Conversation

ypriverol
Copy link
Contributor

@ypriverol ypriverol commented Feb 8, 2025

Major refactoring:

  • Major update and restructure of all the documentation.
  • Remove of functions that are not used in the command line.
  • Added some TODOs for @selva439 about the search capabilities.

Summary by CodeRabbit

  • New Features

    • Introduced a new command to download public files by category.
    • Improved the command-line interface with enhanced parameter guidance, including keyword-based project search and clearer private file listing.
  • Documentation

    • Updated installation instructions to include building with Poetry and installing from a wheel.
    • Expanded usage examples and detailed flag descriptions for file downloads and metadata streaming.

Copy link
Contributor

coderabbitai bot commented Feb 8, 2025

Walkthrough

The changes include a new ignore rule in .gitignore and significant updates to the README.md, detailing revised installation instructions, expanded usage examples, and additional CLI commands. Several classes across the pridepy package have been reformatted for consistency, with new methods added for category‐based file downloads and updated command names in the CLI. Test files have received both new tests and formatting improvements, while API handling methods have been consolidated for readability, without altering overall functionality.

Changes

File(s) Change Summary
.gitignore, README.md Added a new ignore entry (.qodo) in .gitignore; README updated with revised installation steps, detailed usage examples, and new/revised CLI commands for file downloading and metadata streaming.
pridepy/authentication/authentication.py,
pridepy/project/project.py
Reformatting of JSON construction and method signatures (e.g., removal of unnecessary line breaks) to improve readability while keeping functionality intact.
pridepy/files/files.py, pridepy/pridepy.py Introduced new methods for downloading category-based files and added a new CLI command (download-all-public-category-files). Updated docstrings and renamed commands (e.g., get_private_files → list_private_files) to clarify usage and parameters.
pridepy/tests/test_raw_files.py,
pridepy/tests/test_search.py
Added a new test for verifying category file listing and reformatted test code for clarity in parameter layout and assertions.
pridepy/util/api_handling.py Consolidated method signatures and exception messages in API calls (get_api_call, stream_response_to_file, read_json_stream, post_api_call, update_api_call) to ensure consistent formatting without affecting logic.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant C as CLI
    participant F as Files Module
    participant A as API Server

    U->>C: Execute download-all-public-category-files command
    C->>F: Call download_all_category_files(accession, category, options)
    F->>A: Request file list for specified category
    A-->>F: Return file list
    F-->>C: Send files data
    C-->>U: Display download results
Loading

Poem

I'm a rabbit, hopping in code so bright,
New commands and methods make my heart light.
I nibble on changes, both neat and new,
Formatting and features in a delightful brew.
Through bouncy bytes and rhythmic lines, I cheer,
A joyful hop for CodeRabbit, oh so dear!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
pridepy/pridepy.py (1)

55-67: Inconsistent default bandwidth value in docstring vs parameter.
The docstring states that the default is “100M,” while the parameter is set to “50M.” This discrepancy can cause confusion.

You can either change the parameter’s default to match the docstring or adjust the docstring to match the code, for example:

-    aspera_maximum_bandwidth: str = "50M",
+    aspera_maximum_bandwidth: str = "100M",
🧹 Nitpick comments (5)
pridepy/tests/test_raw_files.py (1)

32-39: Expand test coverage for additional file categories.
Currently, only “RAW” and “SEARCH” file categories are tested. Additional tests for other categories or error scenarios (e.g., invalid categories) can improve confidence in functionality.

pridepy/authentication/authentication.py (1)

54-54: Simplified return statement.
Returning a concise Boolean expression is clear. If more debugging details are ever required, consider logging token validation failures.

README.md (3)

26-27: Consider adding output examples.

The installation commands would be more helpful with example output to show users what to expect.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

26-26: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


27-27: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


114-115: Add missing comma.

Add a comma after "project" in the sentence: "...files from a project, which is the most common use case."

🧰 Tools
🪛 LanguageTool

[uncategorized] ~115-~115: Possible missing comma found.
Context: ...ct command to download RAW files from a project which is the most common use case. ## ...

(AI_HYDRA_LEO_MISSING_COMMA)


136-136: Improve wording.

Replace "At the moment" with "Currently" for more concise wording.

🧰 Tools
🪛 LanguageTool

[style] ~136-~136: For conciseness, consider replacing this expression with an adverb.
Context: ...e https protocol to download the files. At the moment we only allow this protocol because of ...

(AT_THE_MOMENT)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8d6100 and a8ad3c2.

📒 Files selected for processing (9)
  • .gitignore (1 hunks)
  • README.md (2 hunks)
  • pridepy/authentication/authentication.py (2 hunks)
  • pridepy/files/files.py (13 hunks)
  • pridepy/pridepy.py (7 hunks)
  • pridepy/project/project.py (3 hunks)
  • pridepy/tests/test_raw_files.py (1 hunks)
  • pridepy/tests/test_search.py (1 hunks)
  • pridepy/util/api_handling.py (4 hunks)
✅ Files skipped from review due to trivial changes (4)
  • .gitignore
  • pridepy/tests/test_search.py
  • pridepy/project/project.py
  • pridepy/util/api_handling.py
🧰 Additional context used
📓 Learnings (1)
pridepy/files/files.py (1)
Learnt from: ypriverol
PR: PRIDE-Archive/pridepy#53
File: pridepy/project/project.py:69-79
Timestamp: 2025-02-06T18:56:21.132Z
Learning: The `get_files_by_accession` method in `pridepy/project/project.py` no longer supports filtering in API v3, as it returns all files for a project using the stream endpoint.
🪛 Ruff (0.8.2)
pridepy/files/files.py

367-367: Function definition does not bind loop variable progress

(B023)

🪛 markdownlint-cli2 (0.17.2)
README.md

26-26: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


27-27: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


71-71: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


91-91: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


109-109: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


124-124: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


132-132: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


145-145: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


151-151: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


156-156: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)

🪛 LanguageTool
README.md

[style] ~64-~64: Consider using a different verb to strengthen your wording.
Context: ...metadata... ``` > [!NOTE] > Please make sure you are using Python3, not Python 2.7 v...

(MAKE_SURE_ENSURE)


[style] ~75-~75: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...o specify the output directory. - -p flag is used to specify the protocol (**aspe...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[uncategorized] ~115-~115: Possible missing comma found.
Context: ...ct command to download RAW files from a project which is the most common use case. ## ...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~136-~136: For conciseness, consider replacing this expression with an adverb.
Context: ...e https protocol to download the files. At the moment we only allow this protocol because of ...

(AT_THE_MOMENT)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: build
🔇 Additional comments (8)
pridepy/pridepy.py (1)

320-327: Missing click options for parameters referenced in the function.
Parameters “filter,” “page_size,” “page,” “date_gap,” “sort_direction,” and “sort_fields” are used inside the function but lack corresponding click options. This will cause errors or unexpected behavior when running the command.

Would you like help adding these options to ensure the command is fully operational?

pridepy/authentication/authentication.py (1)

30-30: Concise JSON credential string.
Shifting to a single‐line JSON string improves readability without altering logic.

pridepy/files/files.py (6)

73-73: LGTM!

The formatting changes improve code readability while maintaining the same functionality.

Also applies to: 79-81


89-89: LGTM!

The simplified function call improves code readability.


705-709: LGTM!

The reformatted function call improves code readability.


714-716: LGTM!

The addition of S3 protocol support enhances the download capabilities of the package.


718-748: LGTM!

Well-structured new function that enables category-based file downloads while reusing existing download functionality.


750-762: LGTM!

Well-implemented function that efficiently filters files by category.

@ypriverol ypriverol requested a review from selvaebi February 8, 2025 13:50
@ypriverol ypriverol merged commit e57c89a into master Feb 8, 2025
9 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Feb 9, 2025
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