Skip to main content

rustpython_vm/
lib.rs

1//! This crate contains most of the python logic.
2//!
3//! - Interpreter
4//! - Import mechanics
5//! - Base objects
6//!
7//! Some stdlib modules are implemented here, but most of them are in the `rustpython-stdlib` module. The
8
9// to allow `mod foo {}` in foo.rs; clippy thinks this is a mistake/misunderstanding of
10// how `mod` works, but we want this sometimes for pymodule declarations
11#![allow(clippy::module_inception)]
12// we want to mirror python naming conventions when defining python structs, so that does mean
13// uppercase acronyms, e.g. TextIOWrapper instead of TextIoWrapper
14#![allow(clippy::upper_case_acronyms)]
15#![doc(html_logo_url = "https://raw.githubusercontent.com/RustPython/RustPython/main/logo.png")]
16#![doc(html_root_url = "https://docs.rs/rustpython-vm/")]
17
18#[cfg(feature = "flame-it")]
19#[macro_use]
20extern crate flamer;
21
22#[macro_use]
23extern crate bitflags;
24#[macro_use]
25extern crate log;
26// extern crate env_logger;
27extern crate alloc;
28
29#[macro_use]
30extern crate rustpython_derive;
31
32extern crate self as rustpython_vm;
33
34pub use rustpython_derive::*;
35
36//extern crate eval; use eval::eval::*;
37// use py_code_object::{Function, NativeType, PyCodeObject};
38
39// This is above everything else so that the defined macros are available everywhere
40#[macro_use]
41pub(crate) mod macros;
42
43mod anystr;
44pub mod buffer;
45pub mod builtins;
46pub mod byte;
47mod bytes_inner;
48pub mod cformat;
49pub mod class;
50mod codecs;
51pub mod compiler;
52pub mod convert;
53mod coroutine;
54pub mod datastack;
55mod dict_inner;
56
57#[cfg(feature = "rustpython-compiler")]
58pub mod eval;
59
60mod exception_group;
61pub mod exceptions;
62pub mod format;
63pub mod frame;
64pub mod function;
65pub mod getpath;
66pub mod import;
67mod intern;
68pub mod iter;
69pub mod object;
70
71#[cfg(feature = "host_env")]
72pub mod ospath;
73
74pub mod prelude;
75pub mod protocol;
76pub mod py_io;
77
78#[cfg(feature = "serde")]
79pub mod py_serde;
80
81pub mod gc_state;
82pub mod readline;
83pub mod recursion;
84pub mod scope;
85pub mod sequence;
86pub mod signal;
87pub mod sliceable;
88pub mod stdlib;
89pub mod suggestion;
90pub mod types;
91pub mod utils;
92pub mod version;
93pub mod vm;
94pub mod warn;
95
96#[cfg(windows)]
97pub mod windows;
98
99pub use self::convert::{TryFromBorrowedObject, TryFromObject};
100pub use self::object::{
101    AsObject, Py, PyAtomicRef, PyExact, PyObject, PyObjectRef, PyPayload, PyRef, PyRefExact,
102    PyResult, PyStackRef, PyWeakRef,
103};
104pub use self::vm::{Context, Interpreter, InterpreterBuilder, Settings, VirtualMachine};
105
106pub use rustpython_common as common;
107pub use rustpython_compiler_core::{bytecode, frozen};
108pub use rustpython_literal as literal;
109
110#[doc(hidden)]
111pub mod __exports {
112    pub use paste;
113}