mdmintz / pdbp

pdbp (Pdb+): A drop-in replacement for pdb and pdbpp. To replace "pdb", add "import pdbp" to an "__init__.py" file.
Other
69 stars 2 forks source link

(Minimal) support for XDG base directory #59

Closed Val95240 closed 8 months ago

Val95240 commented 8 months ago

Hi! First, thank you for the Pdb++ upgrade – fixing those bugs is much appreciated, and I like the Sticky mode by default. I've noticed that currently, the pdb config file is hardcoded to "~/.pdbrc.py" here, with the home path specified in the tabcompleter repository.

To avoid creating a new file in the home directory, it would be awesome if Pdb+ could support the XDG Base Directory specification. While a complete XDG implementation seems challenging due to the hardcoded home path in tabcompleter, tweaking the code in Pdb+ appears less critical and could be a solid initial step.

The modification involves updating the config_filename definition, for example, like this: config_filename = ( ".config/pdbp/pdbrc.py" if os.path.exists(os.path.join(os.path.expanduser("~"), ".config/pdbp/pdbrc.py")) else ".pdbrc.py" ) Theoretically, checking the "XDG_CONFIG_HOME" environment variable might be better, but this could complicate matters by requiring modifications in tabcompleter and dealing with potential backward compatibility issues. On the other hand, the suggested change in Pdb+ is minimal and transparent for users.

What are your thoughts on this modification? Does it seem sensible?

Thanks!

mdmintz commented 8 months ago

Hello! Those are based on: https://github.com/pdbpp/pdbpp/blob/e1c2e347cc55a6dd89e058e56a1366ada68884bc/src/pdbpp.py#L347 AND https://github.com/pdbpp/fancycompleter/blob/67e3ec128cf8d44be6e48e775234c07f4b23064e/fancycompleter.py#L196 I can't change those without breaking backwards compatibility.

pdbp and tabcompleter are fixes over pdbpp and fancycompleter that still match their existing format. Unless there's a real bug preventing their normal use on Linux, macOS, or Windows, I'm inclined to keep pdbp and tabcompleter as they are so that users don't experience any unexpected behavior or surprises.

Val95240 commented 8 months ago

Yes I saw the original files, but I was hoping this modification was small enough to justify diverging a bit from the original repositories. I understand your point though, it's really not critical. Thanks anyway !