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

fix: handle dynamic pyproject.toml versioning #1804 #1983

Merged
merged 2 commits into from
Jul 10, 2023

Conversation

rickstaa
Copy link
Contributor

@rickstaa rickstaa commented Jun 14, 2023

This PR makes sure that people that use dynamic versioning in the pyproject.toml file receive a warning instead of an error.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

Warning
Tests fail due to typescript bugs that were already present in the repository before I made my changes 🤔 (see logs below). Happy to take a look but I wanted to keep the changes in this pull request minimal so first wanted to check with the maintainers.

  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1804 🦕

Failing tests

Some tests were already failing before my changes 🤔.

src/github.ts:534:7 - error TS2769: No overload matches this call.
  Overload 1 of 4, '(route: keyof PaginatingEndpoints, parameters?: { per_page?: number | undefined; cursor?: string | undefined; redelivery?: boolean | undefined; } | { per_page?: number | undefined; page?: number | undefined; } | ... 220 more ... | undefined): AsyncIterableIterator<...>', gave the following error.
    Argument of type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { page?: number | undefined; per_page?: number | undefined; } | undefined; path: { owner: string; repo: string; ref: string; }; }; responses: { ...; }; }>, "baseUrl" | ... 1 more ... | "mediaType">) | undefined): Promise<...>; defaults...' is not assignable to parameter of type 'keyof PaginatingEndpoints'.
      Type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { page?: number | undefined; per_page?: number | undefined; } | undefined; path: { owner: string; repo: string; ref: string; }; }; responses: { ...; }; }>, "baseUrl" | ... 1 more ... | "mediaType">) | undefined): Promise<...>; defaults...' is not assignable to type '"GET /users/{username}/subscriptions"'.
  Overload 2 of 4, '(route: string, parameters?: RequestParameters | undefined): AsyncIterableIterator<OctokitResponse<PaginationResults<unknown>, number>>', gave the following error.
    Argument of type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { page?: number | undefined; per_page?: number | undefined; } | undefined; path: { owner: string; repo: string; ref: string; }; }; responses: { ...; }; }>, "baseUrl" | ... 1 more ... | "mediaType">) | undefined): Promise<...>; defaults...' is not assignable to parameter of type 'string'.
  Overload 3 of 4, '(request: RequestInterface<object>, parameters?: string | undefined): AsyncIterableIterator<NormalizeResponse<OctokitResponse<any, number>>>', gave the following error.
    Argument of type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { page?: number | undefined; per_page?: number | undefined; } | undefined; path: { owner: string; repo: string; ref: string; }; }; responses: { ...; }; }>, "baseUrl" | ... 1 more ... | "mediaType">) | undefined): Promise<...>; defaults...' is not assignable to parameter of type 'RequestInterface<object>'.
      Types of property 'defaults' are incompatible.
        Type '<O extends import("/home/ricks/Development/work/release-please/node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types/dist-types/RequestParameters").RequestParameters = import("/home/ricks/Development/work/release-please/node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit...' is not assignable to type '<O extends import("/home/ricks/Development/work/release-please/node_modules/@octokit/types/dist-types/RequestParameters").RequestParameters = import("/home/ricks/Development/work/release-please/node_modules/@octokit/types/dist-types/RequestParameters").RequestParameters>(newDefaults: O) => import("/home/ricks/Develo...'.

534       this.octokit.repos.getCommit,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~


src/github.ts:541:33 - error TS2339: Property 'files' does not exist on type '{ id: number; node_id: string; name: string; full_name: string; license: { key: string; name: string; url: string | null; spdx_id: string | null; node_id: string; html_url?: string | undefined; } | null; ... 93 more ...; anonymous_access_enabled?: boolean | undefined; }[] | ... 134 more ... | ({ ...; } & { ...; }[])'.
  Property 'files' does not exist on type '{ id: number; node_id: string; name: string; full_name: string; license: { key: string; name: string; url: string | null; spdx_id: string | null; node_id: string; html_url?: string | undefined; } | null; ... 93 more ...; anonymous_access_enabled?: boolean | undefined; }[]'.

541       for (const f of resp.data.files || []) {
                                    ~~~~~

src/github.ts:678:7 - error TS2769: No overload matches this call.
  Overload 1 of 4, '(route: keyof PaginatingEndpoints, parameters?: { per_page?: number | undefined; cursor?: string | undefined; redelivery?: boolean | undefined; } | { per_page?: number | undefined; page?: number | undefined; } | ... 220 more ... | undefined): AsyncIterableIterator<...>', gave the following error.
    Argument of type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { state?: "all" | "closed" | "open" | undefined; head?: string | undefined; base?: string | undefined; sort?: "created" | ... 3 more ... | undefined; direction?: "desc" | ... 1 more ... | undefined; per_page?: number | undefined; page?...' is not assignable to parameter of type 'keyof PaginatingEndpoints'.
      Type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { state?: "all" | "closed" | "open" | undefined; head?: string | undefined; base?: string | undefined; sort?: "created" | ... 3 more ... | undefined; direction?: "desc" | ... 1 more ... | undefined; per_page?: number | undefined; page?...' is not assignable to type '"GET /users/{username}/subscriptions"'.
  Overload 2 of 4, '(route: string, parameters?: RequestParameters | undefined): AsyncIterableIterator<OctokitResponse<PaginationResults<unknown>, number>>', gave the following error.
    Argument of type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { state?: "all" | "closed" | "open" | undefined; head?: string | undefined; base?: string | undefined; sort?: "created" | ... 3 more ... | undefined; direction?: "desc" | ... 1 more ... | undefined; per_page?: number | undefined; page?...' is not assignable to parameter of type 'string'.
  Overload 3 of 4, '(request: RequestInterface<object>, parameters?: string | undefined): AsyncIterableIterator<NormalizeResponse<OctokitResponse<any, number>>>', gave the following error.
    Argument of type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { state?: "all" | "closed" | "open" | undefined; head?: string | undefined; base?: string | undefined; sort?: "created" | ... 3 more ... | undefined; direction?: "desc" | ... 1 more ... | undefined; per_page?: number | undefined; page?...' is not assignable to parameter of type 'RequestInterface<object>'.
      Types of property 'defaults' are incompatible.
        Type '<O extends import("/home/ricks/Development/work/release-please/node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types/dist-types/RequestParameters").RequestParameters = import("/home/ricks/Development/work/release-please/node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit...' is not assignable to type '<O extends import("/home/ricks/Development/work/release-please/node_modules/@octokit/types/dist-types/RequestParameters").RequestParameters = import("/home/ricks/Development/work/release-please/node_modules/@octokit/types/dist-types/RequestParameters").RequestParameters>(newDefaults: O) => import("/home/ricks/Develo...'.

678       this.octokit.rest.pulls.list,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~


src/github.ts:691:41 - error TS2339: Property 'merged_at' does not exist on type 'string | { id: number; guid: string; delivered_at: string; redelivery: boolean; duration: number; status: string; status_code: number; event: string; action: string | null; installation_id: number | null; repository_id: number | null; } | ... 133 more ... | { ...; }'.
  Property 'merged_at' does not exist on type 'string'.

691         if (status !== 'MERGED' || pull.merged_at) {
                                            ~~~~~~~~~

src/github.ts:694:34 - error TS2339: Property 'head' does not exist on type 'string | { id: number; guid: string; delivered_at: string; redelivery: boolean; duration: number; status: string; status_code: number; event: string; action: string | null; installation_id: number | null; repository_id: number | null; } | ... 133 more ... | { ...; }'.
  Property 'head' does not exist on type 'string'.

694             headBranchName: pull.head.ref,
                                     ~~~~

src/github.ts:695:34 - error TS2339: Property 'base' does not exist on type 'string | { id: number; guid: string; delivered_at: string; redelivery: boolean; duration: number; status: string; status_code: number; event: string; action: string | null; installation_id: number | null; repository_id: number | null; } | ... 133 more ... | { ...; }'.
  Property 'base' does not exist on type 'string'.

695             baseBranchName: pull.base.ref,
                                     ~~~~

src/github.ts:696:26 - error TS2339: Property 'number' does not exist on type 'string | { id: number; guid: string; delivered_at: string; redelivery: boolean; duration: number; status: string; status_code: number; event: string; action: string | null; installation_id: number | null; repository_id: number | null; } | ... 133 more ... | { ...; }'.
  Property 'number' does not exist on type 'string'.

696             number: pull.number,
                             ~~~~~~

src/github.ts:697:25 - error TS2339: Property 'title' does not exist on type 'string | { id: number; guid: string; delivered_at: string; redelivery: boolean; duration: number; status: string; status_code: number; event: string; action: string | null; installation_id: number | null; repository_id: number | null; } | ... 133 more ... | { ...; }'.
  Property 'title' does not exist on type 'string'.

697             title: pull.title,
                            ~~~~~

src/github.ts:698:24 - error TS2339: Property 'body' does not exist on type 'string | { id: number; guid: string; delivered_at: string; redelivery: boolean; duration: number; status: string; status_code: number; event: string; action: string | null; installation_id: number | null; repository_id: number | null; } | ... 133 more ... | { ...; }'.
  Property 'body' does not exist on type 'string'.

698             body: pull.body || '',
                           ~~~~

src/github.ts:699:26 - error TS2339: Property 'labels' does not exist on type 'string | { id: number; guid: string; delivered_at: string; redelivery: boolean; duration: number; status: string; status_code: number; event: string; action: string | null; installation_id: number | null; repository_id: number | null; } | ... 133 more ... | { ...; }'.
  Property 'labels' does not exist on type 'string'.

699             labels: pull.labels.map(label => label.name),
                             ~~~~~~

src/github.ts:699:37 - error TS7006: Parameter 'label' implicitly has an 'any' type.

699             labels: pull.labels.map(label => label.name),
                                        ~~~~~

src/github.ts:701:23 - error TS2339: Property 'merge_commit_sha' does not exist on type 'string | { id: number; guid: string; delivered_at: string; redelivery: boolean; duration: number; status: string; status_code: number; event: string; action: string | null; installation_id: number | null; repository_id: number | null; } | ... 133 more ... | { ...; }'.
  Property 'merge_commit_sha' does not exist on type 'string'.

701             sha: pull.merge_commit_sha || undefined,
                          ~~~~~~~~~~~~~~~~

src/github.ts:903:7 - error TS2769: No overload matches this call.
  Overload 1 of 4, '(route: keyof PaginatingEndpoints, parameters?: { per_page?: number | undefined; cursor?: string | undefined; redelivery?: boolean | undefined; } | { per_page?: number | undefined; page?: number | undefined; } | ... 220 more ... | undefined): AsyncIterableIterator<...>', gave the following error.
    Argument of type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { per_page?: number | undefined; page?: number | undefined; } | undefined; path: { owner: string; repo: string; }; }; responses: { ...; }; }>, "baseUrl" | ... 1 more ... | "mediaType">) | undefined): Promise<...>; defaults: <O extends ...' is not assignable to parameter of type 'keyof PaginatingEndpoints'.
      Type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { per_page?: number | undefined; page?: number | undefined; } | undefined; path: { owner: string; repo: string; }; }; responses: { ...; }; }>, "baseUrl" | ... 1 more ... | "mediaType">) | undefined): Promise<...>; defaults: <O extends ...' is not assignable to type '"GET /users/{username}/subscriptions"'.
  Overload 2 of 4, '(route: string, parameters?: RequestParameters | undefined): AsyncIterableIterator<OctokitResponse<PaginationResults<unknown>, number>>', gave the following error.
    Argument of type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { per_page?: number | undefined; page?: number | undefined; } | undefined; path: { owner: string; repo: string; }; }; responses: { ...; }; }>, "baseUrl" | ... 1 more ... | "mediaType">) | undefined): Promise<...>; defaults: <O extends ...' is not assignable to parameter of type 'string'.
  Overload 3 of 4, '(request: RequestInterface<object>, parameters?: string | undefined): AsyncIterableIterator<NormalizeResponse<OctokitResponse<any, number>>>', gave the following error.
    Argument of type '{ (params?: (RequestParameters & Omit<ToOctokitParameters<{ parameters: { query?: { per_page?: number | undefined; page?: number | undefined; } | undefined; path: { owner: string; repo: string; }; }; responses: { ...; }; }>, "baseUrl" | ... 1 more ... | "mediaType">) | undefined): Promise<...>; defaults: <O extends ...' is not assignable to parameter of type 'RequestInterface<object>'.
      The types of 'defaults(...).defaults(...).defaults(...).defaults(...).endpoint.DEFAULTS' are incompatible between these types.
        Type 'object & O & O & O & O & import("/home/ricks/Development/work/release-please/node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types/dist-types/RequestParameters").RequestParameters & { ...; }' is not assignable to type 'object & O & O & O & O & import("/home/ricks/Development/work/release-please/node_modules/@octokit/types/dist-types/RequestParameters").RequestParameters & { ...; }'.
          Type 'object & O & O & O & O & RequestParameters & { baseUrl: string; method: RequestMethod; url?: string | undefined; headers: RequestHeaders & { ...; }; mediaType: { ...; }; }' is not assignable to type '{ baseUrl: string; method: RequestMethod; url?: string | undefined; headers: RequestHeaders & { accept: string; "user-agent": string; }; mediaType: { format: string; previews: string[]; }; }'.
            The types of 'mediaType.previews' are incompatible between these types.
              Type 'string[] | undefined' is not assignable to type 'string[]'.
                Type 'undefined' is not assignable to type 'string[]'.

903       this.octokit.rest.repos.listTags,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


src/github.ts:914:21 - error TS2339: Property 'name' does not exist on type 'string | { id: number; guid: string; delivered_at: string; redelivery: boolean; duration: number; status: string; status_code: number; event: string; action: string | null; installation_id: number | null; repository_id: number | null; } | ... 133 more ... | { ...; }'.
  Property 'name' does not exist on type 'string'.

914           name: tag.name,
                        ~~~~

src/github.ts:915:20 - error TS2339: Property 'commit' does not exist on type 'string | { id: number; guid: string; delivered_at: string; redelivery: boolean; duration: number; status: string; status_code: number; event: string; action: string | null; installation_id: number | null; repository_id: number | null; } | ... 133 more ... | { ...; }'.
  Property 'commit' does not exist on type 'string'.

915           sha: tag.commit.sha,
                       ~~~~~~

This PR makes sure that people that use dynamic versioning in the `pyproject.toml`
file receive a warning instead of an error. See googleapis#1804.
@rickstaa rickstaa requested review from a team as code owners June 14, 2023 12:02
@google-cla
Copy link

google-cla bot commented Jun 14, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Jun 14, 2023
rickstaa added a commit to rickstaa/release-please-action that referenced this pull request Jun 14, 2023
This commit resolves the error that is thrown when dynamic versioning is
used in the pyproject.toml file (see
googleapis/release-please#1983).
@chingor13 chingor13 merged commit 5ee5baa into googleapis:main Jul 10, 2023
@rickstaa rickstaa deleted the add_pytoml_version_warning branch July 10, 2023 17:21
rickstaa added a commit to rickstaa/stable-learning-control that referenced this pull request Jul 10, 2023
This commit updates the 'release-please' package to the latest version
now that googleapis/release-please#1983 has been
merged.
rickstaa added a commit to rickstaa/stable-learning-control that referenced this pull request Jul 10, 2023
This commit updates the 'release-please' package to the latest version
now that googleapis/release-please#1983 has been
merged.
rickstaa added a commit to rickstaa/stable-gym that referenced this pull request Jul 10, 2023
This commit updates 'release-please' now that
googleapis/release-please#1983 is merged.
rickstaa added a commit to rickstaa/stable-gym that referenced this pull request Jul 10, 2023
This commit updates 'release-please' now that
googleapis/release-please#1983 is merged.
rickstaa added a commit to rickstaa/panda-gazebo that referenced this pull request Jul 10, 2023
This commit updates release-please now that
googleapis/release-please#1983 is merged.
rickstaa added a commit to rickstaa/panda-gazebo that referenced this pull request Jul 10, 2023
This commit updates release-please now that
googleapis/release-please#1983 is merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python pyproject.toml with dynamic version
2 participants