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

[SYNPY-1347] Adds OOP Team Model #1053

Merged
merged 109 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
625b0ba
OTEL Additions to what is/isn't a span
BryanFauble Nov 10, 2023
6105a71
>= dependencies
BryanFauble Nov 10, 2023
cebe138
Add in document and script around benchmarking
BryanFauble Nov 14, 2023
89cd7c7
Code review feedback
BryanFauble Nov 16, 2023
40250fb
Link to tutorial section
BryanFauble Nov 16, 2023
dd0eeb0
Adjust OTEL dependencies
BryanFauble Nov 16, 2023
03cf453
Mark test as flaky
BryanFauble Nov 16, 2023
dcc29f0
Publish branch to remote
BryanFauble Nov 16, 2023
77a8d6b
Import File earlier
BryanFauble Nov 16, 2023
b27cf12
Merge branch 'develop' into SYNPY-1322-OOP-POC
BryanFauble Nov 16, 2023
244c69f
Support for annotations,cache syn client instance
BryanFauble Nov 20, 2023
55ee852
Remove httpx
BryanFauble Nov 20, 2023
65a1c70
Merge branch 'develop' into SYNPY-1322-OOP-POC
BryanFauble Nov 28, 2023
57da4e1
Adding support for Table
BryanFauble Nov 30, 2023
5bdf4c4
Adding delete row note
BryanFauble Nov 30, 2023
1a11b17
Adding delete table
BryanFauble Nov 30, 2023
f988b5c
More example scripts
BryanFauble Nov 30, 2023
5d5f9f5
Remove comment
BryanFauble Nov 30, 2023
6b5b9af
Prevent creating instance for calling class method
BryanFauble Nov 30, 2023
86a474e
Correcting OTEL context propogation
BryanFauble Dec 1, 2023
dfbddcc
Add note about assuming annotation type
BryanFauble Dec 1, 2023
6b74371
Merge branch 'develop' into SYNPY-1322-OOP-POC
BryanFauble Dec 7, 2023
84a5369
Adding more verbose examples for current project interface
BryanFauble Dec 8, 2023
d370b46
simplify the annotation interface (#1022)
BryanFauble Dec 12, 2023
3aec4ff
[SYNPY-1345] Migrate to mkdocstrings (#1023)
BryanFauble Dec 12, 2023
93bacca
Making sticky nav tabs per team meeting
BryanFauble Dec 12, 2023
bbe905f
Merge branch 'develop' into SYNPY-1322-OOP-POC
BryanFauble Jan 16, 2024
410de22
Remove content not needed
BryanFauble Jan 16, 2024
be9f193
Remove content that is not needed
BryanFauble Jan 16, 2024
cc049b0
Merge develop and consistency changes
BryanFauble Jan 16, 2024
53e4c22
Merge branch 'develop' into SYNPY-1322-OOP-POC
BryanFauble Jan 17, 2024
8fef247
Correct for some changes
BryanFauble Jan 17, 2024
d2ddd1f
adds dataclasses
BWMac Jan 18, 2024
115a22e
updates model attributes
BWMac Jan 22, 2024
dcb43d3
adds UserGroupHeader to user.py
BWMac Jan 22, 2024
a10a9c8
adds async getTeam
BWMac Jan 22, 2024
9dec843
adds async getTeamMembers
BWMac Jan 22, 2024
10f8193
adds async invite_to_team
BWMac Jan 22, 2024
87a78a3
adds async open_invitations
BWMac Jan 22, 2024
5944116
adds ability to create and delete teams
BWMac Jan 23, 2024
2fa6b45
adds team demo script
BWMac Jan 23, 2024
793ab9e
removes otel from demo script
BWMac Jan 23, 2024
6431627
adds comment
BWMac Jan 23, 2024
9de64a4
Merge branch 'develop' into bwmac/SYNPY-1347/oop_team_model
BWMac Jan 23, 2024
b42a442
updates Team methods to use decorator
BWMac Jan 23, 2024
f28525f
updates classes with optional attributes
BWMac Jan 23, 2024
378023d
adds unit tests for TeamMember and UserGroupHeader
BWMac Jan 23, 2024
cbdefb7
adds create_team unit test
BWMac Jan 24, 2024
9d14f09
hoverdocs fix merge Merge branch 'develop' into bwmac/SYNPY-1347/oop_…
BWMac Jan 24, 2024
e2aa03a
adds delete_team unit test
BWMac Jan 24, 2024
c447d04
adds create and delete integration test
BWMac Jan 24, 2024
28e27fb
uncomment other integration tests
BWMac Jan 24, 2024
c761dbc
fix type hints
BWMac Jan 24, 2024
5837d28
adds pytest-asyncio to requriements
BWMac Jan 24, 2024
c32d8e7
adds bad create test
BWMac Jan 24, 2024
df50008
Merge branch 'develop' into bwmac/SYNPY-1347/oop_team_model
BWMac Jan 24, 2024
27034ac
converts generators to Lists
BWMac Jan 24, 2024
f52ffef
adds Team unit tests
BWMac Jan 24, 2024
9b92e9a
pre-commit updates
BWMac Jan 24, 2024
a3756ce
try windows socket
BWMac Jan 24, 2024
2c6c0dc
undo last
BWMac Jan 24, 2024
0022197
moves poc scripts
BWMac Jan 25, 2024
a142ebf
allow socket connections on Windows machines
BWMac Jan 25, 2024
fc2cb7b
updates type hints in client
BWMac Jan 25, 2024
0193fae
Adds change to set client in conftestMerge branch 'develop' into bwma…
BWMac Jan 25, 2024
d571866
fixes docstrings
BWMac Jan 25, 2024
5b432da
adds md for teams
BWMac Jan 25, 2024
cb2adba
removes set_client calls in unit tests
BWMac Jan 25, 2024
6b74b46
adds comment to conftest
BWMac Jan 25, 2024
749cd35
sonarlint changes
BWMac Jan 25, 2024
923cb83
updates type hints
BWMac Jan 25, 2024
40b601f
removes individual md files
BWMac Jan 25, 2024
3275447
adds models to init
BWMac Jan 25, 2024
c6859b7
update demo script to use lists
BWMac Jan 25, 2024
1fc5f25
updates type hints
BWMac Jan 26, 2024
20ea51e
updates default bool values
BWMac Jan 26, 2024
5b2180d
updates client intergration test
BWMac Jan 26, 2024
817d2e8
updates type hints
BWMac Jan 26, 2024
e2c2b63
adds integration tests from model
BWMac Jan 26, 2024
5afb364
adds missing type hinting
BWMac Jan 26, 2024
d0a9219
reduce repeated code in integration tests
BWMac Jan 26, 2024
10352ae
creates constants for unit tests
BWMac Jan 26, 2024
9d6cf7a
adds comments to unit tests
BWMac Jan 26, 2024
7196f9e
updates create_delete integration test
BWMac Jan 26, 2024
2f814d8
removes uneeded return
BWMac Jan 26, 2024
e2942a6
adds missing asserts to unit tests
BWMac Jan 26, 2024
952a60e
updates Args to arguments
BWMac Jan 26, 2024
1d851f6
addresses nits in team
BWMac Jan 26, 2024
56c7494
fix usergroupheader part of unit test
BWMac Jan 26, 2024
0821bf5
adds error message verification
BWMac Jan 29, 2024
bb33845
converts from_id and from_name to classmethods
BWMac Jan 29, 2024
df43c65
adds create_ and delete_ team to docs
BWMac Jan 29, 2024
a05acff
add comments to test user
BWMac Jan 29, 2024
11092cc
adds Team.get() and tests
BWMac Jan 29, 2024
7088be4
Merge branch 'develop' into bwmac/SYNPY-1347/oop_team_model
BWMac Jan 29, 2024
72a6e31
Update docs/scripts/object_orientated_programming_poc/oop_poc_team.py
BWMac Jan 29, 2024
d7a17a8
Update docs/scripts/object_orientated_programming_poc/oop_poc_team.py
BWMac Jan 29, 2024
af68302
adds get() to poc script
BWMac Jan 29, 2024
894d9e3
updates to not pass OTEL context
BWMac Jan 29, 2024
4a4efce
comment out invite-realted integration tests
BWMac Jan 29, 2024
5c0cd49
adds default public join and request
BWMac Jan 30, 2024
b8595ea
update create team unit test
BWMac Jan 30, 2024
20de08c
documents eventual consistency
BWMac Jan 30, 2024
52122ce
changes new attributes to snake case
BWMac Jan 30, 2024
03c3c0d
clarify eventual consistency
BWMac Jan 30, 2024
ba7b199
adds link
BWMac Jan 30, 2024
5b206e6
try new acount for integration test
BWMac Feb 1, 2024
27f1689
Merge branch 'develop' into bwmac/SYNPY-1347/oop_team_model
BWMac Feb 1, 2024
bf1d459
fixes pre-commit
BWMac Feb 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 42 additions & 42 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/reference/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ those memebrs. We are roughly grouping these for similar functionality. -->
- getEvaluation
- getEvaluationByContentSource
- getEvaluationByName
- create_team
- delete_team
- getProjectSetting
- getSubmission
- getSubmissions
Expand Down
23 changes: 21 additions & 2 deletions docs/reference/oop/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ the client.
filters:
- "!"
---
::: synapseclient.models.Team
BryanFauble marked this conversation as resolved.
Show resolved Hide resolved
options:
members:
- create
- delete
- from_id
- from_name
- members
- invite
- open_invitations
---
::: synapseclient.models.UserProfile
options:
members:
Expand Down Expand Up @@ -98,6 +109,14 @@ the client.
```
</details>

<details class="quote">
<summary>Current Synapse interface for working with a project</summary>

```python
{!docs/scripts/object_orientated_programming_poc/synapse_project.py!}
```
</details>

<details class="quote">
<summary>Working with activities</summary>

Expand All @@ -107,9 +126,9 @@ the client.
</details>

<details class="quote">
<summary>Current Synapse interface for working with a project</summary>
<summary>Working with teams</summary>

```python
{!docs/scripts/object_orientated_programming_poc/synapse_project.py!}
{!docs/scripts/object_orientated_programming_poc/oop_poc_team.py!}
```
</details>
63 changes: 63 additions & 0 deletions docs/scripts/object_orientated_programming_poc/oop_poc_team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"""The purpose of this script is to demonstrate how to use the new OOP interface for teams.
The following actions are shown in this script:
1. Creating a Team
2. Instantiating a Team object from Synapse
3. Getting information about the members of a Team
4. Inviting a user to a Team
5. Checking on invitations to join a Team
6. Deleting a Team
"""

import asyncio

from synapseclient.models.team import Team
import synapseclient


syn = synapseclient.Synapse(debug=True)
syn.login()


async def new_team():
# Create a team
new_team = Team(
name="python-client-test-team",
description="testing OOP interface",
can_public_join=False,
)
my_synapse_team = await new_team.create()
print(my_synapse_team)

# Instantiate a Team object from a Synapse team
my_team = await Team.from_id(id=my_synapse_team.id)
print(my_team)

# Sleep because the API for retrieving a team by name is eventually consistent. from_id works right away, however.
await asyncio.sleep(5)
my_team = await Team.from_name(name=my_synapse_team.name)
print(my_team)

# Refresh the team to get the latest information
await my_team.get()
print(my_team)

# Get information about the members of a Team
members = await my_team.members()
print(members)

# Invite a user to a Team
invite = await my_team.invite(
user="test_account_synapse_client",
message="testing OOP interface (do not accept)",
)
print(invite)

# Get open invitations for the Team
invitations = await my_team.open_invitations()
print(invitations)

# Delete the Team
await my_team.delete()


asyncio.run(new_team())
Loading
Loading