Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tttrlib #51927

Merged
merged 20 commits into from
Nov 13, 2024
Merged

Add tttrlib #51927

merged 20 commits into from
Nov 13, 2024

Conversation

tpeulen
Copy link
Contributor

@tpeulen tpeulen commented Nov 5, 2024

Please add tttrlib to bioconda.

tttrlib is a library to read and process time-resolved photon counting data widely used
in fluorescence spectroscopy and microscopy.


Please read the guidelines for Bioconda recipes before opening a pull request (PR).

General instructions

  • If this PR adds or updates a recipe, use "Add" or "Update" appropriately as the first word in its title.
  • New recipes not directly relevant to the biological sciences need to be submitted to the conda-forge channel instead of Bioconda.
  • PRs require reviews prior to being merged. Once your PR is passing tests and ready to be merged, please issue the @BiocondaBot please add label command.
  • Please post questions on Gitter or ping @bioconda/core in a comment.

Instructions for avoiding API, ABI, and CLI breakage issues

Conda is able to record and lock (a.k.a. pin) dependency versions used at build time of other recipes.
This way, one can avoid that expectations of a downstream recipe with regards to API, ABI, or CLI are violated by later changes in the recipe.
If not already present in the meta.yaml, make sure to specify run_exports (see here for the rationale and comprehensive explanation).
Add a run_exports section like this:

build:
  run_exports:
    - ...

with ... being one of:

Case run_exports statement
semantic versioning {{ pin_subpackage("myrecipe", max_pin="x") }}
semantic versioning (0.x.x) {{ pin_subpackage("myrecipe", max_pin="x.x") }}
known breakage in minor versions {{ pin_subpackage("myrecipe", max_pin="x.x") }} (in such a case, please add a note that shortly mentions your evidence for that)
known breakage in patch versions {{ pin_subpackage("myrecipe", max_pin="x.x.x") }} (in such a case, please add a note that shortly mentions your evidence for that)
calendar versioning {{ pin_subpackage("myrecipe", max_pin=None) }}

while replacing "myrecipe" with either name if a name|lower variable is defined in your recipe or with the lowercase name of the package in quotes.

Bot commands for PR management

Please use the following BiocondaBot commands:

Everyone has access to the following BiocondaBot commands, which can be given in a comment:

@BiocondaBot please update Merge the master branch into a PR.
@BiocondaBot please add label Add the please review & merge label.
@BiocondaBot please fetch artifacts Post links to CI-built packages/containers.
You can use this to test packages locally.

Note that the @BiocondaBot please merge command is now depreciated. Please just squash and merge instead.

Also, the bot watches for comments from non-members that include @bioconda/<team> and will automatically re-post them to notify the addressed <team>.

Copy link
Contributor

coderabbitai bot commented Nov 5, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request introduces significant updates to the tttrlib project by adding a build.sh script and a meta.yaml file. The build.sh script establishes a build process using CMake and Ninja, which includes creating a build directory, modifying compiler flags based on the target platform, and executing the CMake command with various parameters. It also incorporates error handling for specific platforms and adjusts permissions for built programs. The meta.yaml file provides comprehensive metadata for the tttrlib package, including its version, source information, build requirements, and runtime dependencies. It categorizes requirements into build, host, and run sections, and outlines test commands to verify the package's functionality. Additionally, the file includes information about the package's homepage, summary, license, and maintainers.

Possibly related PRs

  • Update tbtamr dependencies #51140: The changes in the meta.yaml file for the mutamr package include updates to build requirements and dependencies, which may relate to the build process established in the build.sh script of the main PR.
  • add meta #51349: The introduction of a new build.sh script for the meta package involves setting up a build environment with CMake, similar to the build process described in the main PR's build.sh.
  • Add libgff recipe #51706: The build.sh script for the libgff package also utilizes CMake for building, which aligns with the build process changes in the main PR.
  • Rebuild libgff recipe #51746: The rebuild of the libgff recipe includes updates to the meta.yaml file, which may relate to the overall build and dependency management discussed in the main PR.
  • Update meta-neuro version 1.0.0 #51826: The updates to the meta-neuro package's meta.yaml and build process may share similarities with the changes made in the main PR regarding build configurations.
  • Add amplici package in bioconda #51847: The build.sh script for the amplici package includes CMake configurations, which are relevant to the build process established in the main PR.
  • Add ntStat #51897: The ntstat package's build process using Meson may not directly relate to CMake but shares the theme of establishing a build environment, which is a focus of the main PR.
  • Add r-remapenrich to bioconda-recipes #51969: The build.sh script for the r-remapenrich package involves R package building, which, while different, still aligns with the overall theme of package management and build processes in the main PR.
  • 24.11.12: Adding teloscope yml/sh #52072: The build.sh script for the teloscope package also sets up a build environment, which is a commonality with the main PR's focus on build processes.

Suggested labels

please review & merge


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Outside diff range and nitpick comments (3)
recipes/tttrlib/app_wrapper.c (3)

24-28: Check for malloc failure in get_new_full_path function

The malloc call may return NULL if memory allocation fails, which can lead to undefined behavior or a crash. It's good practice to check the result of malloc before using the allocated memory.

Apply this diff to add error handling:

 char *newpath = malloc(strlen(topdir) + strlen(fname) + 2);
+if (newpath == NULL) {
+    fprintf(stderr, "Memory allocation failed in get_new_full_path\n");
+    exit(1);
+}
 strcpy(newpath, topdir);

79-88: Check for malloc failure in make_python_parameters function

The malloc call may fail, leading to a NULL pointer dereference when using strcpy and strcat. It's important to check if param is NULL before proceeding.

Apply this diff to add error handling:

 char *param = malloc(strlen(orig_param) + strlen(binary) + 4);
+if (param == NULL) {
+    fprintf(stderr, "Memory allocation failed in make_python_parameters\n");
+    exit(1);
+}
 strcpy(param, "\"");

161-170: Remove unused variable is_python

The variable is_python is declared but never used in the main function. Removing it will clean up the code.

Apply this diff to remove the unused variable:

-int is_python;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7b8ba75 and 828daf7.

📒 Files selected for processing (4)
  • recipes/tttrlib/LICENSE.txt (1 hunks)
  • recipes/tttrlib/app_wrapper.c (1 hunks)
  • recipes/tttrlib/build.sh (1 hunks)
  • recipes/tttrlib/meta.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • recipes/tttrlib/LICENSE.txt
🧰 Additional context used
🪛 Shellcheck
recipes/tttrlib/build.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


[warning] 1-1: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 3-3: target_platform is referenced but not assigned.

(SC2154)


[warning] 16-16: Quote this to prevent word splitting.

(SC2046)


[warning] 25-25: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🪛 yamllint
recipes/tttrlib/meta.yaml

[error] 55-55: trailing spaces

(trailing-spaces)

🔇 Additional comments (2)
recipes/tttrlib/build.sh (2)

19-22: LGTM! Well-implemented fallback mechanism.

The build fallback strategy with clear documentation is a good approach for handling memory-constrained environments.


3-6: Verify target_platform environment variable.

While the platform-specific handling is correct, we should ensure the environment variable is properly set.

✅ Verification successful

target_platform variable usage is valid and common in conda-forge recipes

The verification shows that target_platform is widely used across many build scripts in the repository (found in over 70 recipe build scripts), confirming this is a standard conda-forge build variable. The platform-specific handling in the tttrlib recipe follows this common pattern.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if target_platform is set by conda-build
# Expected: Should find references to target_platform in conda-build configs

# Test: Search for target_platform in conda-build configuration
rg -l "target_platform" "${CONDA_PREFIX}/conda-bld/src_cache/"

Length of output: 107


Script:

#!/bin/bash
# Let's verify if target_platform is used in other conda-forge recipes
# and check conda-forge documentation references

# Search for target_platform usage in recipe files
fd "meta.yaml|build.sh" | xargs rg "target_platform" -l

# Check if there's any conda-forge documentation in the repository
fd "README|CONTRIBUTING" -e md | xargs rg "conda-forge|target_platform" -A 2 -B 2

Length of output: 2276

🧰 Tools
🪛 Shellcheck

[warning] 3-3: target_platform is referenced but not assigned.

(SC2154)

Comment on lines +1 to +2
mkdir b2 && cd b2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add shebang and improve directory handling robustness.

The script should handle potential failures in directory operations and be more explicit about the shell interpreter.

+#!/bin/bash
+set -euo pipefail
+
-mkdir b2 && cd b2
+build_dir="build"
+mkdir -p "${build_dir}" || exit 1
+cd "${build_dir}" || exit 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mkdir b2 && cd b2
#!/bin/bash
set -euo pipefail
build_dir="build"
mkdir -p "${build_dir}" || exit 1
cd "${build_dir}" || exit 1
🧰 Tools
🪛 Shellcheck

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


[warning] 1-1: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

Comment on lines 8 to 17
cmake \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DCMAKE_PREFIX_PATH="$PREFIX" \
-DBUILD_PYTHON_INTERFACE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$SP_DIR" \
-DCMAKE_SWIG_OUTDIR="$SP_DIR" \
-DBUILD_LIBRARY=ON \
-DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\
-G Ninja ..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fix Python version extraction and review CMake options.

  1. The Python version command should be quoted to prevent word splitting.
  2. Consider if BUILD_LIBRARY is necessary when BUILD_PYTHON_INTERFACE is enabled.
 cmake \
  -DCMAKE_INSTALL_PREFIX="$PREFIX" \
  -DCMAKE_PREFIX_PATH="$PREFIX" \
  -DBUILD_PYTHON_INTERFACE=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$SP_DIR" \
  -DCMAKE_SWIG_OUTDIR="$SP_DIR" \
- -DBUILD_LIBRARY=ON \
- -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\
+ -DPYTHON_VERSION="$(python -c 'import platform; print(platform.python_version())')" \
  -G Ninja ..
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cmake \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DCMAKE_PREFIX_PATH="$PREFIX" \
-DBUILD_PYTHON_INTERFACE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$SP_DIR" \
-DCMAKE_SWIG_OUTDIR="$SP_DIR" \
-DBUILD_LIBRARY=ON \
-DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\
-G Ninja ..
cmake \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DCMAKE_PREFIX_PATH="$PREFIX" \
-DBUILD_PYTHON_INTERFACE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$SP_DIR" \
-DCMAKE_SWIG_OUTDIR="$SP_DIR" \
-DPYTHON_VERSION="$(python -c 'import platform; print(platform.python_version())')" \
-G Ninja ..
🧰 Tools
🪛 Shellcheck

[warning] 16-16: Quote this to prevent word splitting.

(SC2046)

Comment on lines 24 to 26
# Copy programs to bin
cd $PREFIX/bin
cp $SRC_DIR/bin/* .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve binary installation robustness.

The current binary installation process needs better error handling and validation.

-# Copy programs to bin
-cd $PREFIX/bin
-cp $SRC_DIR/bin/* .
+# Copy programs to bin
+cd "${PREFIX}/bin" || exit 1
+if [ -d "${SRC_DIR}/bin" ] && [ "$(ls -A "${SRC_DIR}/bin")" ]; then
+    cp "${SRC_DIR}"/bin/* . || exit 1
+else
+    echo "Warning: No binaries found in ${SRC_DIR}/bin"
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Copy programs to bin
cd $PREFIX/bin
cp $SRC_DIR/bin/* .
# Copy programs to bin
cd "${PREFIX}/bin" || exit 1
if [ -d "${SRC_DIR}/bin" ] && [ "$(ls -A "${SRC_DIR}/bin")" ]; then
cp "${SRC_DIR}"/bin/* . || exit 1
else
echo "Warning: No binaries found in ${SRC_DIR}/bin"
fi
🧰 Tools
🪛 Shellcheck

[warning] 25-25: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

Comment on lines 43 to 46
if (l > 4 && path[l - 4] == '.') {
/* Remove extension */
path[l-4] = '\0';
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Adjust condition to correctly handle extension removal

The condition l > 4 should be l >= 4 to correctly handle file names with extensions exactly four characters long.

Apply this diff to fix the condition:

-if (l > 4 && path[l - 4] == '.') {
+if (l >= 4 && path[l - 4] == '.') {
     /* Remove extension */
     path[l - 4] = '\0';
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (l > 4 && path[l - 4] == '.') {
/* Remove extension */
path[l-4] = '\0';
}
if (l >= 4 && path[l - 4] == '.') {
/* Remove extension */
path[l-4] = '\0';
}

Comment on lines 34 to 41
char path[MAX_PATH * 2];
size_t l;
char *ch;
DWORD ret = GetModuleFileName(NULL, path, MAX_PATH * 2);
if (ret == 0) {
fprintf(stderr, "Failed to get executable name, code %d\n", GetLastError());
exit(1);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Handle potential truncation in GetModuleFileName

If the executable's path exceeds the buffer size, GetModuleFileName may truncate the path without indicating an error. This can lead to incorrect behavior when using the truncated path.

Apply this diff to properly handle truncation:

 DWORD ret = GetModuleFileName(NULL, path, MAX_PATH * 2);
-if (ret == 0) {
+if (ret == 0 || ret == (MAX_PATH * 2)) {
     fprintf(stderr, "Failed to get executable name or path was truncated, code %d\n", GetLastError());
     exit(1);
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
char path[MAX_PATH * 2];
size_t l;
char *ch;
DWORD ret = GetModuleFileName(NULL, path, MAX_PATH * 2);
if (ret == 0) {
fprintf(stderr, "Failed to get executable name, code %d\n", GetLastError());
exit(1);
}
char path[MAX_PATH * 2];
size_t l;
char *ch;
DWORD ret = GetModuleFileName(NULL, path, MAX_PATH * 2);
if (ret == 0 || ret == (MAX_PATH * 2)) {
fprintf(stderr, "Failed to get executable name or path was truncated, code %d\n", GetLastError());
exit(1);
}

Comment on lines 122 to 139
{
SHELLEXECUTEINFO si;
BOOL bResult;
char *param, *python = NULL;
param = strdup(GetCommandLine());

ZeroMemory(&si, sizeof(SHELLEXECUTEINFO));
si.cbSize = sizeof(SHELLEXECUTEINFO);
/* Wait for the spawned process to finish, so that any output goes to the
console *before* the next command prompt */
si.fMask = SEE_MASK_NO_CONSOLE | SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS;
{
char *orig_param = param;
python = get_python_binary(topdir);
si.lpFile = python;
param = make_python_parameters(find_param_start(param), binary);
free(orig_param);
si.lpParameters = param;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Secure handling of command-line parameters

Directly using GetCommandLine can expose the application to command injection if parameters are not properly sanitized, especially when passed to ShellExecuteEx.

Consider using CommandLineToArgvW to safely parse command-line arguments and construct parameters securely.

-char *param, *python = NULL;
-param = strdup(GetCommandLine());
+LPWSTR *argvW;
+int argcW;
+argvW = CommandLineToArgvW(GetCommandLineW(), &argcW);
+if (argvW == NULL) {
+    fprintf(stderr, "Failed to parse command line arguments\n");
+    exit(1);
+}
+// Convert arguments back to ANSI or use wide-character versions throughout

This approach helps in correctly parsing arguments even if they contain spaces or special characters.

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines 125 to 137
char *param, *python = NULL;
param = strdup(GetCommandLine());

ZeroMemory(&si, sizeof(SHELLEXECUTEINFO));
si.cbSize = sizeof(SHELLEXECUTEINFO);
/* Wait for the spawned process to finish, so that any output goes to the
console *before* the next command prompt */
si.fMask = SEE_MASK_NO_CONSOLE | SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS;
{
char *orig_param = param;
python = get_python_binary(topdir);
si.lpFile = python;
param = make_python_parameters(find_param_start(param), binary);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Prefer CreateProcess over ShellExecuteEx for enhanced control and security

Using CreateProcess gives finer control over the execution environment and avoids potential security risks associated with ShellExecuteEx, which may invoke the shell and unintentionally execute scripts or commands.

Apply this diff to switch to CreateProcess:

 BOOL bResult;
 ...
-bResult = ShellExecuteEx(&si);
+STARTUPINFO siStartupInfo;
+PROCESS_INFORMATION piProcessInfo;
+ZeroMemory(&siStartupInfo, sizeof(siStartupInfo));
+siStartupInfo.cb = sizeof(siStartupInfo);
+ZeroMemory(&piProcessInfo, sizeof(piProcessInfo));
+
+bResult = CreateProcess(
+    python,              // lpApplicationName
+    param,               // lpCommandLine
+    NULL,                // lpProcessAttributes
+    NULL,                // lpThreadAttributes
+    FALSE,               // bInheritHandles
+    0,                   // dwCreationFlags
+    NULL,                // lpEnvironment
+    NULL,                // lpCurrentDirectory
+    &siStartupInfo,      // lpStartupInfo
+    &piProcessInfo       // lpProcessInformation
+);
+if (bResult) {
+    WaitForSingleObject(piProcessInfo.hProcess, INFINITE);
+    GetExitCodeProcess(piProcessInfo.hProcess, &exit_code);
+    CloseHandle(piProcessInfo.hProcess);
+    CloseHandle(piProcessInfo.hThread);
+}

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines 109 to 115
char *python = malloc(strlen(topdir) + 12);
strcpy(python, topdir);
/* Remove last two components of the path (we are in Library/bin; python
is in the top-level directory) */
remove_last_component(python);
remove_last_component(python);
strcat(python, "\\python.exe");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Validate existence of python.exe in get_python_binary

Assuming the location of python.exe without verification can lead to errors if the directory structure changes. It's advisable to check if the constructed path exists.

Apply this diff to add validation:

 strcat(python, "\\python.exe");
+if (GetFileAttributes(python) == INVALID_FILE_ATTRIBUTES) {
+    fprintf(stderr, "Python executable not found at %s\n", python);
+    exit(1);
+}
 return python;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
char *python = malloc(strlen(topdir) + 12);
strcpy(python, topdir);
/* Remove last two components of the path (we are in Library/bin; python
is in the top-level directory) */
remove_last_component(python);
remove_last_component(python);
strcat(python, "\\python.exe");
char *python = malloc(strlen(topdir) + 12);
strcpy(python, topdir);
/* Remove last two components of the path (we are in Library/bin; python
is in the top-level directory) */
remove_last_component(python);
remove_last_component(python);
strcat(python, "\\python.exe");
if (GetFileAttributes(python) == INVALID_FILE_ATTRIBUTES) {
fprintf(stderr, "Python executable not found at %s\n", python);
exit(1);
}

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 828daf7 and def59b2.

📒 Files selected for processing (1)
  • recipes/tttrlib/meta.yaml (1 hunks)
🧰 Additional context used
🪛 yamllint
recipes/tttrlib/meta.yaml

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)

🔇 Additional comments (7)
recipes/tttrlib/meta.yaml (7)

1-7: LGTM! Package metadata follows best practices.

The package name and version are properly defined using Jinja2 variables.

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)


12-14: LGTM! Build configuration properly handles ABI compatibility.

The run_exports with max_pin="x.x" ensures proper ABI compatibility as required in the PR objectives.


50-61: LGTM! Package metadata is complete and well-documented.

All required fields are present with appropriate URLs and license information.


25-25: Verify SWIG version constraint rationale.

The SWIG version is pinned to <4.3.0. Please document the reason for this constraint.

#!/bin/bash
# Description: Check if there are known compatibility issues with SWIG 4.3.0
# Expected: Find relevant discussions or issues

# Search for SWIG version discussions in the repository
rg -i "swig.*4\.3\.0" 

63-66: Verify maintainer permissions.

Let's verify if the maintainers have the necessary permissions and are active:

✅ Verification successful

Maintainers verified as active contributors

Both listed maintainers (tpeulen and khemmen) are confirmed as active contributors to the tttrlib repository.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if maintainers are active contributors
# Expected: Find contributions from listed maintainers

# Check if maintainers are contributors to the project
gh api -X GET repos/Fluorescence-Tools/tttrlib/contributors --jq '.[].login'

Length of output: 94


1-66: Verify package suitability for Bioconda.

According to the PR objectives, new recipes not directly related to biological sciences should be submitted to conda-forge instead of Bioconda. Please clarify how this package is specifically used in biological sciences, particularly in fluorescence spectroscopy and microscopy applications.

✅ Verification successful

Package is suitable for Bioconda

Based on the search results, tttrlib is a library specifically designed for time-resolved fluorescence imaging and spectroscopic data analysis, which is directly relevant to biological research. The package is maintained by the Fluorescence-Tools organization and is used for:

  1. Processing time-resolved imaging data in biological microscopy
  2. Analyzing fluorescence spectroscopy data, which is a key technique in molecular and cell biology
  3. Supporting high-throughput biological imaging applications

The package's focus on fluorescence microscopy and spectroscopy, which are essential techniques in biological research, makes it appropriate for inclusion in Bioconda.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for biological science applications
# Expected: Find references to biological applications

# Search for biological science related terms in documentation
rg -i "biology|microscopy|fluorescence|spectroscopy" README.md docs/

Length of output: 116


Script:

#!/bin/bash
# Let's try searching in the repository root for any documentation files
fd -e md -e rst

# Also search the repository for biological/scientific terms in all text files
rg -i "biology|microscopy|fluorescence|spectroscopy|imaging|scientific" 

Length of output: 55859

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)


8-10: Verify source integrity and accessibility.

The source URL and checksum look correct, but let's verify:

Comment on lines +44 to +48
test:
imports:
- tttrlib
commands:
- tttrlib --help
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add click packages to test requirements.

The test command uses the CLI (tttrlib --help) which depends on click packages, but they're not explicitly listed in test requirements.

 test:
   imports:
     - tttrlib
+  requires:
+    - click
+    - click-didyoumean
   commands:
     - tttrlib --help
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test:
imports:
- tttrlib
commands:
- tttrlib --help
test:
imports:
- tttrlib
requires:
- click
- click-didyoumean
commands:
- tttrlib --help

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (4)
recipes/tttrlib/build.sh (2)

5-11: Add platform validation and improve error handling.

While target_platform is set by conda-build, we should validate it and handle unexpected cases.

+# Validate target platform is set
+if [[ -z "${target_platform:-}" ]]; then
+    echo "Error: target_platform is not set" >&2
+    exit 1
+fi
+
 if [[ "${target_platform}" == osx-* ]]; then
   # See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk
   CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
   export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"
 else
   export CONFIG_ARGS=""
 fi
🧰 Tools
🪛 Shellcheck

[warning] 5-5: target_platform is referenced but not assigned.

(SC2154)


23-26: Enhance build process with better progress tracking and error handling.

The fallback mechanism is good but could benefit from progress indication and better error detection.

-# On some platforms (notably aarch64 with Drone) builds can fail due to
-# running out of memory. If this happens, try the build again; if it
-# still fails, restrict to one core.
-ninja install -k 0 || ninja install -k 0 || ninja install -j ${CPU_COUNT}
+echo "Starting build with full parallelism..."
+if ! ninja install -k 0; then
+    echo "Build failed, retrying..."
+    if ! ninja install -k 0; then
+        echo "Second attempt failed, trying with limited cores..."
+        if ! ninja install -j "${CPU_COUNT}"; then
+            echo "Build failed after all attempts" >&2
+            exit 1
+        fi
+    fi
+fi
recipes/tttrlib/meta.yaml (2)

16-42: Consider documenting SWIG version constraint.

The SWIG version is pinned to <4.3.0. Please document the reason for this specific version constraint, as it might affect future maintenance.


53-56: Fix typos in package description.

There are typos in the description text that should be corrected.

-    tttrlib is a simple, fast, libray to read, write and process
-    time-resolved imaging and spectroscopic data. For speed, it 
+    tttrlib is a simple, fast library to read, write and process
+    time-resolved imaging and spectroscopic data. For speed, it
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between def59b2 and 78a75c8.

📒 Files selected for processing (2)
  • recipes/tttrlib/build.sh (1 hunks)
  • recipes/tttrlib/meta.yaml (1 hunks)
🧰 Additional context used
🪛 Shellcheck
recipes/tttrlib/build.sh

[warning] 3-3: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 5-5: target_platform is referenced but not assigned.

(SC2154)


[warning] 19-19: Quote this to prevent word splitting.

(SC2046)

🪛 yamllint
recipes/tttrlib/meta.yaml

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)

🔇 Additional comments (2)
recipes/tttrlib/meta.yaml (2)

12-14: LGTM! Good use of run_exports.

The build configuration correctly implements run_exports as recommended in the PR objectives to prevent ABI breakage issues.


8-10: Verify source tarball integrity.

The source URL and checksum format are correct. Let's verify the integrity of the source.

Comment on lines +1 to +4
#!/bin/bash

mkdir b2 && cd b2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve build directory handling and error detection.

The build directory creation needs better error handling and cleanup.

 #!/bin/bash
-
-mkdir b2 && cd b2
+set -euo pipefail
+
+BUILD_DIR="b2"
+trap 'rm -rf "${BUILD_DIR}"' EXIT
+rm -rf "${BUILD_DIR}"
+mkdir -p "${BUILD_DIR}" || exit 1
+cd "${BUILD_DIR}" || exit 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#!/bin/bash
mkdir b2 && cd b2
#!/bin/bash
set -euo pipefail
BUILD_DIR="b2"
trap 'rm -rf "${BUILD_DIR}"' EXIT
rm -rf "${BUILD_DIR}"
mkdir -p "${BUILD_DIR}" || exit 1
cd "${BUILD_DIR}" || exit 1
🧰 Tools
🪛 Shellcheck

[warning] 3-3: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

Comment on lines 13 to 21
cmake -S .. -B . \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DBUILD_PYTHON_INTERFACE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_LIBRARY=ON \
-DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())') \
-G Ninja \
"${CONFIG_ARGS}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add missing CMake options and optimize build configuration.

The CMake configuration is missing important options for Python module installation.

 cmake -S .. -B . \
   -DCMAKE_CXX_COMPILER="${CXX}" \
   -DCMAKE_INSTALL_PREFIX="$PREFIX" \
   -DBUILD_PYTHON_INTERFACE=ON \
   -DCMAKE_BUILD_TYPE=Release \
-  -DBUILD_LIBRARY=ON \
   -DPYTHON_VERSION="$(python -c 'import platform; print(platform.python_version())')" \
+  -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="${SP_DIR}" \
+  -DCMAKE_SWIG_OUTDIR="${SP_DIR}" \
   -G Ninja \
   "${CONFIG_ARGS}"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cmake -S .. -B . \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DBUILD_PYTHON_INTERFACE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_LIBRARY=ON \
-DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())') \
-G Ninja \
"${CONFIG_ARGS}"
cmake -S .. -B . \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DBUILD_PYTHON_INTERFACE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DPYTHON_VERSION="$(python -c 'import platform; print(platform.python_version())')" \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="${SP_DIR}" \
-DCMAKE_SWIG_OUTDIR="${SP_DIR}" \
-G Ninja \
"${CONFIG_ARGS}"
🧰 Tools
🪛 Shellcheck

[warning] 19-19: Quote this to prevent word splitting.

(SC2046)

Comment on lines +28 to +30
# Copy programs to bin
chmod 0755 $SRC_DIR/bin/*
cp -f $SRC_DIR/bin/* $PREFIX/bin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Improve security and robustness of binary installation.

The current binary installation process needs better security measures and validation.

-# Copy programs to bin
-chmod 0755 $SRC_DIR/bin/*
-cp -f $SRC_DIR/bin/* $PREFIX/bin
+# Install binaries with proper permissions
+BINDIR="${SRC_DIR}/bin"
+if [[ ! -d "${BINDIR}" ]]; then
+    echo "Error: Binary directory ${BINDIR} not found" >&2
+    exit 1
+fi
+
+# Ensure destination exists
+mkdir -p "${PREFIX}/bin"
+
+# Process each file individually with proper permission checks
+find "${BINDIR}" -type f -print0 | while IFS= read -r -d '' file; do
+    if [[ -x "${file}" ]]; then
+        install -v -m 755 "${file}" "${PREFIX}/bin/"
+    else
+        echo "Warning: Skipping non-executable file: ${file}" >&2
+    fi
+done
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Copy programs to bin
chmod 0755 $SRC_DIR/bin/*
cp -f $SRC_DIR/bin/* $PREFIX/bin
# Install binaries with proper permissions
BINDIR="${SRC_DIR}/bin"
if [[ ! -d "${BINDIR}" ]]; then
echo "Error: Binary directory ${BINDIR} not found" >&2
exit 1
fi
# Ensure destination exists
mkdir -p "${PREFIX}/bin"
# Process each file individually with proper permission checks
find "${BINDIR}" -type f -print0 | while IFS= read -r -d '' file; do
if [[ -x "${file}" ]]; then
install -v -m 755 "${file}" "${PREFIX}/bin/"
else
echo "Warning: Skipping non-executable file: ${file}" >&2
fi
done

bioconda does not build for windows
-> remove windows app wrapper.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
recipes/tttrlib/meta.yaml (2)

46-50: Consider expanding test coverage.

While basic import and CLI tests are present, consider adding more comprehensive tests for this scientific library:

  • Test reading example data files
  • Verify core functionality (e.g., data processing methods)
  • Test different file format support

56-58: Fix typos in package description.

There are a few typos in the description text:

-    tttrlib is a simple, fast, libray to read, write and process
-    time-resolved imaging and spectroscopic data. For speed, it 
+    tttrlib is a simple, fast library to read, write and process
+    time-resolved imaging and spectroscopic data. For speed, it
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 78a75c8 and e23517a.

📒 Files selected for processing (1)
  • recipes/tttrlib/meta.yaml (1 hunks)
🧰 Additional context used
🪛 yamllint
recipes/tttrlib/meta.yaml

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)

🔇 Additional comments (4)
recipes/tttrlib/meta.yaml (4)

1-10: LGTM! Package metadata is well-structured.

The package metadata section follows conda packaging best practices with proper templating and source verification.

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)


12-14: LGTM! Build configuration properly handles ABI compatibility.

The run_exports configuration with max_pin="x.x" ensures proper ABI compatibility for downstream packages.


1-68: LGTM! Recipe meets Bioconda guidelines.

The package is appropriately placed in Bioconda as it's relevant to biological sciences (fluorescence spectroscopy and microscopy). The recipe includes all required metadata and follows conda packaging best practices.

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)


25-25: Verify SWIG version constraint.

The SWIG version is pinned to <4.3.0. Please verify if this constraint is necessary or if a newer version could be supported.

✅ Verification successful

Let me search for more context about SWIG usage in the codebase.


Let me check for any SWIG-related build or interface files specifically.


Based on the search results, I can now provide a final response:

SWIG version constraint should be maintained for compatibility.

The package description explicitly states that tttrlib is "written in C++ and wrapped for Python via SWIG". The current SWIG version constraint (<4.3.0) appears to be intentional, as other packages in the ecosystem that use SWIG for Python bindings (like rnablueprint, htseq) also specify version constraints. Without explicit testing of newer SWIG versions with this codebase, removing this constraint could lead to compatibility issues.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are any known compatibility issues with newer SWIG versions
rg -i "swig.*4\.3" || echo "No explicit mentions of SWIG 4.3 compatibility issues found"

Length of output: 64


Script:

#!/bin/bash
# Check for SWIG interface files and any version-specific code
fd -e i -e swg . | xargs cat

# Look for build system files that might have SWIG-related configurations
fd -e cmake -e CMake . | xargs cat

# Check if there are any issues or discussions mentioning SWIG in documentation
fd README LICENSE CHANGELOG -t f | xargs cat

Length of output: 20336


Script:

#!/bin/bash
# Look for SWIG interface files in the repository
fd -e i -e swg -e swig . || echo "No SWIG interface files found"

# Check for any build-related files that might mention SWIG
rg -i "swig" --type cmake --type make --type yaml -A 3 -B 3 || echo "No SWIG-related build configurations found"

Length of output: 7644

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
recipes/tttrlib/meta.yaml (1)

55-58: Fix typo in package description

There's a typo in the description: "libray" should be "library".

-    tttrlib is a simple, fast, libray to read, write and process
+    tttrlib is a simple, fast, library to read, write and process
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e23517a and 9bf368a.

📒 Files selected for processing (1)
  • recipes/tttrlib/meta.yaml (1 hunks)
🧰 Additional context used
🪛 yamllint
recipes/tttrlib/meta.yaml

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)

🔇 Additional comments (5)
recipes/tttrlib/meta.yaml (5)

1-7: LGTM: Package metadata is well-structured

The package name and version are properly templated using Jinja2 variables.

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)


12-14: LGTM: Build configuration follows best practices

The run_exports configuration ensures proper version pinning for downstream dependencies.


46-50: Previous comment about click packages still applies


65-68: LGTM: Maintainer information is properly formatted


8-10: Verify source URL accessibility and checksum

The source configuration looks good with proper version templating and checksum.

Comment on lines 16 to 44
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- pkg-config
- cmake
- ninja
- make
host:
- swig <4.3.0
- doxygen
- llvm-openmp # [osx]
- libgomp # [linux]
- boost-cpp
- hdf5
- python
- pip
- numpy
run:
- python
- llvm-openmp # [osx]
- libgomp # [linux]
- tqdm
- click
- click-didyoumean
- {{ pin_compatible('numpy') }}
- scikit-image
- matplotlib-base
- hdf5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add version constraints for critical dependencies

While the dependencies are well-organized, consider adding version constraints for critical components:

  • Python version should be constrained to ensure compatibility
  • boost-cpp and hdf5 versions should be pinned for stability
  host:
    - boost-cpp
    - hdf5
-   - python
+   - python >=3.8
    - pip
    - numpy
  run:
-   - python
+   - python >=3.8
    - llvm-openmp   # [osx]

Committable suggestion skipped: line range outside the PR's diff.

@mencian
Copy link
Contributor

mencian commented Nov 5, 2024

The error seems to be isolated in osx with python 3.12.

@tpeulen
Copy link
Contributor Author

tpeulen commented Nov 6, 2024

On my local Apple M1 setup (x86_64 Conda), the tttrlib recipe builds successfully across multiple Python versions, including 3.12, with the command:

bioconda-utils build --git-range master --package tttrlib

For example, here’s the output from the build with Python 3.12:

17:17:15 BIOCONDA INFO (OUT) "tttrlib-0.25.0-py312h3d580cb_0.tar.bz2": {
17:17:15 BIOCONDA INFO (OUT)   "recipe": {
17:17:15 BIOCONDA INFO (OUT)     "c_compiler": "clang",
17:17:15 BIOCONDA INFO (OUT)     "cxx_compiler": "clangxx",
17:17:15 BIOCONDA INFO (OUT)     "hdf5": "1.14.3",
17:17:15 BIOCONDA INFO (OUT)     "numpy": "1.26",
17:17:15 BIOCONDA INFO (OUT)     "python": "3.12.* *_cpython",
17:17:15 BIOCONDA INFO (OUT)     "target_platform": "osx-64"
17:17:15 BIOCONDA INFO (OUT)   }
17:17:15 BIOCONDA INFO (OUT) },

However, on the Bioconda build machine, CMake fails to locate Python_NumPy_INCLUDE_DIRS, even though it recognizes the Python version (3.12.7). I reviewed the project’s CMakeLists.txt to identify any unusual configurations but found that it follows a standard setup for Python discovery:

MESSAGE(STATUS "Python version: '${PYTHON_VERSION}'")
cmake_policy(SET CMP0094 NEW)

FIND_PACKAGE(Python ${PYTHON_VERSION} EXACT COMPONENTS Interpreter Development.Module NumPy)
INCLUDE_DIRECTORIES(BEFORE ${Python_NumPy_PATH} ${Python_INCLUDE_DIRS})
LINK_LIBRARIES(${Python_LIBRARY} Python::NumPy)

In the builds, Python_ROOT_DIR cmake hint is set to $ENV{CONDA_PREFIX}/bin, resolving to $BUILD_PREFIX/bin during builds. This usually directs CMake correctly, but in the Bioconda environment (only Python 3.12), the issue persists.

The root cause is challenging to identify, possibly related to NumPy discovery in the Bioconda build machine, despite using standard FIND_PACKAGE logic.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
recipes/tttrlib/meta.yaml (3)

24-24: Document SWIG version constraint rationale

The SWIG version is pinned to <4.3.0. Please document the reason for this constraint in a comment, as it helps future maintenance.

-    - swig <4.3.0
+    - swig <4.3.0  # Versions >=4.3.0 have compatibility issues with the build

29-33: Consider pinning boost-cpp and hdf5 versions

For better build reproducibility and to prevent potential ABI incompatibilities, consider pinning the versions of critical dependencies:

     - boost-cpp
     - hdf5
-    - python
+    - python >=3.8
     - pip
     - numpy

55-58: Fix typos in package description

There are a few typos in the description text:

-    tttrlib is a simple, fast, libray to read, write and process
-    time-resolved imaging and spectroscopic data. For speed, it 
+    tttrlib is a simple, fast library to read, write and process
+    time-resolved imaging and spectroscopic data. For speed, it
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9bf368a and 2158694.

📒 Files selected for processing (1)
  • recipes/tttrlib/meta.yaml (1 hunks)
🧰 Additional context used
🪛 yamllint
recipes/tttrlib/meta.yaml

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)

🔇 Additional comments (1)
recipes/tttrlib/meta.yaml (1)

8-10: Verify source URL and checksum integrity

Let's ensure the source URL is accessible and the checksum matches.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (4)
recipes/tttrlib/build.sh (1)

24-27: Enhance build failure handling and reporting.

While the retry logic is good, it could benefit from better error reporting and exit code handling.

-ninja install -k 0 || ninja install -k 0 || ninja install -j ${CPU_COUNT}
+# Function to attempt build with different strategies
+build_with_strategy() {
+    local strategy="$1"
+    echo "Attempting build with strategy: $strategy" >&2
+    case "$strategy" in
+        "default")
+            ninja install -k 0
+            ;;
+        "retry")
+            ninja install -k 0
+            ;;
+        "single-core")
+            ninja install -j "${CPU_COUNT:-1}"
+            ;;
+    esac
+    return $?
+}
+
+for strategy in default retry single-core; do
+    if build_with_strategy "$strategy"; then
+        echo "Build successful with $strategy strategy" >&2
+        exit 0
+    else
+        echo "Build failed with $strategy strategy, trying next..." >&2
+    fi
+done
+
+echo "All build strategies failed" >&2
+exit 1
recipes/tttrlib/meta.yaml (3)

12-15: Monitor macOS Python >3.10 compatibility.

The skip condition for macOS with Python >3.10 aligns with the reported build issues. Consider:

  1. Opening an upstream issue to track the macOS + Python >3.10 compatibility
  2. Adding a comment explaining the skip reason
  build:
    number: 0
-   skip: True  # [osx and py > 310]
+   skip: True  # [osx and py > 310]  # CMake fails to locate Python_NumPy_INCLUDE_DIRS on macOS with Python >3.10
    run_exports: '{{ pin_subpackage("tttrlib", max_pin="x.x") }}'

17-46: Consider adding optional dependencies for imaging functionality.

Given that the package supports time-resolved imaging data, consider adding optional dependencies like:

  • pillow for image I/O
  • opencv for advanced image processing

Would you like me to help create a feature matrix to determine which dependencies should be optional vs. required?


57-60: Fix typos in package description.

-    tttrlib is a simple, fast, libray to read, write and process
-    time-resolved imaging and spectroscopic data. For speed, it 
+    tttrlib is a simple, fast library to read, write, and process
+    time-resolved imaging and spectroscopic data. For speed, it
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2158694 and f000548.

📒 Files selected for processing (2)
  • recipes/tttrlib/build.sh (1 hunks)
  • recipes/tttrlib/meta.yaml (1 hunks)
🧰 Additional context used
🪛 Shellcheck
recipes/tttrlib/build.sh

[warning] 3-3: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 5-5: target_platform is referenced but not assigned.

(SC2154)


[warning] 19-19: Quote this to prevent word splitting.

(SC2046)

🪛 yamllint
recipes/tttrlib/meta.yaml

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)

🔇 Additional comments (3)
recipes/tttrlib/meta.yaml (3)

1-6: LGTM! Package metadata follows best practices.

The package name and version are properly defined using Jinja2 variables.

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)


67-70: LGTM! Maintainers section is properly formatted.


8-10: Verify source availability and checksum.

The source URL and checksum look correct, but let's verify:

-DCMAKE_BUILD_TYPE=Release \
-DBUILD_LIBRARY=ON \
-DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())') \
-DPython_ROOT_DIR="${PREFIX}/bin" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix Python root directory path.

The Python root directory should point to PREFIX, not PREFIX/bin. The current path is incorrect and may cause Python component discovery issues.

- -DPython_ROOT_DIR="${PREFIX}/bin" \
+ -DPython_ROOT_DIR="${PREFIX}" \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
-DPython_ROOT_DIR="${PREFIX}/bin" \
-DPython_ROOT_DIR="${PREFIX}" \

ninja install -k 0 || ninja install -k 0 || ninja install -j ${CPU_COUNT}

# Copy programs to bin
chmod 0755 $SRC_DIR/bin/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add directory existence check before chmod.

The script attempts to modify permissions without verifying the existence of the directory or files, which could mask errors.

-chmod 0755 $SRC_DIR/bin/*
+if [[ -d "${SRC_DIR}/bin" ]] && compgen -G "${SRC_DIR}/bin/*" > /dev/null; then
+    chmod 0755 "${SRC_DIR}"/bin/*
+else
+    echo "Error: No files found in ${SRC_DIR}/bin" >&2
+    exit 1
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
chmod 0755 $SRC_DIR/bin/*
if [[ -d "${SRC_DIR}/bin" ]] && compgen -G "${SRC_DIR}/bin/*" > /dev/null; then
chmod 0755 "${SRC_DIR}"/bin/*
else
echo "Error: No files found in ${SRC_DIR}/bin" >&2
exit 1
fi

Comment on lines +5 to +11
if [[ "${target_platform}" == osx-* ]]; then
# See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk
CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"
else
export CONFIG_ARGS=""
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add validation for target_platform variable.

The script assumes target_platform is set but should validate its existence to prevent potential errors.

+if [[ -z "${target_platform:-}" ]]; then
+    echo "Error: target_platform is not set" >&2
+    exit 1
+fi
+
 if [[ "${target_platform}" == osx-* ]]; then
   # See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk
   CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
   export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"
 else
   export CONFIG_ARGS=""
 fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [[ "${target_platform}" == osx-* ]]; then
# See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk
CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"
else
export CONFIG_ARGS=""
fi
if [[ -z "${target_platform:-}" ]]; then
echo "Error: target_platform is not set" >&2
exit 1
fi
if [[ "${target_platform}" == osx-* ]]; then
# See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk
CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"
else
export CONFIG_ARGS=""
fi
🧰 Tools
🪛 Shellcheck

[warning] 5-5: target_platform is referenced but not assigned.

(SC2154)

@mencian
Copy link
Contributor

mencian commented Nov 13, 2024

@BiocondaBot please fetch artifacts

@BiocondaBot
Copy link
Collaborator

Package(s) built are ready for inspection:

Arch Package Zip File / Repodata CI Instructions
linux-64 tttrlib-0.25.0-py310hddbaf4e_0.tar.bz2 linux-64.zip GitHub Actions
showYou may also use conda to install after downloading and extracting the zip file. conda install -c ./packages <package name>
linux-64 tttrlib-0.25.0-py311hce07f56_0.tar.bz2 linux-64.zip GitHub Actions
showYou may also use conda to install after downloading and extracting the zip file. conda install -c ./packages <package name>
linux-64 tttrlib-0.25.0-py312h00b19f6_0.tar.bz2 linux-64.zip GitHub Actions
showYou may also use conda to install after downloading and extracting the zip file. conda install -c ./packages <package name>
linux-64 tttrlib-0.25.0-py38hf32e4b1_0.tar.bz2 linux-64.zip GitHub Actions
showYou may also use conda to install after downloading and extracting the zip file. conda install -c ./packages <package name>
linux-64 tttrlib-0.25.0-py39h9ceac56_0.tar.bz2 linux-64.zip GitHub Actions
showYou may also use conda to install after downloading and extracting the zip file. conda install -c ./packages <package name>
osx-64 tttrlib-0.25.0-py310h5618a4b_0.tar.bz2 osx-64.zip GitHub Actions
showYou may also use conda to install after downloading and extracting the zip file. conda install -c ./packages <package name>
osx-64 tttrlib-0.25.0-py38h306e1e8_0.tar.bz2 osx-64.zip GitHub Actions
showYou may also use conda to install after downloading and extracting the zip file. conda install -c ./packages <package name>
osx-64 tttrlib-0.25.0-py39hbc00431_0.tar.bz2 osx-64.zip GitHub Actions
showYou may also use conda to install after downloading and extracting the zip file. conda install -c ./packages <package name>

@mencian
Copy link
Contributor

mencian commented Nov 13, 2024

I'll push this PR out in the mean time to make sure this tool is available for other users. Still not sure why numpy can't be found only on osx python >3.10.

@mencian mencian merged commit 4b4d896 into bioconda:master Nov 13, 2024
6 checks passed
@tpeulen
Copy link
Contributor Author

tpeulen commented Nov 15, 2024

@mencian thank you so much. That was really helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants