Python Forum
Announcing the configoose module!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Announcing the configoose module!
#3
(Jun-29-2024, 06:20 AM)snippsat Wrote: So it goes out of venv and try find path to Python(i have never used .....Roaming\\Python\\Python312\\site-packages) as path.
The problem is I don't know exactly how user site-packages directory is handled in the case of virtual envs. What you could do in the meantime is to pass the option --dest /path/to/your/venv/site-packages to this command line.

Alternatively you can try the --global option. I think it should install a configooseglobalconf.py in your virtual environment's site-packages directory.

I'll try to find a solution that works in all cases, but really I'm not knowlegeable concerning virtual environments.

EDIT:
I tried with pyenv in Linux and the --global option worked
Output:
python -m configoose conf --global --marina ~/tmp
>>> import configooseglobalconf
>>> configooseglobalconf
<module 'configooseglobalconf' from '/home/eric/.pyenv/versions/3.12.4/lib/python3.12/site-packages/configooseglobalconf.py'>
>>> 
With this setup, I can moor a configuration file in the 'initialglobal' marina instead of 'initial'
Output:
python -m configoose moor initialglobal paillasse/tmp/french.cfg
EDIT 2
I tried again with the --global option in a pyenv virtualenv and it worked also
Output:
(somevirtualenv) λ python -m configoose conf --global --marina ~/tmp
(somevirtualenv) λ python
Python 3.12.4 (main, Jun 29 2024, 11:19:46) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import configooseglobalconf
>>> configooseglobalconf
<module 'configooseglobalconf' from '/home/eric/.pyenv/versions/somevirtualenv/lib/python3.12/site-packages/configooseglobalconf.py'>
>>> 
Output:
(somevirtualenv) λ python -m configoose moor initialglobal paillasse/tmp/french.cfg (somevirtualenv) λ (somevirtualenv) λ python -m configoose find s8dzw5y5anduiodmrdrxdgxaa FileInOsMediator(PosixPath('/home/eric/Projets/Scratch/2023-01/paillasse/tmp/french.cfg'))
EDIT 3:
If you don't like the word 'initialglobal', you can still edit the file configooseglobalconf.py and add tags to your first marina, for example
{
    "address": "configooseglobalconf-address",
    'protopath': "configoose.protocol.methodic.Protocol",
}
__doc__ = """configooseglobalconf.py

This is configoose's root database configuration module.
The basic configuration is to add marinas, usually OS directories,
where configuration mediators can be stored.
"""

def configure(handler):
    handler.add_marina(
        path='/home/eric/tmp',
        style="os-directory",
        tags={'initialglobal', 'bönhamn'},
    )
Now you can moor your configuration file in the Bönhamn marina
Output:
(somevirtualenv) λ python -m configoose moor bönhamn paillasse/tmp/french.cfg
« We can solve any problem by introducing an extra level of indirection »
Reply


Messages In This Thread
Announcing the configoose module! - by Gribouillis - Jun-27-2024, 09:10 PM
RE: Announcing the configoose module! - by snippsat - Jun-29-2024, 06:20 AM
RE: Announcing the configoose module! - by Gribouillis - Jun-29-2024, 10:36 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020