Re: Looking for help with packaging RamaLama for Fedora.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2024-09-30 at 12:41 -0400, Daniel Walsh wrote:
> 
> We want to make sure that the ramalama executable finds the python 
> libraries ,which is why we are sticking the library into first place in 
> the path.  (It is a little hacky and we could probably work around it 
> using environment variables rather then inserting it.

OK, so this is kinda fun, actually.

setuptools used to provide pkg_resources.resource_filename which you
could use to get the filesystem location of files within any given
module. But it got a bit weird, because these days in Python, a module
doesn't have to exist as a simple file on the filesystem. It could be
part of some kind of archived distribution (an egg or wheel, for
instance), or imported via zipimport, or something. pkg_resources did
some fairly hairy workarounds for these cases - it would basically dump
the module out to a temporary cache on disk and give you *that*
location, see
https://setuptools.pypa.io/en/latest/pkg_resources.html#resource-extraction
.

That mess is now deprecated and we have `importlib.resources` instead,
which doesn't pretend it can always give you a filesystem location for
stuff, but just gives you a file-like interface. pkg_resources is
entirely removed in recent Python (3.12 or 3.13, I forget which).

So...looked at a certain way, yeah, I suppose you *can* say it makes
sense for ramalama to have a custom install process simply to ensure
the library *is* actually on disk to be mounted into the container. If
we did things the 'proper' way and used importlib.resources , we'd have
to sort of do what pkg_resources used to do: use the importlib
interface to dump the contents of all the files in the library to a
known temporary filesystem location and mount *that* into the
container. (Arguably, that *still* might be better, but eh.)

The overall design still feels a bit weird to me, though. It feels like
there should just be overall a better way to implement "have a Python
project create a container then drive stuff using a Python project
inside the container" than having them both be the *same thing*?
-- 
Adam Williamson (he/him/his)
Fedora QA
Fedora Chat: @adamwill:fedora.im | Mastodon: @adamw@xxxxxxxxxxxxx
https://www.happyassassin.net




-- 
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux