Git Product home page Git Product logo

Comments (15)

jakebailey avatar jakebailey commented on June 5, 2024 2

Yeah, though I'm not totally sure what it'd look like 😄

I'm tempted to just add support for reading the version out of a package.json, as originally suggested. That's what we do in TypeChat: https://github.com/microsoft/TypeChat/blob/main/python/package.json#L12

from pyright-action.

jakebailey avatar jakebailey commented on June 5, 2024 1

That's an interesting idea, though I don't quite know I feel about Python projects sticking package.json and package-lock.json into their repos and then not using them for anything but pyright.

It doesn't look like dependabot is adding any new ecosystems either, so I don't have the opportunity to encode this elsewhere.

Maybe it'd be possible to pin via the pyright PyPI package (and detect that it's already installed in PATH), if that's something you might find more reasonable.

from pyright-action.

jenshnielsen avatar jenshnielsen commented on June 5, 2024 1

@jakebailey Given that you now support using an installed version from PATH (and thanks for that) I think we can safely close this issue. The user is free to manage installation of pyright in a way that they see fit, which can then be updated using dependabot or a similar tool

from pyright-action.

jakebailey avatar jakebailey commented on June 5, 2024 1

Yes, I agree!

There is still #98, where parsing a version and passing it in may still be valuable, but I think the verison: PATH method is not too bad if you're willing to pull in the PyPI package.

from pyright-action.

jakebailey avatar jakebailey commented on June 5, 2024 1

Indeed; though I largely think parsing it is going to be faster, slightly. I have this in TypeChat: https://github.com/microsoft/TypeChat/blob/f53b971179d0136424a75d67287903a2421af98b/.github/workflows/ci.python.yml#L52

from pyright-action.

jenshnielsen avatar jenshnielsen commented on June 5, 2024

@jakebailey I guess that could work. I have been trying to avoid using the pip version to not pull in an extra node environment within my pip install.

I don't quite know I feel about Python projects sticking package.json and package-lock.json into their repos and then not using them for anything but pyright.

Agree that's not the greatest. It would be better if the files could have a less generic name. As a partial mitigation I guess its possible to have the file in another location than the root to make this less confusing such as .github/pyright/package.json ?
This should work since dependabot can be configured to look in multipel directories

from pyright-action.

jakebailey avatar jakebailey commented on June 5, 2024

Sticking a package.json into .github could work. One immediate trouble I can imagine is that the version specified in the option currently is an exact version (or latest), but package.json would be semver, so I'd need to decide what to do about that, as well as what do about lock files.

from pyright-action.

jenshnielsen avatar jenshnielsen commented on June 5, 2024

Yes, I would expect the user want to specify the full version since it in my experience is fairly common for typechecking to change between 2 patch versions causing new errors

from pyright-action.

jakebailey avatar jakebailey commented on June 5, 2024

I've been playing around with renovate; one thing it supports is a way to annotate parts of files to indicate that they are in fact package versions. I think one can do this:

env:
  # renovate: datasource=npm depName=pyright
  PYRIGHT_VERSION: '1.1.311'

- uses: jakebailey/pyright-action@v1
  with:
    version: ${{ env.PYRIGHT_VERSION }}

Then add the regexManagers:githubActionsVersions preset to a renovate config.

from pyright-action.

jakebailey avatar jakebailey commented on June 5, 2024

That preset only works for vars that end in _VERSION, but here's a working example:

If one opts for copying the preset and modifying it to work on the version: line, that would work too, but an env var is okay.

from pyright-action.

Avasam avatar Avasam commented on June 5, 2024

It doesn't look like dependabot is adding any new ecosystems either, so I don't have the opportunity to encode this elsewhere.

Looks like this is now Contributing new ecosystems

from pyright-action.

ewjoachim avatar ewjoachim commented on June 5, 2024

So, just wanted to weight in: I'm using this action, and also the pre-commit hook from https://github.com/RobertCraigie/pyright-python (the python package wrapper over the pyright package, that is listed in the pyright doc as the way to go.

Do you think there could be a way to ensure that the pyright version used by both system is the same AND is updated by renovate/dependabot ? Given the way pre-commit works, I'm enclined to say the only way I see would be to extract the version from pre-commit with:

$ yq '.repos | filter(.repo == "https://github.com/RobertCraigie/pyright-python").0.rev | "pyright-version="+sub("^v", "")' >> $GITHUB_OUTPUT

(yq is pre-installed on GHA)

So I'd need a step for that, and then use

- uses: jakebailey/pyright-action@v1
  with:
    version: ${{ steps.<id>.outputs.pyright-version }}

Is there a better way or should this be the way ? If so, should it be documented as such ?

from pyright-action.

jakebailey avatar jakebailey commented on June 5, 2024

As more projects keep pinning pyright using different mechanisms (package.json, requirements.txt, pyproject, precommit), I'm less included to try and include something here just becuase it sounds like a slippery slope of every format that could exist.

I have no problem with providing examples in the README using the different methods, though.

from pyright-action.

jenshnielsen avatar jenshnielsen commented on June 5, 2024

@jakebailey FYI installing the version via NPM should also work fine. Here is an example that I hacked together of doing that microsoft/Qcodes#5958

from pyright-action.

jenshnielsen avatar jenshnielsen commented on June 5, 2024

@jakebailey Thanks for the tip. That is indeed a lot simpler and nicer

from pyright-action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.