GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: reduce and update methods for DocumentArray and BaseDocument by JoanFM · Pull Request #1076 · docarray/docarray

This repository was archived by the owner on Sep 9, 2026. It is now read-only.

Conversation

@JoanFM

@JoanFM JoanFM commented Feb 2, 2023

Copy link
Copy Markdown
Member

Goals:

Implement reduce methods in utils

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Joan Fontanals Martinez added 4 commits February 1, 2023 19:08
Joan Fontanals Martinez
feat: add reduce utils
a5ef6ca
Joan Fontanals Martinez
feat: support sets reducing
745d1c2
Signed-off-by: Joan Fontanals Martinez <[email protected]>
Joan Fontanals Martinez
feat: support sub docarrays reducing
9419ec5
Signed-off-by: Joan Fontanals Martinez <[email protected]>
Joan Fontanals Martinez
feat: finish feature implementation and testing
5f0ecef
Signed-off-by: Joan Fontanals Martinez <[email protected]>
@github-actions github-actions Bot added size/m area/core area/testing labels Feb 2, 2023
@JoanFM
JoanFM requested review from JohannesMessner, anna-charlotte and samsja February 2, 2023 16:41
@JoanFM
JoanFM force-pushed the feat-reduce-v2 branch from f9c9360 to 663869c Compare February 2, 2023 16:47
Joan Fontanals Martinez
docs: add documentation and fix ruff
5c439b8
Signed-off-by: Joan Fontanals Martinez <[email protected]>
@JoanFM
JoanFM force-pushed the feat-reduce-v2 branch from 663869c to 5c439b8 Compare February 2, 2023 16:58
Joan Fontanals
Merge branch 'feat-rewrite-v2' into feat-reduce-v2
a517a33
Signed-off-by: Joan Fontanals Martinez <[email protected]>
@JoanFM
JoanFM force-pushed the feat-reduce-v2 branch from 45f4793 to a517a33 Compare February 2, 2023 17:03
anna-charlotte
anna-charlotte reviewed Feb 3, 2023
View reviewed changes
Comment thread docarray/utils/reduce.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

samsja
samsja reviewed Feb 3, 2023
View reviewed changes
Comment thread docarray/utils/reduce.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

samsja
samsja reviewed Feb 3, 2023
View reviewed changes
Comment thread docarray/utils/reduce.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

samsja
samsja reviewed Feb 3, 2023
View reviewed changes
Comment thread docarray/utils/reduce.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

JohannesMessner
JohannesMessner previously requested changes Feb 3, 2023
View reviewed changes
Comment thread docarray/utils/reduce.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/utils/reduce.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/utils/reduce.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/utils/reduce.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/utils/reduce.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Joan Fontanals Martinez
fix: apply comments and support dicts
7c3d9f4
Signed-off-by: Joan Fontanals Martinez <[email protected]>
samsja
samsja reviewed Feb 3, 2023
View reviewed changes
Comment thread docarray/utils/reduce.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

samsja
samsja reviewed Feb 3, 2023
View reviewed changes
Comment thread docarray/base_document/document.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@JoanFM
JoanFM force-pushed the feat-reduce-v2 branch from cbf692d to d89ae6c Compare February 3, 2023 11:11
Joan Fontanals Martinez
feat: add update method to BaseDocument and fix reduce behavior
5bb4262
Signed-off-by: Joan Fontanals Martinez <[email protected]>
@JoanFM
JoanFM force-pushed the feat-reduce-v2 branch from d89ae6c to 5bb4262 Compare February 3, 2023 11:17
Joan Fontanals Martinez
refactor: move reduce docs to update
44c5b8a
Signed-off-by: Joan Fontanals Martinez <[email protected]>
@JoanFM JoanFM changed the title feat: Implement reduce methods in utils feat: reduce and update methods for docarray and document Feb 3, 2023
@JoanFM JoanFM changed the title feat: reduce and update methods for docarray and document feat: reduce and update methods for DocumentArray and BaseDocument Feb 3, 2023
@JoanFM
JoanFM requested a review from samsja February 3, 2023 11:46
@JoanFM
JoanFM requested review from JohannesMessner and anna-charlotte February 3, 2023 11:46
samsja
samsja reviewed Feb 3, 2023
View reviewed changes
Comment thread docarray/base_document/document.py Outdated
Comment on lines +130 to +133
elif (
isinstance(field_type, _GenericAlias)
and field_type.__origin__ is list
):

@samsja samsja Feb 3, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I am wondering if this will work with newer python version where you can pass list instead of List as a valid type hint ?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@JoanFM JoanFM Feb 3, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

what Python version are u referring to?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@samsja samsja Feb 3, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

in python 3.9 you can do

class A:
   b: list[inŧ]

instead of

class A:
   b: List[int]

I am almost sure they have maintain compatibility with older version but the fact that we are using a private object from the typing library tell me that we are not 100% sure we will support this new way.

Maybe there is a way not to use the _GenericAlias since it is private ?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@samsja samsja Feb 3, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Oh actually we can use

from typing_inspect import is_generic_type

we already rely on this library for some type hint things and they make sure that their function are compatible with every python version

https://github.com/ilevkivskyi/typing_inspect

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@JoanFM JoanFM Feb 3, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

can u propose a PR on top of mine to do this? I am not sure what u are intending to tell. I did trial and error until I found the working formula

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@samsja samsja Feb 3, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I pushed a commit

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@samsja
refactor: use get origin instead of private _GenericAlais
72684cd
Signed-off-by: samsja <[email protected]>
samsja
samsja suggested changes Feb 3, 2023
View reviewed changes
Comment thread docarray/base_document/document.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@samsja
fix: fix ruff
e921937
Signed-off-by: samsja <[email protected]>
samsja
samsja reviewed Feb 6, 2023
View reviewed changes
Comment thread docarray/base_document/document.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Joan Fontanals Martinez
docs: add clarification about tuples
dadffb5
@JoanFM
JoanFM requested a review from samsja February 6, 2023 09:12
@github-actions

github-actions Bot commented Feb 6, 2023

Copy link
Copy Markdown

📝 Docs are deployed on https://ft-feat-reduce-v2--jina-docs.netlify.app 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

samsja
samsja approved these changes Feb 6, 2023
View reviewed changes
@JoanFM
JoanFM dismissed JohannesMessner’s stale review February 6, 2023 09:48

taken care

@JoanFM
JoanFM merged commit 149ee5e into feat-rewrite-v2 Feb 6, 2023
@JoanFM
JoanFM deleted the feat-reduce-v2 branch February 6, 2023 09:48
@samsja samsja mentioned this pull request Feb 6, 2023
Meta: DocArray v2 Roadmap #780
Closed
42 of 47 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@anna-charlotte anna-charlotte Awaiting requested review from anna-charlotte
@JohannesMessner JohannesMessner Awaiting requested review from JohannesMessner
1 more reviewer
@samsja samsja samsja approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area/core area/testing size/m

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@JoanFM @JohannesMessner @samsja @anna-charlotte
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.