Skip to content

Commit

Permalink
Remove no_python feature, make it work by default
Browse files Browse the repository at this point in the history
  • Loading branch information
vsbogd committed Jul 24, 2024
1 parent 8c1b66d commit c3d4824
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ADD --chown=user:users . ${HOME}/hyperon-experimental

WORKDIR ${HOME}/hyperon-experimental
RUN cargo test --release
RUN cargo build --release
RUN cargo build --features python,git --release

ENV BUILD=${HOME}/hyperon-experimental/build
RUN mkdir ${BUILD}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ cargo run --example sorted_list

Run Rust REPL:
```
cargo run --features no_python --bin metta-repl
cargo run --bin metta-repl
```
You can also find executable at `./target/debug/metta-repl`.

Expand Down Expand Up @@ -188,7 +188,7 @@ metta-py ./tests/scripts/<name>.metta

Run REPL:
```
cargo run --bin metta-repl
cargo run --features python --bin metta-repl
```
You can also find executable at `./target/debug/metta-repl`.

Expand Down
4 changes: 2 additions & 2 deletions python/tests/scripts/f1_imports.metta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: This test won't work under no_python mode because it relies on
; NOTE: This test won't work under no python mode because it relies on
; specific atoms in the space. When running in Python, corelib and stdlib
; are separate modules, but in no_python mode there is no Python stdlib
; are separate modules, but in no python mode there is no Python stdlib
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Even at the very beginning of the script `(get-atoms &self)`
Expand Down
3 changes: 1 addition & 2 deletions repl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ name = "metta-repl"
path = "src/main.rs"

[features]
default = ["python"]
no_python = ["hyperon"]
default = ["hyperon"]
python = ["pyo3", "pep440_rs"]
old_interpreter = ["hyperon/old_interpreter"]
git = ["hyperon/git"]
6 changes: 3 additions & 3 deletions repl/src/metta_shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn exec_state_should_break() -> bool {
}
}

#[cfg(all(feature = "python", not(feature = "no_python")))]
#[cfg(feature = "python")]
pub mod metta_interface_mod {
use std::str::FromStr;
use std::path::PathBuf;
Expand Down Expand Up @@ -302,15 +302,15 @@ pub mod metta_interface_mod {

}

/// The "no_python" path involves a reimplementation of all of the MeTTa interface points calling MeTTa
/// The "no python" path involves a reimplementation of all of the MeTTa interface points calling MeTTa
/// directly instead of through Python. Maintaining two paths is a temporary stop-gap solution because
/// we can only link the Hyperon Rust library through one pathway and the HyperonPy module is that path
/// when the Python repl is used.
///
/// When we have the ability to statically link HyperonPy, we can remove this shim and call
/// Hyperon and MeTTa from everywhere in the code. This will likely mean we can get rid of the clumsy
/// implementations in the "python" version of metta_interface_mod. See See https://github.com/trueagi-io/hyperon-experimental/issues/283
#[cfg(feature = "no_python")]
#[cfg(not(feature = "python"))]
pub mod metta_interface_mod {
use std::path::{PathBuf, Path};
use hyperon::metta::*;
Expand Down

0 comments on commit c3d4824

Please sign in to comment.