-
Notifications
You must be signed in to change notification settings - Fork 4
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
What's the best way to override the index download directory? #32
Comments
Hi Brian, If you set the environment variable The other option is to download the indexes and directly reference them using paths supplied to |
Hi Bede, Thanks for the response. My first thought was to maybe set via os.environ (or export . . . before running). I can play with it in a conda env, and report back. |
Ah, you're using the Python API, nice. In that case I would suggest setting the environment variable in Python: import os
os.environ["XDG_DATA_HOME"] = "/data" If for some reason this doesn't work, I can implement a direct override using e.g. a function argument. |
Heh. That was my first thought (and what I meant, by "override the XDG_DATA_DIR"), but I seemed to talk myself out of it, thinking that was unnecessarily going out into the calling environment, only to allow loading back in. But maybe that ends up being identical (as part of any memory the Python instance already has loaded). At least it should be simple. |
I know where you're coming from! Environment variables are not especially pretty. If for some reason this doesn't work properly, let me know and we can sort it. |
In the next release, the Right Way to do with will be to use the new |
Nice! Thanks! |
BTW, I think os.environ is just a dictionary. So, I think, you should just be able to just use the second argument of |
It doesn't look like setting . . . os.environ['XDG_DATA_HOME']=. . . . . . works for the Python API, for me. My script reports the correct (overridden) value of . . . f"os.environ['XDG_DATA_HOME']=}" . . . but . . . Anyway, just thought I'd follow-up and let you know that. Thanks. |
Thank you for this and sorry for delay, I've been travelling this week.
Which OS and Python version are you using? I'll look into it.
…On Thu, 14 Mar 2024 at 20:22, Brian Klahn ***@***.***> wrote:
It doesn't look like setting . . .
os.environ['XDG_DATA_HOME']=. . .
. . . works for the Python API, for me.
My script reports the correct (overridden) value of . . .
f"os.environ['XDG_DATA_HOME']=}"
. . . but . . .
15:18:25 INFO: Saved human index (~/.local/share/hostile/human-t2t-hla)
Anyway, just thought I'd follow-up and let you know that.
Thanks.
—
Reply to this email directly, view it on GitHub
<#32 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHWAABIEHB5HWIDBREI5FLYYIBIZAVCNFSM6AAAAABEF6IJUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJYGM4DMMBQGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
No worries. I've been traveling some, lately, as well. GNU/Linux with Python 3.10 |
Hi Brian, If it's possible for you to follow the instructions in the readme to create a development build with the latest changes, I would be very interested to know if things are working for you. Nevertheless I will probably create a new release soon. |
This change has been released in |
I'll just try it out after our service container is updated to the new package. Also, I don't think its necessary/appropriate to transfer the minor version, when bumping the major. Also, I don't know if you knew a Python dict get method has a default parameter. No need to implement if else logic manually. Thanks for the package update! |
You are mistaken – I neither bumped the major version nor 'transferred' the minor version in this release.
Yes, and Hostile relies on it in places, feel free to submit a PR if you can simplify it without failing tests.
A pleasure! Feel free to reopen etc. if the problem persists. |
I guess I must be. For some reason I had the version pinned to 0.1.0 in our environment.yml file (which I thought you had bumped to 1.1.0). Maybe typo on my part, or I had come across that on an old conda web page. |
No problem. Sometimes conda solvers install an ancient package version in trying to satisfy pinned dependency versions, so perhaps something along these lines happened. Do let me know if you spot this happening again. |
I'm working on integrating this into a service.
If I want to cache the index files to a non-user-specific shared location (e.g.), would the best way to do that be to maybe override the XDG_DATA_DIR?
hostile/src/hostile/util.py
Line 32 in 82b3a5d
I was tracing through the code, and it looks like this isn't exposed as a parameter, like the output dir is.
But am I missing something?
Thanks!
The text was updated successfully, but these errors were encountered: