Skip to content

Commit

Permalink
refactor: add pylyzer_core crate
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Aug 20, 2024
1 parent f5503d6 commit 6828ddc
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 22 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 9 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repository.workspace = true
[workspace]
members = [
"crates/py2erg",
"crates/pylyzer_core",
]

[workspace.package]
Expand All @@ -37,19 +38,16 @@ rustpython-ast = { git = "https://github.com/RustPython/Parser", version = "0.4.
# els = { path = "../erg/crates/els", features = ["py_compat"] }

[features]
debug = ["erg_compiler/debug", "erg_common/debug", "py2erg/debug"]
large_thread = ["erg_compiler/large_thread", "erg_common/large_thread", "els/large_thread"]
pretty = ["erg_compiler/pretty", "erg_common/pretty"]
backtrace = ["erg_common/backtrace"]
experimental = ["els/experimental", "erg_compiler/experimental", "erg_common/experimental"]
debug = ["erg_common/debug", "pylyzer_core/debug"]
large_thread = ["erg_common/large_thread", "els/large_thread", "pylyzer_core/large_thread"]
pretty = ["erg_common/pretty", "pylyzer_core/pretty"]
backtrace = ["erg_common/backtrace", "els/backtrace", "pylyzer_core/backtrace"]
experimental = ["erg_common/experimental", "els/experimental", "pylyzer_core/experimental"]

[dependencies]
erg_compiler = { workspace = true }
pylyzer_core = { version = "0.0.60", path = "./crates/pylyzer_core" }
erg_common = { workspace = true }
els = { workspace = true }
rustpython-parser = { workspace = true }
rustpython-ast = { workspace = true }
py2erg = { version = "0.0.60", path = "./crates/py2erg" }

[lib]
path = "src/lib.rs"
[dev-dependencies]
erg_compiler = { workspace = true }
3 changes: 3 additions & 0 deletions cargo_publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ if [[ "$PWD" == */pylyzer ]]; then
cd crates/py2erg
echo "publish py2erg ..."
cargo publish
cd ../pylyzer_core
echo "publish pylyzer_core ..."
cargo publish
cd ../../
cargo publish
if [ "$1" = "--cargo-only" ]; then
Expand Down
24 changes: 24 additions & 0 deletions crates/pylyzer_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "pylyzer_core"
version.workspace = true
authors.workspace = true
license.workspace = true
edition.workspace = true
repository.workspace = true

[features]
debug = ["erg_compiler/debug", "erg_common/debug", "py2erg/debug"]
large_thread = ["erg_compiler/large_thread", "erg_common/large_thread"]
pretty = ["erg_compiler/pretty", "erg_common/pretty"]
backtrace = ["erg_common/backtrace"]
experimental = ["erg_compiler/experimental", "erg_common/experimental"]

[dependencies]
erg_common = { workspace = true }
erg_compiler = { workspace = true }
rustpython-parser = { workspace = true }
rustpython-ast = { workspace = true }
py2erg = { version = "0.0.60", path = "../py2erg" }

[lib]
path = "lib.rs"
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions crates/pylyzer_core/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mod analyze;
mod handle_err;

pub use analyze::{PythonAnalyzer, SimplePythonParser};
1 change: 0 additions & 1 deletion src/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ fn copy_dir(from: impl AsRef<Path>, to: impl AsRef<Path>) -> std::io::Result<()>
Ok(())
}

#[allow(unused)]
pub(crate) fn copy_dot_erg() {
if erg_path().exists() {
return;
Expand Down
6 changes: 0 additions & 6 deletions src/lib.rs

This file was deleted.

4 changes: 1 addition & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
mod analyze;
mod config;
mod copy;
mod handle_err;

use analyze::{PythonAnalyzer, SimplePythonParser};
use els::Server;
use erg_common::config::ErgMode;
use erg_common::spawn::exec_new_thread;
use pylyzer_core::{PythonAnalyzer, SimplePythonParser};

use crate::copy::copy_dot_erg;

Expand Down
2 changes: 1 addition & 1 deletion tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use erg_common::config::ErgConfig;
use erg_common::io::Input;
use erg_common::spawn::exec_new_thread;
use erg_compiler::artifact::{CompleteArtifact, IncompleteArtifact};
use pylyzer::PythonAnalyzer;
use pylyzer_core::PythonAnalyzer;

pub fn exec_analyzer(file_path: &'static str) -> Result<CompleteArtifact, IncompleteArtifact> {
let cfg = ErgConfig {
Expand Down

0 comments on commit 6828ddc

Please sign in to comment.