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

Missing content Class Variable in ProjectFile Class #2821

Closed
GeorgeH87 opened this issue Mar 15, 2024 · 3 comments · Fixed by #2867
Closed

Missing content Class Variable in ProjectFile Class #2821

GeorgeH87 opened this issue Mar 15, 2024 · 3 comments · Fixed by #2867
Labels

Comments

@GeorgeH87
Copy link

Description of the problem, including code/CLI snippet

The ProjectFile class lacks a class variable named content, as described in the documentation. This omission results in the absence of autocomplete support for this specific field, which is inconsistent with the documented behavior.

According to the documentation, the ProjectFile class should contain a class variable named content. However, upon inspection of the codebase, it appears that this variable is missing. As a consequence, when utilizing IDEs or code editors with autocomplete features, users are unable to benefit from autocomplete support for the content field within the ProjectFile class.

Expected Behavior

The ProjectFile class should include a class variable named content, as documented. This variable should be accessible and provide autocomplete support for users working with the class in various IDEs or code editors.

Actual Behavior

  1. Navigate to the ProjectFile class definition.
  2. Attempt to access the content class variable or utilize autocomplete features for this field.

Specifications

  • python-gitlab-4.4.0
  • Visual Studio Code 1.86.2
  • python 3.11.5
@nejch nejch added the support label Mar 15, 2024
@nejch
Copy link
Member

nejch commented Mar 15, 2024

@GeorgeH87 generally all python-gitlab objects lack auto-completion in IDEs, because the attributes are dynamically populated based on the server response, which could change depending on GitLab versions, arguments provided, and the user's privileges.

So I would definitely not rely on this in general. We only have auto-completion guaranteed for methods you can call on an object.

But ProjectFile is a bit special because we have custom methods that populate instance attributes a bit different from other objects. So it's a complete fluke you were able to use auto-completion for its other attributes. I'm not sure if we should add other attributes here, as it might change with GitLab versions.

@GeorgeH87
Copy link
Author

@nejch Thanks for explaining the approach to make the project file independent of possible Gitlab API changes. I just want to point out that this explanation would break with the method ProjectFile.decode since it relies on self.content.

@nejch
Copy link
Member

nejch commented Mar 15, 2024

Ah nice catch @GeorgeH87, I guess we kind of depend on that then. If we're using it in the custom methods then we should add it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants