Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197499

Re: Best practice for config files?

From "Michael F. Stemper" <michael.stemper@gmail.com>
Newsgroups comp.lang.python
Subject Re: Best practice for config files?
Date 2025-05-24 10:05 -0500
Organization A noiseless patient Spider
Message-ID <100sn6t$oj7m$3@dont-email.me> (permalink)
References <100nvn0$3kq1t$1@dont-email.me> <config-20250522212305@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 22/05/2025 15.27, Stefan Ram wrote:
> "Michael F. Stemper" <michael.stemper@gmail.com> wrote or quoted:
>> Should I specify the location of the config file with a command-line
>> option, or is requiring the program to be executed in the directory
>> containing the configuration file considered acceptable practice?
> 
>    It was me who digged out this "platformdirs" "user_config_dir"
>    API using a source code search on my harddisk without any help.
>    But then I asked my buddy, the chatbot, to explain how to
>    use it, which I include here, followed by some more words
>    of my own at the end. Chatbot:

[massive snip]

>    On Linux:
> 
> ~/.config/YourAppName

[another one]


Wow, if that's the best practice, I'll settle for second-best!

Somebody who wished to remain anonymous contacted me via email and
suggested that I could have my cake and eat it, too. I am going
ahead with having a default location for the config file, as well
as a command-line option to specify a different file. Blindingly
obvious!

And the default will not be in the directory in which the program
is being run. Your post reminded me of the existence of $HOME/.config
which is obviously the right place for it.

Thanks for all of the suggestions.

-- 
Michael F. Stemper
I refuse to believe that a corporation is a person until Texas executes one.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Best practice for config files? "Michael F. Stemper" <michael.stemper@gmail.com> - 2025-05-22 14:59 -0500
  Re: Best practice for config files? ram@zedat.fu-berlin.de (Stefan Ram) - 2025-05-22 20:27 +0000
    Re: Best practice for config files? ram@zedat.fu-berlin.de (Stefan Ram) - 2025-05-22 20:33 +0000
    Re: Best practice for config files? ram@zedat.fu-berlin.de (Stefan Ram) - 2025-05-23 19:18 +0000
      Re: Best practice for config files? (Posting On Python-List Prohibited) Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-05-23 22:22 +0000
        Re: Best practice for config files? (Posting On Python-List Prohibited) rbowman <bowman@montana.com> - 2025-05-24 03:00 +0000
    Re: Best practice for config files? "Michael F. Stemper" <michael.stemper@gmail.com> - 2025-05-24 10:05 -0500
  Re: Best practice for config files? Paul Rubin <no.email@nospam.invalid> - 2025-05-22 17:37 -0700
    Re: Best practice for config files? (Posting On Python-List Prohibited) Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-05-23 01:20 +0000
  Re: Best practice for config files? Chuck Rhode <CRhode@LacusVeris.com> - 2025-05-23 08:35 -0500
  Re: Best practice for config files? Jason H <jason_hindle@yahoo.com> - 2025-05-24 11:46 +0000

csiph-web