Giter Club home page Giter Club logo

Comments (12)

ofek avatar ofek commented on June 7, 2024 1

Try removing the configuration? This is the logic that happens

@cached_property
def parent_python(self):
if python_choice := self.config.get('python', ''):
return self._get_concrete_interpreter_path(python_choice)
if explicit_default := os.environ.get(AppEnvVars.PYTHON):
return sys.executable if explicit_default == 'self' else explicit_default
return self._get_concrete_interpreter_path()

from hatch.

ofek avatar ofek commented on June 7, 2024 1

Oh, I see what you're saying. The Pythons that you've been managing with the CLI I'm assuming you have not been using the flag to add that to PATH. If you do that then it should pick that up because then it counts as "external". If you don't, then you can actually modify the python-sources option: https://hatch.pypa.io/latest/plugins/environment/virtual/#options

from hatch.

kjy5 avatar kjy5 commented on June 7, 2024 1

Adding Hatch's Python to the PATH allowed the environment to find the correct install. I'm not sure why the original command did not do it, but it appears to be working now. Thanks for your help!

from hatch.

ofek avatar ofek commented on June 7, 2024 1

Happy to help and sorry for the issues! Documentation is improving albeit slowly 🙂

from hatch.

ofek avatar ofek commented on June 7, 2024

https://hatch.pypa.io/latest/plugins/environment/virtual/#python-resolution

from hatch.

kjy5 avatar kjy5 commented on June 7, 2024

Right, maybe I'm not understanding the philosophy properly, but this seems to say that the python option overrides HATCH_PYTHON which makes sense except the python option installs a new copy of the distribution in the hatch/env/virtual/.pythons/... directory rather than use the existing install of that distribution that was installed by Hatch in hatch/pythons/...

My HATCH_PYTHON env variable points to hatch/pythons/.... What I am suggesting is that Hatch should recognize that it has already installed a version of python in hatch/pythons/... and use that rather than reinstall under hatch/env/virtual/.pythons/.... Is that a valid suggestion?

from hatch.

kjy5 avatar kjy5 commented on June 7, 2024

I suppose this works for local setups, but not for CI/CD tools where that python config is there to inform the instance of Hatch on the runner. Thanks for pointing out the code logic though. Perhaps a rule or a configuration can be added to use the Hatch-installed versions of Python.

from hatch.

kjy5 avatar kjy5 commented on June 7, 2024

Interesting... so if the installed Python was in my path it would've used that? I noticed the install command seems to have failed to add Python to my path even though I did not use the --private flag.

from hatch.

ofek avatar ofek commented on June 7, 2024

Oh I forgot that it adds by default. Which shell are you using?

from hatch.

kjy5 avatar kjy5 commented on June 7, 2024

Both Powershell and ZSH? I use both.

from hatch.

ofek avatar ofek commented on June 7, 2024

from hatch.

kjy5 avatar kjy5 commented on June 7, 2024

So if it didn't work on the first pass is the solution to just add it to my path after the fact?

from hatch.

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.