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 Dec 14, 2023
1 parent 399b36a commit 32d9b85
Show file tree
Hide file tree
Showing 38 changed files with 128 additions and 191 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-12-10" },
]
python: [
{ version: '3.12', abi: 'cp312-cp312' },
Expand Down
34 changes: 19 additions & 15 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ jobs:
env:
PATH: /github/home/.local/bin:/github/home/.cargo/bin:/opt/python/${{ matrix.python.abi }}/bin:/opt/rh/gcc-toolset-12/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
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"
CFLAGS: "-O2 -fno-plt -foffload-lto=thin -fstrict-aliasing"
LDFLAGS: "-O2 -fno-plt -foffload-lto=thin -fstrict-aliasing -fuse-ld=lld -Wl,--as-needed"
RUSTFLAGS: "-C linker=clang -C linker-plugin-lto -C lto=thin -C link-arg=-fuse-ld=lld -Z mir-opt-level=4 -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-12-10 --profile minimal -y
- run: rustup component add rust-src --toolchain nightly-2023-12-10-x86_64-unknown-linux-gnu
- uses: actions/checkout@v4

- name: build-std
Expand Down Expand Up @@ -140,10 +140,10 @@ jobs:
CC: "gcc"
CFLAGS: "-O2 -fno-plt"
LDFLAGS: "-O2 -flto -Wl,--as-needed"
RUSTFLAGS: "-C target-feature=-crt-static"
RUSTFLAGS: "-C target-feature=-crt-static -Z mir-opt-level=4"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
with:
rust-toolchain: nightly-2023-10-10
rust-toolchain: nightly-2023-12-10
rustup-components: rust-src
target: ${{ matrix.platform.target }}
manylinux: musllinux_1_1
Expand All @@ -153,7 +153,7 @@ jobs:
if: matrix.platform.arch != 'x86_64'
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:qemu-v7.0.0
image: tonistiigi/binfmt:qemu-v8.0.4
platforms: ${{ matrix.platform.platform }}

- name: Test
Expand Down Expand Up @@ -195,27 +195,30 @@ jobs:
{
arch: 'aarch64',
target: 'aarch64-unknown-linux-gnu',
cflags: '-O2',
cflags: '-O2 -flto',
rustflags: '-Z mir-opt-level=4 -D warnings',
},
{
arch: 'armv7',
target: 'armv7-unknown-linux-gnueabihf',
cflags: '-Os -fstrict-aliasing',
cflags: '-Os -flto -fstrict-aliasing',
rustflags: '-C opt-level=s -Z mir-opt-level=4 -D warnings',
},
{
arch: 'ppc64le',
target: 'powerpc64le-unknown-linux-gnu',
cflags: '-O2',
cflags: '-O2 -flto',
rustflags: '-Z mir-opt-level=4 -D warnings',
},
{
arch: 's390x',
target: 's390x-unknown-linux-gnu',
cflags: '-O2 -march=z10',
cflags: '-O2 -flto -march=z10',
rustflags: '-Z mir-opt-level=4 -C target-cpu=z10 -Z tune-cpu=generic -D warnings',
},
]
steps:
- uses: actions/checkout@v4

- name: build-std
run: |
mkdir .cargo
Expand All @@ -226,11 +229,12 @@ jobs:
env:
PYO3_CROSS_LIB_DIR: "/opt/python/${{ matrix.python.abi }}"
CFLAGS: "${{ matrix.target.cflags }}"
LDFLAGS: "${{ matrix.target.cflags }} -flto -Wl,--as-needed"
LDFLAGS: "${{ matrix.target.cflags }} -Wl,--as-needed"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
RUSTFLAGS: "${{ matrix.target.rustflags }}"
with:
target: ${{ matrix.target.target }}
rust-toolchain: nightly-2023-10-10
rust-toolchain: nightly-2023-12-10
rustup-components: rust-src
manylinux: auto
args: --release --strip --out=dist --features=no-panic,yyjson -i python${{ matrix.python.version }}
Expand Down
52 changes: 26 additions & 26 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,9 @@ library handles a combined 342 JSON fixtures from the
| Library | Invalid JSON documents not rejected | Valid JSON documents not deserialized |
|------------|---------------------------------------|-----------------------------------------|
| orjson | 0 | 0 |
| ujson | 38 | 0 |
| ujson | 31 | 0 |
| rapidjson | 6 | 0 |
| simplejson | 13 | 0 |
| simplejson | 10 | 0 |
| json | 17 | 0 |

This shows that all libraries deserialize valid JSON but only orjson
Expand Down 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-12-10` 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
9 changes: 5 additions & 4 deletions ci/azure-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ steps:
maturin build --release --strip --features=no-panic,yyjson --interpreter $(interpreter) --target=universal2-apple-darwin
env:
CC: "clang"
LDFLAGS: "-O2 -flto=thin -fuse-ld=lld -Wl,--as-needed"
CFLAGS: "-O2 -fno-plt -flto=thin"
CFLAGS_x86_64_apple_darwin: "-O2 -fno-plt -flto=thin -march=x86-64-v2 -mtune=generic"
CFLAGS_aarch64_apple_darwin: "-O2 -fno-plt -flto=thin -mcpu=apple-m1 -mtune=generic"
CFLAGS: "-O2 -fno-plt -flto=thin -fstrict-aliasing"
LDFLAGS: "-O2 -fno-plt -flto=thin -fstrict-aliasing -Wl,--as-needed"
CFLAGS_x86_64_apple_darwin: "-O2 -fno-plt -flto=thin -fstrict-aliasing -march=x86-64-v2 -mtune=generic"
CFLAGS_aarch64_apple_darwin: "-O2 -fno-plt -flto=thin -fstrict-aliasing -mcpu=apple-m1 -mtune=generic"
RUSTFLAGS: "-C linker=clang -C linker-plugin-lto -C lto=thin -Z mir-opt-level=4 -D warnings"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
displayName: build universal2

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-12-10

jobs:

Expand Down
7 changes: 0 additions & 7 deletions ci/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,3 @@ rustflags = ["-C", "target-cpu=x86-64-v2", "-Z", "tune-cpu=generic"]
[target.aarch64-apple-darwin]
linker = "clang"
rustflags = ["-C", "target-cpu=apple-m1"]

[target.armv7-unknown-linux-gnueabihf]
rustflags = ["-C", "opt-level=s"]

[target.s390x-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "target-cpu=z10", "-Z", "tune-cpu=generic"]
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
4 changes: 2 additions & 2 deletions script/develop
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
rm -f target/wheels/*

export CC="clang"
export CFLAGS="-O2 -fno-plt -flto=thin"
export CFLAGS="-O2 -fno-plt -foffload-lto=thin -fstrict-aliasing"
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 lto=thin -C link-arg=-fuse-ld=lld -Z mir-opt-level=4"

maturin build "$@"

Expand Down
Loading

0 comments on commit 32d9b85

Please sign in to comment.