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

[MNT] Remove trailing slashes from all paths + rename NB_FAPI_ROOT_PATH #157

Merged
merged 5 commits into from
Feb 12, 2025

Conversation

alyssadai
Copy link
Contributor

@alyssadai alyssadai commented Feb 12, 2025

Changes proposed in this pull request:

  • Remove trailing slashes from all defined paths except the root, which requires the trailing slash in the path definition (but is indifferent to its inclusion)

Housekeeping:

  • Rename NB_FAPI_ROOT_PATH -> NB_FAPI_BASE_PATH for consistency with other tools
  • Fix README badge links

Checklist

This section is for the PR reviewer

  • PR has an interpretable title with a prefix ([ENH], [FIX], [REF], [TST], [CI], [MNT], [INF], [MODEL], [DOC]) (see our Contributing Guidelines for more info)
  • PR has a label for the release changelog or skip-release (to be applied by maintainers only)
  • PR links to GitHub issue with mention Closes #XXXX
  • Tests pass
  • Checks pass

For new features:

  • Tests have been added

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

Summary by Sourcery

Remove trailing slashes from all API paths and rename the NB_FAPI_ROOT_PATH environment variable to NB_FAPI_BASE_PATH.

Bug Fixes:

  • Handle requests with trailing slashes correctly.

Chores:

  • Rename NB_FAPI_ROOT_PATH to NB_FAPI_BASE_PATH.

Copy link

sourcery-ai bot commented Feb 12, 2025

Reviewer's Guide by Sourcery

This PR removes trailing slashes from API paths for consistency and renames the environment variable from NB_FAPI_ROOT_PATH to NB_FAPI_BASE_PATH. The changes are implemented by updating the API route definitions, revising tests to remove trailing slashes from request calls, and modifying documentation links and badges to reflect these updates.

Class diagram for environment variable renaming

classDiagram
    class EnvVar {
      +string name
      +string value
    }

    class Utility {
      <<static>>
      +NB_FAPI_BASE_PATH: EnvVar
      // Previously: NB_FAPI_ROOT_PATH
    }

    Utility --> EnvVar : uses
Loading

File-Level Changes

Change Details Files
Remove trailing slashes from API endpoints
  • Updated API route definitions in the routers to remove the trailing slash from the path parameter.
  • Modified the route factory to document the base subpath without a trailing slash.
  • Revised test cases to call endpoints without the trailing slash and adjusted their descriptions accordingly.
app/api/routers/route_factory.py
app/api/routers/assessments.py
app/api/routers/diagnoses.py
app/api/routers/pipelines.py
tests/test_attribute_factory_routes.py
tests/test_routing.py
Rename environment variable for base path
  • Changed the environment variable name from NB_FAPI_ROOT_PATH to NB_FAPI_BASE_PATH in the utility module.
app/api/utility.py
Update documentation badges and links
  • Reformatted README badges to new link styles and adjusted paths for consistency.
README.md

Assessment against linked issues

Issue Objective Addressed Explanation
#156 Ensure that all paths do not end in a trailing slash / for consistency
#156 Rename environment variable for base path from NB_NAPI_ROOT_PATH -> NB_NAPI_BASE_PATH

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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

@alyssadai alyssadai added pr-patch Incremental feature improvement, will increment patch version when merged (0.0.+1) release Create a release when this PR is merged labels Feb 12, 2025
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.37%. Comparing base (7d28b29) to head (b184c06).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #157   +/-   ##
=======================================
  Coverage   97.37%   97.37%           
=======================================
  Files          23       23           
  Lines         724      724           
=======================================
  Hits          705      705           
  Misses         19       19           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alyssadai alyssadai marked this pull request as ready for review February 12, 2025 04:36
@surchs surchs self-requested a review February 12, 2025 13:54
Copy link
Contributor

@surchs surchs left a comment

Choose a reason for hiding this comment

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

Thanks @alyssadai !

🧑‍🍳

README.md Show resolved Hide resolved
@alyssadai alyssadai merged commit 5263128 into main Feb 12, 2025
11 checks passed
@alyssadai alyssadai deleted the standardize-slashes branch February 12, 2025 16:50
Copy link
Contributor

🚀 PR was released in v0.4.4 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-patch Incremental feature improvement, will increment patch version when merged (0.0.+1) release Create a release when this PR is merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent trailing slashes in routes
2 participants