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

feat: add packages and content packages #313

Merged
merged 14 commits into from
Nov 12, 2024
Merged

Conversation

tdstein
Copy link
Collaborator

@tdstein tdstein commented Oct 15, 2024

Adds packages support.

Resolves #304
Requires https://github.com/rstudio/connect/issues/28227

Copy link

github-actions bot commented Oct 15, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1755 1618 92% 0% 🟢

New Files

File Coverage Status
src/posit/connect/packages.py 94% 🟢
TOTAL 94% 🟢

Modified Files

File Coverage Status
src/posit/connect/client.py 98% 🟢
src/posit/connect/content.py 96% 🟢
src/posit/connect/context.py 100% 🟢
src/posit/connect/paginator.py 95% 🟢
src/posit/connect/resources.py 83% 🟢
TOTAL 95% 🟢

updated for commit: 9d9d948 by action🐍

@tdstein tdstein force-pushed the tdstein/304-content-packages branch 3 times, most recently from d4bba40 to 1641926 Compare October 16, 2024 19:23
@tdstein
Copy link
Collaborator Author

tdstein commented Oct 16, 2024

@mmarchetti - here is a basic implementation of the '/v1/content/.../packages' endpoint.

@tdstein tdstein force-pushed the tdstein/304-content-packages branch from 1641926 to bedfb7d Compare October 17, 2024 18:06
src/posit/connect/packages.py Outdated Show resolved Hide resolved
src/posit/connect/packages.py Outdated Show resolved Hide resolved
src/posit/connect/packages.py Outdated Show resolved Hide resolved
@tdstein tdstein force-pushed the tdstein/304-content-packages branch 4 times, most recently from 44e3bbc to 9adc52d Compare November 8, 2024 15:58
@@ -269,6 +270,11 @@ def oauth(self) -> OAuth:
"""
return OAuth(self.resource_params, self.cfg.api_key)

@property
@requires(version="2024.10.0-dev")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will bump this to 2024.11.0 after the release.

@tdstein tdstein marked this pull request as ready for review November 8, 2024 16:24
@tdstein tdstein changed the title feat: add packages attribute to content feat: add packages and content packages Nov 8, 2024
@tdstein tdstein force-pushed the tdstein/304-content-packages branch from 9adc52d to 3eadab8 Compare November 8, 2024 17:15
The __getattr__ method should always raise an AttributeError if the value does not exist instead of returning None. The existing implementation causes issues when converting to a Pandas DataFrame
@tdstein
Copy link
Collaborator Author

tdstein commented Nov 12, 2024

I'll fix those linting errors.

@tdstein tdstein added this to the 0.6.0 milestone Nov 12, 2024
@tdstein tdstein self-assigned this Nov 12, 2024
src/posit/connect/packages.py Outdated Show resolved Hide resolved
src/posit/connect/resources.py Outdated Show resolved Hide resolved
src/posit/connect/packages.py Show resolved Hide resolved
hash: NotRequired[Optional[str]]
"""Package description hash for R packages."""

@overload
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@overload

Comment on lines 89 to 93

@overload
def find_by(self, **conditions): ...

def find_by(self, **conditions):
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need for the overload and don't lose typing support when something is misspelled or a wrong type is given

Suggested change
@overload
def find_by(self, **conditions): ...
def find_by(self, **conditions):

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm seeing...

Method "fetch" overrides class "ActiveSequence" in an incompatible manner
  Parameter "**conditions" has no corresponding parameterPylance[reportIncompatibleMethodOverride](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportIncompatibleMethodOverride)

I'm looking for a workaround, but no luck so far.

version: Required[str]
"""The package version"""

@overload
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

Suggested change
@overload

Comment on lines 156 to 161
def fetch(self, **conditions: Unpack[_Fetch]): ...

@overload
def fetch(self, **conditions): ...

def fetch(self, **conditions) -> Generator["Package"]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def fetch(self, **conditions: Unpack[_Fetch]): ...
@overload
def fetch(self, **conditions): ...
def fetch(self, **conditions) -> Generator["Package"]:
def fetch(self, **conditions: Unpack[_Fetch]) -> Generator["Package"]:

app_guid: NotRequired[str]
"""The unique identifier of the application this package is associated with"""

@overload
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@overload

Comment on lines 226 to 230

@overload
def find_by(self, **conditions) -> "Package | None": ...

def find_by(self, **conditions) -> "Package | None":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

Suggested change
@overload
def find_by(self, **conditions) -> "Package | None": ...
def find_by(self, **conditions) -> "Package | None":

@tdstein tdstein merged commit 4edb9f1 into main Nov 12, 2024
34 checks passed
@tdstein tdstein deleted the tdstein/304-content-packages branch November 12, 2024 19:10
Copy link
Collaborator

@toph-allen toph-allen left a comment

Choose a reason for hiding this comment

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

This review was half-done when the LLM hackathon kickoff started and now my pending comment is out of date and not displayed. Oops.

src/posit/connect/resources.py Outdated Show resolved Hide resolved
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.

Add content packages endpoint
4 participants