Skip to content

Commit dca1a07

Browse files
committed
move pydantic_core into python/pydantic_core to avoid pytest import crash
1 parent f0aac96 commit dca1a07

13 files changed

+7
-7
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ jobs:
453453
pip install -U pip
454454
pip install -r tests/requirements.txt
455455
pip install pydantic-core --no-index --no-deps --find-links pgo-wheel --force-reinstall
456-
cd tests # change directory to avoid importing local pydantic_core source
457456
pytest tests/benchmarks
458457
rustup run stable bash -c '$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata'
459458

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ node_modules/
3434
/*.profdata
3535
/*.profraw
3636
/foobar.py
37-
/pydantic_core/*.so
37+
/python/pydantic_core/*.so
3838
/src/self_schema.py

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ make install
106106

107107
That should be it, the example shown above should now run.
108108

109-
You might find it useful to look at [`pydantic_core/_pydantic_core.pyi`](./pydantic_core/_pydantic_core.pyi) and
110-
[`pydantic_core/core_schema.py`](./pydantic_core/core_schema.py) for more information on the python API,
109+
You might find it useful to look at [`pydantic_core/_pydantic_core.pyi`](./python/pydantic_core/_pydantic_core.pyi) and
110+
[`pydantic_core/core_schema.py`](./python/pydantic_core/core_schema.py) for more information on the python API,
111111
beyond that, [`tests/`](./tests) provide a large number of examples of usage.
112112

113113
If you want to contribute to pydantic-core, you'll want to use some other make commands:

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::process::Command;
44
use std::str::from_utf8;
55

66
fn generate_self_schema() {
7-
println!("cargo:rerun-if-changed=pydantic_core/core_schema.py");
7+
println!("cargo:rerun-if-changed=python/pydantic_core/core_schema.py");
88
println!("cargo:rerun-if-changed=generate_self_schema.py");
99
if Path::new("./src/self_schema.py").exists() && option_env!("CI") == Some("true") {
1010
// self_schema.py already exists and CI indicates we're running on a github actions build,

generate_self_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
else:
3535
# can't import core_schema.py directly as pydantic-core might not be installed
3636
core_schema_spec = importlib.util.spec_from_file_location(
37-
'_typing', str(THIS_DIR / 'pydantic_core' / 'core_schema.py')
37+
'_typing', str(THIS_DIR / 'python' / 'pydantic_core' / 'core_schema.py')
3838
)
3939
core_schema = importlib.util.module_from_spec(core_schema_spec)
4040
core_schema_spec.loader.exec_module(core_schema)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Funding = 'https://github.com/sponsors/samuelcolvin'
4444
Source = 'https://github.com/pydantic/pydantic-core'
4545

4646
[tool.maturin]
47+
python-source = "python"
4748
module-name = "pydantic_core._pydantic_core"
4849
bindings = 'pyo3'
4950
features = ["pyo3/extension-module", "mimalloc-allocator"]
File renamed without changes.
3.75 MB
Binary file not shown.
File renamed without changes.
3.84 MB
Binary file not shown.

0 commit comments

Comments
 (0)