Skip to content

Fix for default file paths#110

Merged
GDYendell merged 1 commit intomainfrom
fix-default-paths
Jan 22, 2025
Merged

Fix for default file paths#110
GDYendell merged 1 commit intomainfrom
fix-default-paths

Conversation

@marcelldls
Copy link
Contributor

Currently the default epics options set an absolute file path. For example:

@dataclass
class EpicsDocsOptions:
    path: Path = Path.cwd()  # The subject of this PR
    depth: int | None = None

This means that the resulting schema depends on the host and execution context:

    "EpicsDocsOptions": {
      "properties": {
        "path": {
          "default": "/workspaces/thorlabs-mff-fastcs",  # Changes dynamically
          "format": "path",
          "title": "Path",
          "type": "string"
        },
        "depth": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Depth"
        }
      },

Here it is proposed to rather use a relative path. This does not prevent an absolute path being passed. It allows the same functionality as before but with a consistent schema and additionally allows to make alterations to the relative path. This results in a schema of:

    "EpicsDocsOptions": {
      "properties": {
        "path": {
          "default": ".",
          "format": "path",
          "title": "Path",
          "type": "string"
        },
        "depth": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Depth"
        }
      },

@marcelldls marcelldls requested a review from GDYendell January 14, 2025 17:43
@codecov
Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.08%. Comparing base (e4d710b) to head (4c234fd).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/fastcs/transport/epics/gui.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #110   +/-   ##
=======================================
  Coverage   88.08%   88.08%           
=======================================
  Files          31       31           
  Lines        1309     1309           
=======================================
  Hits         1153     1153           
  Misses        156      156           

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

@marcelldls
Copy link
Contributor Author

@GDYendell Rebased to solved failed linting

@GDYendell GDYendell merged commit cf891fe into main Jan 22, 2025
16 of 17 checks passed
@GDYendell GDYendell deleted the fix-default-paths branch January 22, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants

Comments