Skip to content

Fix cargo warning about conflicting names between the cli and the oxen-py crate#399

Open
CleanCut wants to merge 1 commit intomainfrom
cleancut/unique-python-name
Open

Fix cargo warning about conflicting names between the cli and the oxen-py crate#399
CleanCut wants to merge 1 commit intomainfrom
cleancut/unique-python-name

Conversation

@CleanCut
Copy link
Copy Markdown
Contributor

Use a unique python name to avoid the warning from Cargo that the cli and oxen-py produce an artifact with the same name that will be disallowed in the future.

This doesn't change anything from a Python user's perspective. They will still do import oxen, as the python module is named oxen.

… and oxen-py produce an artifact with the same name that will be disallowed in the future
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Reorganized internal module imports for native bindings to maintain consistency across the Python package.

Walkthrough

This PR renames the Rust extension module from oxen to _oxen by updating the Cargo.toml library name and the #[pymodule] function, then updates all Python package imports across 10 files to reference the new module name.

Changes

Cohort / File(s) Summary
Rust Module Definition
crates/oxen-py/Cargo.toml, crates/oxen-py/src/lib.rs
Changed library name and pymodule function from oxen to _oxen.
Python Package Imports
oxen-python/python/oxen/__init__.py, oxen-python/python/oxen/auth.py, oxen-python/python/oxen/config.py, oxen-python/python/oxen/data_frame.py, oxen-python/python/oxen/df_utils.py, oxen-python/python/oxen/oxen_fs.py, oxen-python/python/oxen/remote_repo.py, oxen-python/python/oxen/user.py, oxen-python/python/oxen/workspace.py
Updated all imports from .oxen to ._oxen to reference the renamed Rust extension module.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • malcolmgreaves
  • jcelliott

Poem

🐰 A module once named just oxen plain,
Now bears a leading underscore's refrain,
With imports updated, from here to there,
The binding renamed with Python's flair! 🐍

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: renaming the Rust cdylib from 'oxen' to '_oxen' to resolve a Cargo warning about conflicting artifact names between the CLI and oxen-py crate.
Description check ✅ Passed The description is directly related to the changeset, explaining that the internal Rust module was renamed to avoid a Cargo warning while maintaining the Python user experience through the unchanged public module name.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleancut/unique-python-name

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@oxen-python/python/oxen/oxen_fs.py`:
- Line 12: Several files still import from the removed module path `..oxen`;
update the imports in the diff modules to use the new relative module `._oxen`
and import the same symbols (e.g., PyEntry) so runtime ImportError is avoided.
Specifically, open diff/diff.py, diff/text_diff.py, diff/tabular_diff.py and
diff/line_diff.py and replace any `from ..oxen import ...` lines with `from
._oxen import ...`, keeping the imported names identical to preserve existing
usage. Ensure there are no remaining references to `..oxen` across those files
and run tests to verify imports resolve.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9d7fd3e0-654d-4595-82c5-5554bbc7bd35

📥 Commits

Reviewing files that changed from the base of the PR and between 37cedf0 and 8f4a5db.

📒 Files selected for processing (11)
  • crates/oxen-py/Cargo.toml
  • crates/oxen-py/src/lib.rs
  • oxen-python/python/oxen/__init__.py
  • oxen-python/python/oxen/auth.py
  • oxen-python/python/oxen/config.py
  • oxen-python/python/oxen/data_frame.py
  • oxen-python/python/oxen/df_utils.py
  • oxen-python/python/oxen/oxen_fs.py
  • oxen-python/python/oxen/remote_repo.py
  • oxen-python/python/oxen/user.py
  • oxen-python/python/oxen/workspace.py


from .remote_repo import RemoteRepo
from .oxen import PyEntry
from ._oxen import PyEntry
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.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify if diff/diff.py still uses the old import path
rg -n "from \.\.(\.)?oxen import" oxen-python/python/oxen/

# Also check for any other files that might still use the old import pattern
rg -n "from \.oxen import" oxen-python/python/oxen/

Repository: Oxen-AI/Oxen

Length of output: 452


Update imports in all diff/ files to use ._oxen module.

The change in oxen_fs.py is correct, but several files in the diff/ subdirectory still import from the old ..oxen module path:

  • diff/diff.py (lines 39-40)
  • diff/text_diff.py (line 1)
  • diff/tabular_diff.py (line 1)
  • diff/line_diff.py (line 1)

These imports will fail at runtime with ImportError since the old .oxen module no longer exists. Update them all to use ._oxen.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@oxen-python/python/oxen/oxen_fs.py` at line 12, Several files still import
from the removed module path `..oxen`; update the imports in the diff modules to
use the new relative module `._oxen` and import the same symbols (e.g., PyEntry)
so runtime ImportError is avoided. Specifically, open diff/diff.py,
diff/text_diff.py, diff/tabular_diff.py and diff/line_diff.py and replace any
`from ..oxen import ...` lines with `from ._oxen import ...`, keeping the
imported names identical to preserve existing usage. Ensure there are no
remaining references to `..oxen` across those files and run tests to verify
imports resolve.

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.

1 participant