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

How to sync / apply script updates in pyproject.toml ? #2

Open
floschne opened this issue Mar 7, 2024 · 3 comments
Open

How to sync / apply script updates in pyproject.toml ? #2

floschne opened this issue Mar 7, 2024 · 3 comments
Labels
wontfix This will not be worked on

Comments

@floschne
Copy link

floschne commented Mar 7, 2024

  • Date you used The Hatchlor: 07 March 2024
  • Cookiecutter version used, if any: N/A
  • Python version, if any: 3.10
  • Operating System: UNIX

Hi @FlorianWilhelm and first of all thanks for this amazing project template!

Maybe I missed it in the docs but I'm facing issues when I update script entries in pyproject.toml
E.g. let's say I have the following entry and a fresh hatch project (i.e., never ran hatch run ... or hatch env create)

[project.scripts]
fibonacci = "autorag.fibonacci:app"

When I run hatch env create && hatch run fibonacci 10 it correctly executes the script.

Now I want to change ,e.g., the name of the script:

[project.scripts]
print_fibonacci = "autorag.fibonacci:app"

When I run hatch env create && hatch run print_fibonacci 10 it prints /bin/sh: print_fibonacci: command not found. Also, when I look into the venv bin dir, I can see the old fibonacci but not the new print_fibonacci.

The only way I found to update and sync the env is to completely remove my venv dir and create the env from scratch.

Is this behaviour on purpose or did I miss something here?

@FlorianWilhelm
Copy link
Owner

Hi @floschne, thanks for reporting this and nice to hear that you like my template 😊

I can confirm that this behaviour exists and bothers me too. Every update in the project‘s metadata will only be reflected after a new installation within the environment and this is not noticed by Hatch. On the other hand, if every change would trigger a reinstallation, the dynamic versioning would cause this after each commit, but then again it‘s quite fast to do a development installation.

What does @ofek, the author of hatch, think about this? Would this be a nice optional feature for hatch? So that changes within the project‘s metadata trigger a reinstallation of the project within the environments?

@floschne
Copy link
Author

floschne commented Mar 9, 2024

I actually also asked this in the official hatch repo and he answered that this is indeed the correct behavior of hatch :)

pypa/hatch#1301 (comment)

I'm not too deep in the tech behind hatch but from my understanding it should generally be possible to only re-build/re-generate the scripts w/o the need of re-building the whole venv.

Anyways, I think for now there is nothing to do about it :)

@ofek
Copy link

ofek commented Mar 9, 2024

I will fix it but it's not high priority for me at the moment.

@FlorianWilhelm FlorianWilhelm added the wontfix This will not be worked on label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants