Skip to content

Adding build script for lingua-rs#8181

Open
vijay-vin wants to merge 4 commits intoppc64le:masterfrom
vijay-vin:linqua-rs
Open

Adding build script for lingua-rs#8181
vijay-vin wants to merge 4 commits intoppc64le:masterfrom
vijay-vin:linqua-rs

Conversation

@vijay-vin
Copy link
Copy Markdown

Checklist

  • [ x] Have you checked and followed all the points mention in the CONTRIBUTING.MD
  • [ x] Have you validated script on UBI 9 container
  • [ x] Did you run the script(s) on fresh container with set -e option enabled and observe success ?
  • [ x] Did you have Legal approvals for patch files ?

Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
@vijay-vin
Copy link
Copy Markdown
Author

Here are last few lines from running the build script showing it as success along with test results.

  • echo 'Running upstream Python tests with pytest...'
    Running upstream Python tests with pytest...
  • pytest tests/python
    =============================================================== test session starts ===============================================================
    platform linux -- Python 3.12.12, pytest-9.0.3, pluggy-1.6.0
    rootdir: /build/lingua-rs
    configfile: pyproject.toml
    collected 74 items

tests/python/test_builder.py ........... [ 14%]
tests/python/test_confidencevalue.py ... [ 18%]
tests/python/test_detectionresult.py ... [ 22%]
tests/python/test_detector.py .................... [ 50%]
tests/python/test_isocode.py ............ [ 66%]
tests/python/test_language.py .............. [ 85%]
tests/python/test_writer.py ........... [100%]

=============================================================== 74 passed in 0.34s ================================================================

  • '[' 0 -ne 0 ']'

  • echo ''

  • echo 'SUCCESS: lingua-language-detector 2.2.0 built and validated'
    SUCCESS: lingua-language-detector 2.2.0 built and validated

  • echo ''

[root@onprem133723021 lingua-ubi-build]#

Comment thread l/lingua-rs/lingua_ubi_9.6.sh Outdated
set -e

# Variables
PKG_NAME="lingua-language-detector"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
PKG_NAME="lingua-language-detector"
PACKAGE_NAME="lingua-language-detector"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

Comment thread l/lingua-rs/lingua_ubi_9.6.sh Outdated
PKG_NAME="lingua-language-detector"
PKG_VERSION="2.2.0"
PKG_ORG="pemistahl"
PKG_REPO="lingua-rs"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

Comment thread l/lingua-rs/lingua_ubi_9.6.sh Outdated
ln -sf /usr/bin/python3.12 /usr/bin/python3
ln -sf /usr/bin/pip-3.12 /usr/bin/pip3
ln -sf /usr/bin/python3.12 /usr/bin/python
ln -sf /usr/bin/pip-3.12 /usr/bin/pip
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Normalize Python commands block not required, python version will be managed GHA.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

Comment thread l/lingua-rs/lingua_ubi_9.6.sh Outdated
# ------------------------------------------------------------------------------

sed -i \
"s/^version = .*/version = \"${PKG_VERSION}+${IBM_SUFFIX}\"/" \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can skip this line, as we don't apply suffix in front of version.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done


echo "Running upstream Python tests with pytest..."
pytest tests/python
if [ $? -ne 0 ]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Take a look here, this is how we execute test cases

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done. Modified the script according to the template.

Comment thread l/lingua-rs/lingua_ubi_9.6.sh Outdated
fi

echo ""
echo "SUCCESS: ${PKG_NAME} ${PKG_VERSION} built and validated"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generally we don't have this kind of messages at the end.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done. Removed the echo statement.

{
"maintainer": "vijay-vinnakota",
"package_name": "lingua-language-detector",
"github_url": "https://github.com/pemistahl/lingua-rs",
Copy link
Copy Markdown
Contributor

@adarshagrawal38 adarshagrawal38 Apr 28, 2026

Choose a reason for hiding this comment

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

Where we not able to build pkg from lingua-py?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

From version 2 on, the repo is lingua-rs

Comment thread l/lingua-rs/lingua_ubi_9.6.sh Outdated
# ------------------------------------------------------------------------------
echo "Building wheel using maturin..."

maturin build --release --strip
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can build the pkg using pip as well
reference here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

While pip can invoke the build, lingua-rs is a PyO3‑based Rust extension package and the build configuration explicitly uses maturin as build backend as defined in repo's pyproject.toml file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Please ignore my above comment. I misunderstood your comment.
I have now changed the build command to use pip per the template.

Comment thread l/lingua-rs/lingua_ubi_9.6.sh Outdated

WHEEL_FILE="$(ls target/wheels/${PKG_NAME//-/_}-*.whl | head -n 1)"

if [[ ! -f "${WHEEL_FILE}" ]]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to locate wheel

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The wheel check is intentional—it resolves and validates the exact wheel filename produced by maturin before installation. Since the install step depends on this variable, the check helps fail early with clearer diagnostics. Essentially, treating the generated wheel filename validated before input for the installation step.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Please ignore my above comment. I have removed all those lines now as they are not needed in my new updated script where i am using pip and not maturin.

Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
@ghatwala ghatwala requested a review from cdeepali April 30, 2026 13:43
@ghatwala
Copy link
Copy Markdown
Contributor

@cdeepali can you please help review this PR once as this is for a new package addition ? cc : @prachikurade1

@adarshagrawal38
Copy link
Copy Markdown
Contributor

@yussufsh PTAL

@adarshagrawal38
Copy link
Copy Markdown
Contributor

@cdeepali can you please review the PR, as we want to merge PR

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