phaseworm icon indicating copy to clipboard operation
phaseworm copied to clipboard

Use more standard package structure, protect vendored phasenet package

Open claudiodsf opened this issue 2 years ago • 0 comments

Hi Jean-Marie,

I just saw your recent PR #12. I think it introduces two problems:

  1. The directory name phaseworm_sources does not respect the general recommendation, which is to name this directory like the package (i.e. phaseworm).

In its current form, when one does pip install ., she will get the following directories in the site-packages directory:

➜  ~ conda activate phaseworm
(phaseworm) ➜  ~ ls -lrt $CONDA_PREFIX/lib/python*/site-packages
...
drwxr-xr-x  13 claudio staff    416 Apr 12 09:06 phasenet
drwxr-xr-x   9 claudio staff    288 Apr 12 09:06 phaseworm_sources
drwxr-xr-x  11 claudio staff    352 Apr 12 09:06 phaseworm-1.1.dist-info

It would be better, in my opinion (and for coherency with other installed packages in site-packages) to drop the suffix _sources.

  1. The above directory listing also illustrates the second problem: phaseworm distributes its own specific version of phasenet (this is technically called "vendoring"). Currently, phasenet is installed as a top-level package, meaning that a pip install phasenet will overwrite the version shipped with phaseworm, with the possibility of generating weird bugs. To protect this specific version, it should go inside the phaseworm directory.

So, my proposed directory structure is:

phaseworm
├── CITATION.cff
├── CONTRIBUTORS.txt
├── LICENSE.txt
├── MANIFEST.in
├── README.md
├── doc
│   └── flow-chart.png
├── examples
│   ├── config.cfg
│   ├── config_replay.cfg
│   └── config_rt.cfg
├── phaseworm
│   ├── __init__.py
│   ├── get_data.py
│   ├── hinv_station_rw.py
│   ├── phasenet
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── app.py
│   │   ├── data_reader.py
│   │   ├── detect_peaks.py
│   │   ├── model
│   │   │   └── 190703-214543
│   │   │       ├── checkpoint
│   │   │       ├── config.log
│   │   │       ├── loss.log
│   │   │       ├── model_95.ckpt.data-00000-of-00001
│   │   │       ├── model_95.ckpt.index
│   │   │       └── model_95.ckpt.meta
│   │   ├── model.py
│   │   ├── requirements.txt
│   │   ├── run.py
│   │   ├── test_app.py
│   │   └── util.py
│   ├── phaseworm.py
│   ├── read_config.py
│   └── stationxml2hinv.py
└── setup.py

claudiodsf avatar Apr 12 '23 07:04 claudiodsf