Skip to content

Commit

Permalink
Drop support for python3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Oct 24, 2024
1 parent 4918783 commit 8912627
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 108 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ jobs:
{ interpreter: 'python3.11', package: 'python3.11' },
{ interpreter: 'python3.10', package: 'python3.10' },
{ interpreter: 'python3.9', package: 'python3.9' },
{ interpreter: 'python3.8', package: 'python3.8' },
]
env:
PYTHON: "${{ matrix.python.interpreter }}"
Expand Down Expand Up @@ -247,7 +246,6 @@ jobs:
{ version: '3.11' },
{ version: '3.10' },
{ version: '3.9' },
{ version: '3.8' },
]
platform:
- target: aarch64-unknown-linux-musl
Expand Down Expand Up @@ -322,7 +320,6 @@ jobs:
{ version: '3.11', abi: 'cp311-cp311' },
{ version: '3.10', abi: 'cp310-cp310' },
{ version: '3.9', abi: 'cp39-cp39' },
{ version: '3.8', abi: 'cp38-cp38' },
]
target: [
{
Expand Down Expand Up @@ -465,7 +462,6 @@ jobs:
matrix:
python: [
{ version: '3.9', macosx_target: "10.15" },
{ version: '3.8', macosx_target: "10.15" },
]
env:
CC: "clang"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/debug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
python: [
{ version: '3.13' },
{ version: '3.12' },
{ version: '3.8' },
{ version: '3.9' },
]
env:
CC: "gcc"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
with:
python-version: "3.12"
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable --profile=default -y
- run: pip install -U autoflake isort black ruff mypy types-python-dateutil types-pytz types-simplejson types-ujson
- run: pip install -U ruff mypy types-python-dateutil types-pytz types-simplejson types-ujson

- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ support for 64-bit
* does not provide `load()` or `dump()` functions for reading from/writing to
file-like objects

orjson supports CPython 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14.
orjson supports CPython 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14.

It distributes amd64/x86_64, aarch64/armv8, arm7, POWER/ppc64le, and s390x
wheels for Linux, amd64 and aarch64 wheels for macOS, and amd64
Expand Down
1 change: 0 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ fn main() {
println!("cargo:rustc-check-cfg=cfg(Py_3_12)");
println!("cargo:rustc-check-cfg=cfg(Py_3_13)");
println!("cargo:rustc-check-cfg=cfg(Py_3_14)");
println!("cargo:rustc-check-cfg=cfg(Py_3_8)");
println!("cargo:rustc-check-cfg=cfg(Py_3_9)");
println!("cargo:rustc-check-cfg=cfg(Py_GIL_DISABLED)");

Expand Down
32 changes: 0 additions & 32 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,6 @@ jobs:
- checkout: self
- template: ./azure-win.yml

- job: win_python38_amd64
pool:
vmImage: windows-2022
variables:
interpreter: C:\hostedtoolcache\windows\Python\3.8.10\x64\python.exe
rustup: https://win.rustup.rs/x86_64
target: x86_64-pc-windows-msvc
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8.10'
addToPath: true
architecture: 'x64'
- checkout: self
- template: ./azure-win.yml

- job: win_python313_x86
pool:
vmImage: windows-2022
Expand Down Expand Up @@ -178,19 +162,3 @@ jobs:
architecture: 'x86'
- checkout: self
- template: ./azure-win.yml

- job: win_python38_x86
pool:
vmImage: windows-2022
variables:
interpreter: C:\hostedtoolcache\windows\Python\3.8.10\x86\python.exe
rustup: https://win.rustup.rs/x86
target: i686-pc-windows-msvc
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8.10'
addToPath: true
architecture: 'x86'
- checkout: self
- template: ./azure-win.yml
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "orjson"
repository = "https://github.com/ijl/orjson"
requires-python = ">=3.8"
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -11,7 +11,6 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -42,7 +41,7 @@ include = [

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

[tool.ruff.lint]
select = [
Expand All @@ -57,4 +56,4 @@ ignore = [
known-first-party = ["orjson"]

[tool.mypy]
python_version = "3.8"
python_version = "3.9"
2 changes: 0 additions & 2 deletions src/ffi/fragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ pub unsafe extern "C" fn orjson_fragmenttype_new() -> *mut PyTypeObject {
tp_vectorcall: None,
tp_version_tag: 0,
tp_weaklist: null_mut(),
#[cfg(not(Py_3_9))]
tp_print: None,
tp_vectorcall_offset: 0,
tp_getattr: None,
tp_setattr: None,
Expand Down
16 changes: 3 additions & 13 deletions src/serialize/per_type/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use crate::serialize::error::SerializeError;
use crate::serialize::per_type::datetimelike::{
DateTimeBuffer, DateTimeError, DateTimeLike, Offset,
};
#[cfg(Py_3_9)]
use crate::typeref::ZONEINFO_TYPE;
use crate::typeref::{CONVERT_METHOD_STR, DST_STR, NORMALIZE_METHOD_STR, UTCOFFSET_METHOD_STR};
use crate::typeref::{
CONVERT_METHOD_STR, DST_STR, NORMALIZE_METHOD_STR, UTCOFFSET_METHOD_STR, ZONEINFO_TYPE,
};
use serde::ser::{Serialize, Serializer};

macro_rules! write_double_digit {
Expand Down Expand Up @@ -203,7 +203,6 @@ impl DateTimeLike for DateTime {
}
}

#[cfg(Py_3_9)]
fn offset(&self) -> Result<Offset, DateTimeError> {
if !self.has_tz() {
Ok(Offset::default())
Expand All @@ -223,15 +222,6 @@ impl DateTimeLike for DateTime {
}
}
}

#[cfg(not(Py_3_9))]
fn offset(&self) -> Result<Offset, DateTimeError> {
if !self.has_tz() {
Ok(Offset::default())
} else {
self.slow_offset()
}
}
}

impl Serialize for DateTime {
Expand Down
8 changes: 1 addition & 7 deletions src/typeref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pub static mut FRAGMENT_TYPE: *mut PyTypeObject = null_mut();

pub static mut NUMPY_TYPES: OnceBox<Option<NonNull<NumpyTypes>>> = OnceBox::new();

#[cfg(Py_3_9)]
pub static mut ZONEINFO_TYPE: *mut PyTypeObject = null_mut();

pub static mut UTCOFFSET_METHOD_STR: *mut PyObject = null_mut();
Expand Down Expand Up @@ -172,11 +171,7 @@ fn _init_typerefs_impl() -> bool {
UUID_TYPE = look_up_uuid_type();
ENUM_TYPE = look_up_enum_type();
FIELD_TYPE = look_up_field_type();

#[cfg(Py_3_9)]
{
ZONEINFO_TYPE = look_up_zoneinfo_type();
}
ZONEINFO_TYPE = look_up_zoneinfo_type();

INT_ATTR_STR = PyUnicode_InternFromString("int\0".as_ptr() as *const c_char);
UTCOFFSET_METHOD_STR = PyUnicode_InternFromString("utcoffset\0".as_ptr() as *const c_char);
Expand Down Expand Up @@ -334,7 +329,6 @@ unsafe fn look_up_time_type() -> *mut PyTypeObject {
ptr
}

#[cfg(Py_3_9)]
#[cold]
#[cfg_attr(feature = "optimize", optimize(size))]
unsafe fn look_up_zoneinfo_type() -> *mut PyTypeObject {
Expand Down
24 changes: 0 additions & 24 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ macro_rules! ffi {
};
}

#[cfg(Py_3_9)]
macro_rules! call_method {
($obj1:expr, $obj2:expr) => {
unsafe { pyo3_ffi::PyObject_CallMethodNoArgs($obj1, $obj2) }
Expand All @@ -152,29 +151,6 @@ macro_rules! call_method {
};
}

#[cfg(not(Py_3_9))]
macro_rules! call_method {
($obj1:expr, $obj2:expr) => {
unsafe {
pyo3_ffi::PyObject_CallMethodObjArgs(
$obj1,
$obj2,
core::ptr::null_mut() as *mut pyo3_ffi::PyObject,
)
}
};
($obj1:expr, $obj2:expr, $obj3:expr) => {
unsafe {
pyo3_ffi::PyObject_CallMethodObjArgs(
$obj1,
$obj2,
$obj3,
core::ptr::null_mut() as *mut pyo3_ffi::PyObject,
)
}
};
}

macro_rules! str_hash {
($op:expr) => {
unsafe { (*$op.cast::<pyo3_ffi::PyASCIIObject>()).hash }
Expand Down
2 changes: 0 additions & 2 deletions test/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ pytest
pytest-random-order
pytest-xdist
pytz
typing_extensions;python_version<"3.8"
xxhash==1.4.3;sys_platform=="linux" and platform_machine=="x86_64" and python_version<"3.9" # creates non-compact ASCII for test_str_ascii
16 changes: 0 additions & 16 deletions test/test_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

import pytest

try:
import xxhash
except ImportError:
xxhash = None

import orjson


Expand Down Expand Up @@ -260,17 +255,6 @@ def test_str_surrogates_dumps(self):
orjson.JSONEncodeError, orjson.dumps, b"\xed\xa0\xbd\xed\xba\x80"
) # \ud83d\ude80

@pytest.mark.skipif(
xxhash is None, reason="xxhash install broken on win, python3.9, Azure"
)
def test_str_ascii(self):
"""
str is ASCII but not compact
"""
digest = xxhash.xxh32_hexdigest("12345")
for _ in range(2):
assert orjson.dumps(digest) == b'"b30d56b4"'

def test_bytes_dumps(self):
"""
bytes dumps not supported
Expand Down

0 comments on commit 8912627

Please sign in to comment.