A 3D statistical reconstruction model of grapevine (Vitis vinifera L.) that simulates canopy structure accounting for (cultivar)-(training system) pairs.
- For end-users: Installation | Usage
- For contributors: Development Setup | Contributing
- Python 3.8+
- Conda (Miniconda or Anaconda)
git clone git@github.com:openalea-incubator/topvine.git
cd topvine
conda env create -f conda/conda-lock.yml
conda activate topvineOr, with a custom environment name:
conda install --name myenv --file conda/conda-lock.yml
conda activate myenvpython -c "import topvine; print(topvine.__version__)"See the examples/ directory for usage examples.
The following tools must be installed and available in your shell before using the Makefile. Ensure that these prerequisites are installed in the base conda environment.
Install Miniconda or Anaconda.
Verify:
conda --versionconda install -c conda-forge conda-lockVerify:
conda-lock --versionLinux:
make --version # Check if installedIf not installed:
sudo apt install make # Debian/Ubuntu
sudo dnf install make # RHEL/FedoramacOS: Usually pre-installed. If not:
brew install makeWindows (PowerShell, run as administrator):
winget install GnuWin32.MakeThen add GnuWin32 to the system PATH (run as administrator):
[Environment]::SetEnvironmentVariable(
"Path",
$env:Path + ";C:\Program Files (x86)\GnuWin32\bin",
"Machine"
)Restart your terminal and verify:
make --versionDependencies are defined in a single source of truth: pyproject.toml
The workflow is:
- Edit
pyproject.tomlwith your changes - Run
make updateto regenerate lock files and recreate the environment - Commit the updated
conda/conda-lock.ymlto the repository
Key files:
project-root/
├── Makefile ← entry point for all environment commands
├── pyproject.toml ← single source of truth for all dependencies
├── scripts/
│ └── generate_env_specs.py ← generates environment.yaml from pyproject.toml
└── conda/
├── meta.yaml ← conda-build recipe
├── environment.yaml ← generated (do not edit)
└── conda-lock.yml ← generated (committed to repo for reproducibility)
conda/environment.yaml and conda/conda-lock.yml are generated artifacts. Always edit pyproject.toml and regenerate them using make update.
| What | Where |
|---|---|
| Runtime pip-installable deps | [project.dependencies] in pyproject.toml |
| Conda-only runtime deps | [tool.conda.environment.dependencies] in pyproject.toml |
| Dev/contributor deps | [project.optional-dependencies.dev] in pyproject.toml |
| Conda channels | hardcoded in scripts/generate_envs.py |
| Conda-build recipe | conda/meta.yaml |
| Target | Description |
|---|---|
make or make help |
Show available targets |
make generate |
Generate conda/environment.yaml from pyproject.toml |
make lock |
Generate conda/conda-lock.yml from conda/environment.yaml |
make env |
Create the dev conda environment from the lock file |
make update |
Regenerate env + relock + recreate dev environment (all-in-one) |
make clean |
Remove generated environment file and lock file |
By default, the environment is named openalea-topvine. Override at call time:
make env name=myenvClone the repository and run from inside the project directory:
make envThis single command:
- Reads
pyproject.tomland generatesconda/environment.yaml - Runs
conda-lockto resolve and lock all dependencies forwin-64andlinux-64 - Creates a conda environment from the lock file
Then activate the environment:
conda activate openalea-topvineWhenever you add, remove, or update a dependency in pyproject.toml, run:
make updateThis regenerates the environment, relocks, and recreates the conda environment in one step.
Always commit the updated conda/conda-lock.yml so other contributors get the exact same dependency resolution.
To remove all generated files and start fresh:
make clean
make envRun the test suite:
python -m unittest discover -s test -p "*.py"Or with coverage:
# Add coverage command here when availableContributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Make your changes and add tests
- Run the test suite to ensure nothing breaks
- Commit with clear messages
- Push to your fork and open a pull request
Ensure you've run make env in the project root and activated the environment:
conda activate openalea-topvineInstall it in your base environment:
conda install -c conda-forge conda-lockIf conda/conda-lock.yml was updated, regenerate your environment:
make updateRun PowerShell as administrator before executing the PATH update command.
If you use topvine in your research, please cite:
Gaëtan Louarn, Jérémie Lecoeur, Eric Lebon, "A Three-dimensional Statistical Reconstruction Model of Grapevine (Vitis vinifera) Simulating Canopy Structure Variability within and between Cultivar/Training System Pairs," Annals of Botany, Volume 101, Issue 8, May 2008, Pages 1167–1184. https://doi.org/10.1093/aob/mcm170
CECILL-C
Gaetan LOUARN (gaetan.louarn@inrae.fr) Rami ALBASHA (rami.albasha@inrae.fr) Stathis DELIVORIAS (stathissupagro@gmx.com)