saved-models / data-utilities

SAVED project - data processing tools for fish farms
4 stars 0 forks source link

fix #6 #7

Closed TrondurT closed 8 months ago

TrondurT commented 8 months ago

fix #6

I have changed README.md file to use pip to install the package.

I have moved the submodule, so that is comes along in the install updated the refrenses to the submodule in the relevent places.

druimalban commented 8 months ago

Thanks, you're right about the README instructions - I couldn't get that to work either.

I have taken your modifications (move data-model -> fisdat/data-model &c) and used importlib to import the file. This seems to work regardless of current working directory.

The examples still use absolute paths, I will update these…

Could you see if this modification works for you?

druimalban commented 8 months ago

For the examples, when we are able to host the data model somewhere externally, we can avoid using an absolute path to the data model.

TrondurT commented 8 months ago

tree of the installed dir

.
├── cmd_dat.py
├── cmd_up.py
├── data_model
│   ├── __init__.py
│   └── __pycache__
│       └── __init__.cpython-310.pyc
├── __init__.py
├── kludge.py
├── ns.py
├── __pycache__
│   ├── cmd_dat.cpython-310.pyc
│   ├── cmd_up.cpython-310.pyc
│   ├── __init__.cpython-310.pyc
│   ├── kludge.cpython-310.pyc
│   ├── ns.cpython-310.pyc
│   └── utils.cpython-310.pyc
└── utils.py

yaml and shell files are not comming along :(

druimalban commented 8 months ago

You could try removing the fisdat/data_model directory and then git checkout -- fisdat/data_model?

Perhaps also there is an interaction with the virtual environment, I had to remove mine and follow the steps in the readme file to reproduce your problem.

TrondurT commented 8 months ago

where are you running the script from???

druimalban commented 8 months ago

The workflow I have is to source the virtualenv activation script, then I run python setup.py develop and it usually picks up changes immediately.

I had a similar result with python setup.py install albeit it was annoying when making many changes as I kept having to run it.

I tested running fisdat, fisup in /tmp and in the examples/sentinel_cages directory of the repository check-out.

When working with your changes, I worked in a fresh checkout of the repository and used the gh CLI tool to fetch yours.

The interaction of the virtual environment with setup.py interaction is quite opaque to me.

TrondurT commented 8 months ago

I see

stackoverflow

so you are using the files that are in the git reposotory and not installing the package into site-packages. And therefore the yaml files are relative to the script files.

wwaites commented 8 months ago

The secret to not being annoyed is to run python setup.py develop. This installs the module to python's site-packages as symlinks with some metadata to your checked out tree. Using install copies the module which is why you have to keep re-running it.

wwaites commented 8 months ago

Similar can be accomplished with python -m pip install -e .