InseeFrLab / InseeFrLab/pynsee
Avoid strange name shadowing and simplify structure
- Dominant language
- Python
- Stars
- 89
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
At the moment, ``pynsee`` is written with one file per class or function, with the files having the same name.
This seem to lead to name shadowing upon import (cf. #173) [1] and makes imports extremely cumbersome.
In my opinion, there is no good reason to have one file per function (especially not with the same name) as any good IDE will automatically locate definitions (even GitHub's web UI does this).
A simple way to do this with minimal changes would be to remove duplicate functions (no need to have [``get_geodata``](https://github.com/InseeFrLab/pynsee/blob/master/pynsee/geodata/get_geodata.py#L8C5-L8C16) calling [``_get_geodata``](https://github.com/InseeFrLab/pynsee/blob/master/pynsee/geodata/_get_geodata.py#L29)). So we can just keep ``_get_geodata.py`` which would contain ``get_geodata`` removing both one file, one function call, and the weird name shadowing issue.
For classes, we should follow the python convention and keep class files lowercase.
**EDIT**: we started doing this, this will continue progressively when time permits. Fixed classes and functions include:
- [x] ``GeoFrDataFrame``, ``transform_overseas`` and ``zoom`` from ``geodata``
- [x] ``SireneDataFrame`` from ``sirene``
- [x] ``init_conn`` from ``utils``
- [x] ``pynsee/macrodata`` (for dimensions, idbanks, and metdata) in #257
---
[1]: though this is not supposed to happen (declared variables are supposed to have precedence over modules) so I'm not really sure why this led to bugs in the CI
Contributor guide
Assessment
This issue has not been assessed yet.