home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where author_association = "MEMBER" and issue = 948890466 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: reactions, created_at (date), updated_at (date)

user 3

  • shoyer 2
  • max-sixty 2
  • dcherian 1

issue 1

  • Make typing-extensions optional · 5 ✖

author_association 1

  • MEMBER · 5 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
885289698 https://github.com/pydata/xarray/pull/5624#issuecomment-885289698 https://api.github.com/repos/pydata/xarray/issues/5624 IC_kwDOAMm_X840xHLi dcherian 2448579 2021-07-22T23:01:59Z 2021-07-22T23:01:59Z MEMBER

nice work! shipping...

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 1,
    "eyes": 0
}
  Make typing-extensions optional 948890466
885278106 https://github.com/pydata/xarray/pull/5624#issuecomment-885278106 https://api.github.com/repos/pydata/xarray/issues/5624 IC_kwDOAMm_X840xEWa shoyer 1217238 2021-07-22T22:32:05Z 2021-07-22T22:32:05Z MEMBER

@max-sixty I just pushed a commit with that change... let's verify that it works in CI and then ship it!

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Make typing-extensions optional 948890466
884652940 https://github.com/pydata/xarray/pull/5624#issuecomment-884652940 https://api.github.com/repos/pydata/xarray/issues/5624 IC_kwDOAMm_X840uruM max-sixty 5635139 2021-07-22T04:45:23Z 2021-07-22T04:45:23Z MEMBER

It's not pretty, but this seems to work, on top of the most recent commit 2191fbc:

```diff diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 232dbec3..3b490dcc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,6 +43,7 @@ repos: types-pytz, # Dependencies that are typed numpy, + typing-extensions==3.10.0.0, ] # run this occasionally, ref discussion https://github.com/pydata/xarray/pull/3194 # - repo: https://github.com/asottile/pyupgrade diff --git a/xarray/core/utils.py b/xarray/core/utils.py index 1f2dfb5c..a139d2ef 100644 --- a/xarray/core/utils.py +++ b/xarray/core/utils.py @@ -10,6 +10,7 @@ import warnings from enum import Enum from typing import ( + TYPE_CHECKING, Any, Callable, Collection, @@ -32,7 +33,6 @@ import numpy as np import pandas as pd

- K = TypeVar("K") V = TypeVar("V") T = TypeVar("T") @@ -307,19 +307,29 @@ def _is_scalar(value, include_0d): )

+# See GH5624, this is a convoluted way to allow type-checking to use TypeGuard without +# requiring typing_extensions as a required dependency to run the code (it is required +# to type-check). try: if sys.version_info >= (3, 10): from typing import TypeGuard else: from typing_extensions import TypeGuard except ImportError: - def is_scalar(value: Any, include_0d: bool = True) -> bool: - """Whether to treat a value as a scalar. + if TYPE_CHECKING: + raise + else: + + def is_scalar(value: Any, include_0d: bool = True) -> bool: + """Whether to treat a value as a scalar. + + Any non-iterable, string, or 0-D array + """ + return _is_scalar(value, include_0d) +

  • Any non-iterable, string, or 0-D array
  • """
  • return _is_scalar(value, include_0d) else: + def is_scalar(value: Any, include_0d: bool = True) -> TypeGuard[Hashable]: """Whether to treat a value as a scalar.

```

It works with or without the edit to .pre-commit-config.yaml

@shoyer want me to add it on and merge?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Make typing-extensions optional 948890466
883620323 https://github.com/pydata/xarray/pull/5624#issuecomment-883620323 https://api.github.com/repos/pydata/xarray/issues/5624 IC_kwDOAMm_X840qvnj shoyer 1217238 2021-07-20T18:56:27Z 2021-07-20T18:56:27Z MEMBER

I think requiring typing-extensions for type checks to pass (especially internal to Xarray) would be totally reasonable. In general, it's not a big deal to install a dependency like this with pip/conda but every new dependency can be a marginal annoyance for those who maintain a custom build system of some sort.

To be honest, this only came up because I asked a co-worker to try using the development version of Xarray. Then they discovered that Apache-Beam currently puts on upper bound on the supported typing-extensions version (<= 3.7), so it would not be possible to install the latest versions of both Beam and Xarray :(. Beam should definitely relax this requirement, too, but it seemed like we do could the same, too.

{
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Make typing-extensions optional 948890466
883604872 https://github.com/pydata/xarray/pull/5624#issuecomment-883604872 https://api.github.com/repos/pydata/xarray/issues/5624 IC_kwDOAMm_X840qr2I max-sixty 5635139 2021-07-20T18:28:54Z 2021-07-20T18:29:48Z MEMBER

Sorry to be late to the party here — I've been less in the flow of xarray for the past week.

How strongly do you feel about not having this as a dependency @shoyer ? I hadn't thought of it as controversial given it's a "official" python package, but without much confidence so happy to defer.

A few options: - Revert TypeGuard (when would we add it back — when typing-extensions has more track record? When 3.10 is our minimum version?) - Have typing-extensions be optional and add # type: ignore comments. Not sure how many would be required though. - Have typing-extensions be optional but raise an error on if TYPE_CHECKING if it's not installed — i.e. type checking will fail without it, but running xarray would be fine. - Make it a required dependency

If we can get a good error message, I would vote for requiring it for type-checking. If it silently swallows the error and doesn't type check, then I'd probably vote for reverting TypeGuard or making typing-extensions required.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Make typing-extensions optional 948890466

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 14.775ms · About: xarray-datasette