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

Add support for Python tilde (~=) version comparator #1824

Open
1 task done
mitchdost opened this issue Nov 8, 2024 · 0 comments
Open
1 task done

Add support for Python tilde (~=) version comparator #1824

mitchdost opened this issue Nov 8, 2024 · 0 comments

Comments

@mitchdost
Copy link

mitchdost commented Nov 8, 2024

Problem description

Hello,

First, thank you for providing this excellent piece of software! I really appreciate all the work that goes into maintaining and developing Mason.

I’d like to contribute a new package, docstrfmt, to the Mason registry. However, the docstrfmt project specifies a Python requirement using the requires-python = "~=3.8" (tilde) version comparator, which Mason currently doesn’t support.

Would it be possible to add support for the tilde (~=) version comparator in Mason? This would help to ensure compatibility with Python packages that use this notation, in line with PEP 440 standards.

I was not sure if this is a bug or this is a feature request and somehow it is package related but also feature related.

Thank you for considering this request!

Best regards,
Mitch

Why do you think this is an issue with mason.nvim?

The error from mason.nvim is: Failed to find a python3 installation in PATH that meets the required versions (~=3.8). Found version: 3.10.12.

I had a look into the code of mason.nvim and found no place where this comparator is handled.

Neovim version (>= 0.7)

NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713484068

Operating system/version

Linux moritz 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

  • Yes

I've recently downloaded the latest plugin version of mason.nvim, mason.nvim

Steps to reproduce

I followed the mason-regitstry contributing documentation and used that as the package spec for docstrfmt

---
name: docstrfmt
description: "A formatter for Sphinx flavored reStructuredText."
homepage: https://github.com/LilSpazJoekp/docstrfmt
licenses:
  - MIT
languages:
  - reStructuredText
categories:
  - Formatter

source:
  id: pkg:pypi/[email protected]

bin:
  docstrfmt: pypi:docstrfmt

Actual behavior

Failed to find a python3 installation in PATH that meets the required versions (~=3.8). Found version: 3.10.12.

I can actually force the installation with :MasonInstall --force docstrfmt and then it's working well, but in our team we reinstall our nvim setup on a regular basis and then we always have to remember to install docstrfmt manually, where all other tools are installed automatically with the help of mason-tool-installer.nvim,

Expected behavior

3.10.12 is meeting the requirements. As I understood ~=3.8 means version >= 3.8 and version < 4.0

Healthcheck

mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
    mason.providers.registry-api
    mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `local: ~/src/lua/mason-registry` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.`
- OK wget: `GNU Wget 1.21.2 übersetzt unter linux-gnu.`
- OK curl: `curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.18`
- OK gzip: `gzip 1.10`
- OK tar: `tar (GNU tar) 1.34`
- OK bash: `GNU bash, Version 5.1.16(1)-release (x86_64-pc-linux-gnu)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- OK node: `v22.1.0`
- OK Ruby: `ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]`
- OK Go: `go version go1.18.1 linux/amd64`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: `Python 3.10.12`
- OK npm: `10.7.0`
- OK java: `openjdk version "17.0.12" 2024-07-16`
- OK RubyGem: `3.3.5`
- OK javac: `javac 17.0.12`
- OK pip: `pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 6. Remaining: 54. Limit: 60. Reset: Fr 08 Nov 2024 12:31:35 CET.
  Install and authenticate via gh-cli to increase rate limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant