Skip to content

Commit

Permalink
cargo update, build and tooling misc
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Nov 29, 2023
1 parent 399b36a commit 767960b
Show file tree
Hide file tree
Showing 34 changed files with 93 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/debug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
matrix:
rust: [
{ version: "1.65" }, # MSRV
{ version: "nightly-2023-10-10" },
{ version: "nightly-2023-11-15" },
]
python: [
{ version: '3.12', abi: 'cp312-cp312' },
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ jobs:
CC: "clang"
CFLAGS: "-O2 -fno-plt -flto=thin"
LDFLAGS: "-O2 -flto=thin -fuse-ld=lld -Wl,--as-needed"
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld"
RUSTFLAGS: "-C linker=clang -C linker-plugin-lto -C link-arg=-fuse-ld=lld -D warnings"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
container:
image: quay.io/pypa/manylinux_2_28_x86_64:latest
options: --user 0
steps:
- run: yum install -y clang lld
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2023-10-10 --profile minimal -y
- run: rustup component add rust-src --toolchain nightly-2023-10-10-x86_64-unknown-linux-gnu
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2023-11-15 --profile minimal -y
- run: rustup component add rust-src --toolchain nightly-2023-11-15-x86_64-unknown-linux-gnu
- uses: actions/checkout@v4

- name: build-std
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
RUSTFLAGS: "-C target-feature=-crt-static"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
with:
rust-toolchain: nightly-2023-10-10
rust-toolchain: nightly-2023-11-15
rustup-components: rust-src
target: ${{ matrix.platform.target }}
manylinux: musllinux_1_1
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
with:
target: ${{ matrix.target.target }}
rust-toolchain: nightly-2023-10-10
rust-toolchain: nightly-2023-11-15
rustup-components: rust-src
manylinux: auto
args: --release --strip --out=dist --features=no-panic,yyjson -i python${{ matrix.python.version }}
Expand Down
40 changes: 20 additions & 20 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ It benefits from also having a C build environment to compile a faster
deserialization backend. See this project's `manylinux_2_28` builds for an
example using clang and LTO.

The project's own CI tests against `nightly-2023-10-10` and stable 1.65. It
The project's own CI tests against `nightly-2023-11-15` and stable 1.65. It
is prudent to pin the nightly version because that channel can introduce
breaking changes.

Expand Down
4 changes: 0 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ fn main() {
println!("cargo:rustc-cfg=feature=\"strict_provenance\"");
}

if let Some(true) = version_check::supports_feature("trusted_len") {
println!("cargo:rustc-cfg=feature=\"trusted_len\"");
}

if env::var("ORJSON_DISABLE_YYJSON").is_ok() {
if env::var("CARGO_FEATURE_YYJSON").is_ok() {
panic!("ORJSON_DISABLE_YYJSON and --features=yyjson both enabled.")
Expand Down
2 changes: 1 addition & 1 deletion ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variables:
toolchain: nightly-2023-10-10
toolchain: nightly-2023-11-15

jobs:

Expand Down
4 changes: 2 additions & 2 deletions integration/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from datetime import datetime
from datetime import datetime, timezone
from uuid import uuid4

from flask import Flask
Expand All @@ -9,7 +9,7 @@

app = Flask(__name__)

NOW = datetime.utcnow()
NOW = datetime.now(timezone.utc)


@app.route("/")
Expand Down
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,21 @@ include = [
{ format = "sdist", path = "include/**/*" },
]


[tool.black]
line-length = 88
target-version = ["py38"]
include = ".pyi?$"

[tool.ruff]
line-length = 88
target-version = "py38"

select = [
"I",
]

ignore = [
"E501", # line too long
"F601", # Dictionary key literal ... repeated
]

[tool.ruff.lint.isort]
known-first-party = ["orjson"]

[tool.mypy]
python_version = "3.8"
3 changes: 0 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
-r bench/requirements.txt
-r integration/requirements.txt
-r test/requirements.txt
autoflake
black
isort
maturin
mypy
ruff
Expand Down
2 changes: 1 addition & 1 deletion script/develop
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rm -f target/wheels/*
export CC="clang"
export CFLAGS="-O2 -fno-plt -flto=thin"
export LDFLAGS="${CFLAGS} -fuse-ld=lld -Wl,--as-needed"
export RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=lld"
export RUSTFLAGS="-C linker=clang -C linker-plugin-lto -C link-arg=-fuse-ld=lld -D warnings"

maturin build "$@"

Expand Down
4 changes: 1 addition & 3 deletions script/lint
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ to_lint="./bench/*.py ./pysrc/orjson/__init__.pyi ./test/*.py script/pydataclass
script/pysort script/pynumpy script/pynonstr script/pycorrectness script/graph integration/init
integration/wsgi.py integration/typestubs.py integration/thread"

autoflake --in-place --recursive --remove-all-unused-imports --ignore-init-module-imports .
isort ${to_lint}
ruff ${to_lint} --fix
black ${to_lint}
ruff format ${to_lint}
mypy --ignore-missing-imports --check-untyped-defs ./bench/*.py ./pysrc/orjson/__init__.pyi ./test/*.py
4 changes: 1 addition & 3 deletions script/pynumpy
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ elif kind == "int32":
elif kind == "uint8":
array = numpy.random.randint(((2**8) - 1), size=(100000, 100), dtype=numpy.uint8)
elif kind == "uint16":
array = numpy.random.randint(
((2**16) - 1), size=(100000, 100), dtype=numpy.uint16
)
array = numpy.random.randint(((2**16) - 1), size=(100000, 100), dtype=numpy.uint16)
else:
print("usage: pynumpy (bool|int16|int32|float64|int8|uint8|uint16)")
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion src/deserialize/cache.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

use crate::typeref::*;
use crate::typeref::HASH_BUILDER;
use associative_cache::replacement::RoundRobinReplacement;
use associative_cache::*;
use once_cell::unsync::OnceCell;
Expand Down
2 changes: 1 addition & 1 deletion src/deserialize/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::deserialize::utf8::read_input_to_buf;
use crate::deserialize::DeserializeError;
use crate::typeref::*;
use crate::typeref::EMPTY_UNICODE;
use std::ptr::NonNull;

pub fn deserialize(
Expand Down
2 changes: 1 addition & 1 deletion src/deserialize/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::deserialize::pyobject::*;
use crate::deserialize::DeserializeError;
use crate::str::*;
use crate::str::unicode_from_str;
use serde::de::{self, DeserializeSeed, Deserializer, MapAccess, SeqAccess, Visitor};
use smallvec::SmallVec;
use std::borrow::Cow;
Expand Down
4 changes: 2 additions & 2 deletions src/deserialize/pyobject.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

use crate::deserialize::cache::*;
use crate::str::*;
use crate::typeref::*;
use crate::str::{hash_str, unicode_from_str};
use crate::typeref::{EMPTY_UNICODE, FALSE, NONE, TRUE};
use std::ptr::NonNull;

pub fn get_unicode_key(key_str: &str) -> *mut pyo3_ffi::PyObject {
Expand Down
4 changes: 2 additions & 2 deletions src/deserialize/utf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use crate::deserialize::DeserializeError;
use crate::ffi::*;
use crate::str::*;
use crate::typeref::*;
use crate::str::unicode_to_str;
use crate::typeref::{BYTEARRAY_TYPE, BYTES_TYPE, MEMORYVIEW_TYPE, STR_TYPE};
use crate::util::INVALID_STR;
use std::borrow::Cow;
use std::os::raw::c_char;
Expand Down
7 changes: 2 additions & 5 deletions src/deserialize/yyjson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use crate::deserialize::pyobject::*;
use crate::deserialize::DeserializeError;
use crate::ffi::yyjson::*;
use crate::str::*;
use crate::typeref::*;
use crate::str::unicode_from_str;
use crate::typeref::{yyjson_init, YYJSON_ALLOC, YYJSON_BUFFER_SIZE};
use std::borrow::Cow;
use std::os::raw::c_char;
use std::ptr::{null, null_mut, NonNull};
Expand Down Expand Up @@ -164,10 +164,7 @@ fn parse_yy_object(elem: *mut yyjson_val) -> NonNull<pyo3_ffi::PyObject> {
return nonnull!(ffi!(PyDict_New()));
}
let mut key = unsafe_yyjson_get_first(elem);
#[cfg(not(Py_3_13))]
let dict = ffi!(_PyDict_NewPresized(len as isize));
#[cfg(Py_3_13)]
let dict = ffi!(PyDict_New());
for _ in 0..=len - 1 {
let val = key.add(1);
let key_str = str_from_slice!((*key).uni.str_ as *const u8, unsafe_yyjson_get_len(key));
Expand Down
44 changes: 0 additions & 44 deletions src/ffi/list.rs

This file was deleted.

Loading

0 comments on commit 767960b

Please sign in to comment.