#i don't see anything here about

1 messages · Page 1 of 1 (latest)

ivory eagle
#
[[tool.hatch.envs.default.matrix]]
python = ["3.12", "3.11", "3.10", "3.9", "3.8"]

and then you can run something like hatch run python -c "import sys;print(sys.executable)"

tired ridge
#

thanks, i'll give it a go in an hour or two, see how it goes.

ivory eagle
#

np lmk, I'm always here

tired ridge
#

do you have an example of anything that is currently using this already?

ivory eagle
#

what do you mean?

tired ridge
#

Is there any project that is already using matrix?

ivory eagle
#

is there something in particular you are trying to find out?

tired ridge
#

the short of it is that i need to do

python -m pip install venv venv && activate
python -m pip install -r requirements.txt
python -m module --option1 --option2 arg.py
start exe
python main.py
``` on a matrix
#

i have my own hombrew solution but it's only for windows and relies on the pylauncher

ivory eagle
#

that seems pretty standard and is totally possible, have you read the docs?

tired ridge
#
[[tool.hatch.envs.main.matrix]]
python = ["3.11", "3.12"]

[tool.hatch.envs.main]
dependencies = ["rich"]

[tool.hatch.envs.main.scripts]
hello = "python --version"
``` in theory this should be able to just run with `hatch run main`
#

unless i'm missing something

#

welp, it didn't

ivory eagle
#

hatch run main:hello

tired ridge
#

that's pretty cool, thank you!

#
main              0.0.0   /home/krrt/Desktop/sampler

it seems to create an editable project however, is there a way i can avoid this?
can i make it create a clean env each run? rather than reusing the venv

#

You can remove a single environment or environment matrix by using the env remove command or all of a project's environments by using the env prune command.
maybe i'm doing something wrong there

ivory eagle
tired ridge
#

i'm not finding a sort of cleanup everytime option however

#

is that planned?

ivory eagle
#

what do you mean by that?

tired ridge
#

i want everything to be built from scratch every time

ivory eagle
#

oh, that is planned

#

there is a feature request

tired ridge
#

final two questions
can i pass pip commands like --upgrade-deps globally? rather than needing python.exe -m pip install --upgrade pip as part of the script
does hatch have a discord?

ivory eagle
#

that is planned but right now you can easily set environment variables to modify behavior

tired ridge
#
[[tool.hatch.envs.main.matrix]]
python = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

nuitka_versions = ["nuitka", "https://github.com/Nuitka/Nuitka/archive/factory.zip"]

[tool.hatch.envs.main]
dependencies = ["{matrix:nuitka_versions}"]
dev-mode = false
skip-install = true

[tool.hatch.envs.main.scripts]
hello = "python -m pip install --upgrade pip && python main.py"

either that or i'm doing something dumb

#

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect:
'C:\Users\NuitkaDevOps\AppData\Local\hatch\env\.metadata\rkHVLIwO\virtual\main.py3.7-https:\github.com\Nuitka\Nuitka\ar
chive\factory.zip.json'
seems like it grabs the arg and sets it as a path on disk

ivory eagle
#

the values of matrix variables should be representable as filesystem names

#
[[tool.hatch.envs.main.matrix]]
python = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
nuitka = ["standard", "dev"]

[tool.hatch.envs.main.overrides]
matrix.nuitka.dependencies = [
  { value = "nuitka", if = ["standard"] },
  { value = "nuitka @ https://github.com/Nuitka/Nuitka/archive/factory.zip", if = ["dev"] },
]
tired ridge
#

thank you that works, is it safe to create a venv from within the hatch matrix enviroment?