Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/actions/build-pgo-wheel/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ outputs:
runs:
using: "composite"
steps:
- name: prepare self schema
shell: bash
# generate up front so that we don't have to do this inside the docker container
run: uv run python generate_self_schema.py

- name: prepare profiling directory
shell: bash
# making this ahead of the compile ensures that the local user can write to this
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,6 @@ jobs:

- run: pip install -U twine 'ruff==0.5.0' typing_extensions

# generate self-schema now, so we don't have to do so inside docker in maturin build
- run: python generate_self_schema.py

- name: build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ node_modules/
/*.profraw
/foobar.py
/python/pydantic_core/*.so
/src/self_schema.py

# samply
/profile.json
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ include = [
"/LICENSE",
"/Makefile",
"/build.rs",
"/generate_self_schema.py",
"/rust-toolchain",
"/src",
"!/src/self_schema.py",
"/python/pydantic_core",
"/tests",
"/.cargo",
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.DEFAULT_GOAL := all
sources = python/pydantic_core tests generate_self_schema.py wasm-preview/run_tests.py
sources = python/pydantic_core tests wasm-preview/run_tests.py

mypy-stubtest = uv run python -m mypy.stubtest pydantic_core._pydantic_core --allowlist .mypy-stubtest-allowlist

Expand Down Expand Up @@ -124,7 +124,6 @@ clean:
rm -f `find . -type f -name '*.py[co]' `
rm -f `find . -type f -name '*~' `
rm -f `find . -type f -name '.*~' `
rm -rf src/self_schema.py
rm -rf .cache
rm -rf htmlcov
rm -rf .pytest_cache
Expand Down
14 changes: 5 additions & 9 deletions benches/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ use test::{black_box, Bencher};
use pyo3::prelude::*;
use pyo3::types::{PyDict, PyString};

use _pydantic_core::{validate_core_schema, SchemaValidator};
use _pydantic_core::SchemaValidator;

fn build_schema_validator_with_globals(
py: Python,
code: &CStr,
globals: Option<&Bound<'_, PyDict>>,
) -> SchemaValidator {
let mut schema = py.eval(code, globals, None).unwrap().extract().unwrap();
schema = validate_core_schema(&schema, None).unwrap().extract().unwrap();
let schema = py.eval(code, globals, None).unwrap().extract().unwrap();
SchemaValidator::py_new(py, &schema, None).unwrap()
}

Expand Down Expand Up @@ -510,8 +509,7 @@ fn complete_model(bench: &mut Bencher) {
sys_path.call_method1("append", ("./tests/benchmarks/",)).unwrap();

let complete_schema = py.import("complete_schema").unwrap();
let mut schema = complete_schema.call_method0("schema").unwrap();
schema = validate_core_schema(&schema, None).unwrap().extract().unwrap();
let schema = complete_schema.call_method0("schema").unwrap();
let validator = SchemaValidator::py_new(py, &schema, None).unwrap();

let input = complete_schema.call_method0("input_data_lax").unwrap();
Expand All @@ -534,8 +532,7 @@ fn nested_model_using_definitions(bench: &mut Bencher) {
sys_path.call_method1("append", ("./tests/benchmarks/",)).unwrap();

let complete_schema = py.import("nested_schema").unwrap();
let mut schema = complete_schema.call_method0("schema_using_defs").unwrap();
schema = validate_core_schema(&schema, None).unwrap().extract().unwrap();
let schema = complete_schema.call_method0("schema_using_defs").unwrap();
let validator = SchemaValidator::py_new(py, &schema, None).unwrap();

let input = complete_schema.call_method0("input_data_valid").unwrap();
Expand All @@ -562,8 +559,7 @@ fn nested_model_inlined(bench: &mut Bencher) {
sys_path.call_method1("append", ("./tests/benchmarks/",)).unwrap();

let complete_schema = py.import("nested_schema").unwrap();
let mut schema = complete_schema.call_method0("inlined_schema").unwrap();
schema = validate_core_schema(&schema, None).unwrap().extract().unwrap();
let schema = complete_schema.call_method0("inlined_schema").unwrap();
let validator = SchemaValidator::py_new(py, &schema, None).unwrap();

let input = complete_schema.call_method0("input_data_valid").unwrap();
Expand Down
34 changes: 0 additions & 34 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
use std::env;
use std::path::Path;
use std::process::Command;
use std::str::from_utf8;

fn generate_self_schema() {
println!("cargo:rerun-if-changed=python/pydantic_core/core_schema.py");
println!("cargo:rerun-if-changed=generate_self_schema.py");
if Path::new("./src/self_schema.py").exists() && option_env!("CI") == Some("true") {
// self_schema.py already exists and CI indicates we're running on a github actions build,
// don't bother generating again
return;
}

let output = Command::new(
env::var("PYTHON")
.ok()
.or_else(|| pyo3_build_config::get().executable.clone())
.unwrap_or_else(|| "python3".to_owned()),
)
.arg("generate_self_schema.py")
.output()
.expect("failed to execute process");

if !output.status.success() {
let stdout = from_utf8(&output.stdout).unwrap();
let stderr = from_utf8(&output.stderr).unwrap();
eprint!("{stdout}{stderr}");
panic!("generate_self_schema.py failed with {}", output.status);
}
}

fn main() {
pyo3_build_config::use_pyo3_cfgs();
if let Some(true) = version_check::supports_feature("coverage_attribute") {
Expand All @@ -44,7 +12,5 @@ fn main() {
println!("cargo:rustc-cfg=specified_profile_use");
}
println!("cargo:rustc-check-cfg=cfg(specified_profile_use)");

generate_self_schema();
println!("cargo:rustc-env=PROFILE={}", std::env::var("PROFILE").unwrap());
}
245 changes: 0 additions & 245 deletions generate_self_schema.py

This file was deleted.

Loading
Loading