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

Custom develop command to link data files in setup.py #255

Closed
jtpio opened this issue Jun 18, 2019 · 11 comments
Closed

Custom develop command to link data files in setup.py #255

jtpio opened this issue Jun 18, 2019 · 11 comments

Comments

@jtpio
Copy link
Member

jtpio commented Jun 18, 2019

We can add a custom develop command to the setup.py to automatically link data files, as mentioned in #253 (comment).

This would help with the development workflow and make the process more automated.

@vidartf
Copy link
Contributor

vidartf commented Jun 18, 2019

Please note that the solution linked will break the -e install command on Windows due to CPython's poor symlink support on Windows. At the very least, please put the symlink call in a try/except clause :)

@jtpio
Copy link
Member Author

jtpio commented Jun 18, 2019

Ah good to know :)

Maybe there is a better way to do it so it's more robust on Windows?

@vidartf
Copy link
Contributor

vidartf commented Jun 24, 2019

I have one PR on Windows symlink support for CPython that was merged, and one that is still open. If you put the symlink call in a try/except clause, with the current behavior as fallback, that is likely the best way. Then, the symlinking should just work once CPython gets better support.

@maartenbreddels
Copy link
Member

Could you link to the PR @vidartf ?
Will this be backported to Python3.6/3.7?

@vidartf
Copy link
Contributor

vidartf commented Jul 24, 2019

Will this be backported to Python3.6/3.7

No, I cannot believe it will (unless I have misunderstood how CPython works). I don't think it will be backported to 3.8 either, and given the speed things are going, I doubt it will be in for 3.9...

@vidartf
Copy link
Contributor

vidartf commented Jul 24, 2019

Either way, it won't work on all Windows machines, so the try/except clause would still be needed no matter what.

@maartenbreddels
Copy link
Member

What should we do instead, give a warning saying you should run it in admin mode? And if not possible (user cannot have admin right), what should a user do, just do a normal pip install .?

@vidartf
Copy link
Contributor

vidartf commented Jul 24, 2019

You could just make a helper script (possibly an entry point) that does the copy for you, and ask the user to run that when the datafiles change.

@maartenbreddels
Copy link
Member

Why not rerun pip install .? Would that be too slow?

@vidartf
Copy link
Contributor

vidartf commented Jul 24, 2019

Sure, you could tell the user to:

  • Either configure the symlinks themselves outside of Python (maybe list dirs that need to be linked).
  • Or run pip install . for every change to the datafiles (preferably specifying what will trigger a change of theses)

@jtpio
Copy link
Member Author

jtpio commented Jun 21, 2023

Closing as this was implemented as a hatch plugin in #1197.

@jtpio jtpio closed this as completed Jun 21, 2023
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

3 participants