Re: Choosable dependency

2021-03-08 Thread Manfred Lotz
On Sun, 7 Mar 2021 20:38:30 -0800 Dan Stromberg wrote: > I sometimes do things like: > > try: > import rtoml as toml > except ImportError: > import toml > Also a possibility. Thanks. > ...but I don't like it very much, because it tends to confuse static > analyzers like pyflakes and p

Re: Choosable dependency

2021-03-08 Thread Thomas Jollans
On 06/03/2021 12:00, Manfred Lotz wrote: Let us say I have a package which reads a TOML file. I want to give the user of my package the choice to decide if he wants to use the toml, tomlkit or rtoml package. So, in case the user chose to use rtoml then there should be an import only for rtoml,

Re: Choosable dependency

2021-03-07 Thread Grant Edwards
On 2021-03-07, Manfred Lotz wrote: > On Sat, 6 Mar 2021 15:40:41 - (UTC) > Grant Edwards wrote: > >> On 2021-03-06, Manfred Lotz wrote: >> > Let us say I have a package which reads a TOML file. >> > >> > I want to give the user of my package the choice to decide if he >> > wants to use the

Re: Choosable dependency

2021-03-07 Thread Dan Stromberg
I sometimes do things like: try: import rtoml as toml except ImportError: import toml ...but I don't like it very much, because it tends to confuse static analyzers like pyflakes and pylint. Maybe mypy will deal with it better? Not sure yet. On Sat, Mar 6, 2021 at 3:05 AM Manfred Lotz

Re: Choosable dependency

2021-03-07 Thread Manfred Lotz
On Sat, 6 Mar 2021 15:40:41 - (UTC) Grant Edwards wrote: > On 2021-03-06, Manfred Lotz wrote: > > Let us say I have a package which reads a TOML file. > > > > I want to give the user of my package the choice to decide if he > > wants to use the toml, tomlkit or rtoml package. > > Why wo

Re: Choosable dependency

2021-03-07 Thread Grant Edwards
On 2021-03-06, Manfred Lotz wrote: > Let us say I have a package which reads a TOML file. > > I want to give the user of my package the choice to decide if he wants > to use the toml, tomlkit or rtoml package. Why would the user choose one over the other? Does the user get different functions/

Re: Choosable dependency

2021-03-06 Thread Manfred Lotz
On Sat, 6 Mar 2021 14:06:27 +0100 Peter Otten <__pete...@web.de> wrote: > On 06/03/2021 12:43, Manfred Lotz wrote: > > On Sat, 6 Mar 2021 12:00:33 +0100 > > Manfred Lotz wrote: > > > >> Let us say I have a package which reads a TOML file. > >> > >> I want to give the user of my package the cho

Re: Choosable dependency

2021-03-06 Thread Peter Otten
On 06/03/2021 12:43, Manfred Lotz wrote: On Sat, 6 Mar 2021 12:00:33 +0100 Manfred Lotz wrote: Let us say I have a package which reads a TOML file. I want to give the user of my package the choice to decide if he wants to use the toml, tomlkit or rtoml package. So, in case the user chose to

Re: Choosable dependency

2021-03-06 Thread Manfred Lotz
On Sat, 6 Mar 2021 12:00:33 +0100 Manfred Lotz wrote: > Let us say I have a package which reads a TOML file. > > I want to give the user of my package the choice to decide if he wants > to use the toml, tomlkit or rtoml package. > > So, in case the user chose to use rtoml then there should be

Choosable dependency

2021-03-06 Thread Manfred Lotz
Let us say I have a package which reads a TOML file. I want to give the user of my package the choice to decide if he wants to use the toml, tomlkit or rtoml package. So, in case the user chose to use rtoml then there should be an import only for rtoml, aso. How could I achieve this? -- Than