Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:

all_tests_passed:
runs-on: ubuntu-latest
name: All tests passed
name: All wheels built
needs: [build_sdist, build_wheels]
if: always()
steps:
Expand Down
10 changes: 9 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ Changes
yggdrasil-python-rapidjson
==========================

1.21.0.2 (2026-07-09)
1.23.0.1 (2026-07-10)
~~~~~~~~~~~~~~~~~~~~~

* Updated README
* Updated version in this change log to reflect inclusion of upstream changes
* Added YggdrasilRapidJSONTools.cmake for building against local yggdrasil-rapidjson during development

1.23.0.0 (2026-07-09)
~~~~~~~~~~~~~~~~~~~~~

This update includes some package maintenance and dependency updates.

* Merge upstream changes from python-rapidjson 1.23
* Drop support for Python 3.9
* Update the conda recipe to use the yggdrasil-rapidjson version
* Update CMakeLists.txt to fetch yggdrasil-rapidjson via git and use the updated yggdrasil-rapidjson package configuration
Expand Down
54 changes: 10 additions & 44 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,57 +32,23 @@ endif()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(YGGDRASIL_RAPIDJSON_PYTHON_WRAPPER ON)
set(YGGDRASIL_RAPIDJSON_CLONE_IF_MISSING ON)

find_package(
Python3 COMPONENTS
Interpreter Development.Module NumPy REQUIRED
)
if (Python3_VERSION VERSION_LESS "3.9.0")
message(FATAL_ERROR "Only Python 3.9+ is supported.")
if (Python3_VERSION VERSION_LESS "3.10.0")
message(FATAL_ERROR "Only Python 3.10+ is supported.")
endif()

set(YGGDRASIL_RAPIDJSON_REPO_DIR "" CACHE PATH "Existing directory containing the yggdrasil-rapidjson repository")

if(NOT YGGDRASIL_RAPIDJSON_REPO_DIR)
find_package(YggdrasilRapidJSON)
endif()
if(YggdrasilRapidJSON_FOUND)
message(STATUS "Using YggdrasilRapidJSON installation at \"${YggdrasilRapidJSON_DIR}\"")
else()
foreach(suffix BUILD_EXAMPLES BUILD_TESTS BUILD_DOC)
if(NOT YGGDRASIL_RAPIDJSON_${suffix})
set(YGGDRASIL_RAPIDJSON_${suffix} OFF)
endif()
endforeach()
if(YGGDRASIL_RAPIDJSON_REPO_DIR AND EXISTS "${YGGDRASIL_RAPIDJSON_REPO_DIR}")
message(STATUS "Installing YggdrasilRapidJSON from \"${YGGDRASIL_RAPIDJSON_REPO_DIR}\"")
add_subdirectory(
"${YGGDRASIL_RAPIDJSON_REPO_DIR}"
"${YGGDRASIL_RAPIDJSON_REPO_DIR}/_build_for_pyrj"
EXCLUDE_FROM_ALL
)
include("${YGGDRASIL_RAPIDJSON_REPO_DIR}/YggdrasilRapidJSONMacros.cmake")
else()
message(WARNING "Could not locate the YggdrasilRapidJSON package via find_package, installing as an external project...")
include(FetchContent)
FetchContent_Declare(
YggdrasilRapidJSON
GIT_REPOSITORY https://github.com/cropsinsilico/yggdrasil-rapidjson.git
GIT_TAG origin/yggdrasil
EXCLUDE_FROM_ALL
OVERRIDE_FIND_PACKAGE
)
# Required for cmake <3.28 when EXCLUDE_FROM_ALL was added to FetchContent_Declare
find_package(YggdrasilRapidJSON)
include(${yggdrasilrapidjson_SOURCE_DIR}/YggdrasilRapidJSONMacros.cmake)
set_property(
DIRECTORY ${yggdrasilrapidjson_SOURCE_DIR}
PROPERTY EXCLUDE_FROM_ALL ON
)
endif()
yggdrasil_rapidjson_options_config(LOCAL)
yggdrasil_rapidjson_target_config(YggdrasilRapidJSON INTERFACE LOCAL)
endif()
file(
DOWNLOAD
"https://raw.githubusercontent.com/cropsinsilico/yggdrasil-rapidjson/refs/heads/yggdrasil/YggdrasilRapidJSONTools.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/YggdrasilRapidJSONTools.cmake"
)
include("${CMAKE_CURRENT_SOURCE_DIR}/YggdrasilRapidJSONTools.cmake")
find_yggdrasil_rapidjson()
yggdrasil_rapidjson_global_compiler_flags(CXX)

set(PYRJ_TARGET "yggdrasil_python_rapidjson")
Expand Down
27 changes: 14 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ First install ``yggdrasil-python-rapidjson``:

$ pip install yggdrasil-python-rapidjson

or, if you prefer `Conda <https://conda.io/docs/>`_:
or, if you prefer `Conda <https://conda.io/docs/>`_ (NOTE: the conda-forge feedstock for ``yggdrasil-python-rapidjson`` is not yet available, but will be once the PR is merged):

.. code-block:: bash

Expand Down Expand Up @@ -62,25 +62,26 @@ enhancements) you may clone the repository:

.. code-block:: bash

$ git clone --recursive https://github.com/cropsinsilico/yggdrasil-python-rapidjson.git
$ git clone https://github.com/cropsinsilico/yggdrasil-python-rapidjson.git

.. note:: The ``--recursive`` option is needed because we use a *submodule* to
include YggdrasilRapidJSON_ sources. Alternatively you can do a plain
``clone`` immediately followed by a ``git submodule update --init``.
The package can be built and installed from source via

Alternatively, if you already have (a *compatible* version of)
YggdrasilRapidJSON includes around, you can compile the module specifying
their location with the option ``--config-settings=cmake.define.RAPIDJSON_INCLUDE_DIRS=``, for example:
.. code-block:: bash

.. code-block:: shell
$ pip install .

$ pip install . --config-settings=cmake.define.RAPIDJSON_INCLUDE_DIRS=/usr/include/rapidjson
.. note:: The install command will clone a copy of the YggdrasilRapidJSON_
sources as part of the build process if an existing
YggdrasilRapidJSON installation cannot be found (in the usual
locations checked by cmake for your OS).

The package can be built and installed from source via
Alternatively, if you already have a (*compatible*) local copy of the
YggdrasilRapidJSON repository around, you can compile the module specifying
their location with the option ``--config-settings=cmake.define.YGGDRASIL_RAPIDJSON_REPO_DIR=``, for example:

.. code-block:: bash
.. code-block:: shell

$ pip install .
$ pip install . --config-settings=cmake.define.YGGDRASIL_RAPIDJSON_REPO_DIR=/usr/local/yggdrasil-rapidjson

The package tests and doctests can be run via pytest

Expand Down
150 changes: 150 additions & 0 deletions YggdrasilRapidJSONTools.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# This file contains some useful macros for use by packages using
# yggdrasil-rapidjson as a dependency via find_package

macro(include_yggdrasil_rapidjson_macros)
if(POLICY CMP0169)
# Allows FetchContent_Populate to be called directly so that the
# macros from a YggdrasilRapidJSON repository can be used without
# including the subdirectory and initializing the YggdrasilRapidJSON
# target with properties based on current option values
cmake_policy(SET CMP0169 OLD)
endif()
if(NOT COMMAND yggdrasil_rapidjson_options)
option(YGGDRASIL_RAPIDJSON_CLONE_IF_MISSING "Clone the YggdrasilRapidJSON library from GitHub if it cannot be located locally" OFF)
set(YGGDRASIL_RAPIDJSON_REPO_DIR "" CACHE PATH "Existing directory containing the yggdrasil-rapidjson repository")
set(YGGDRASIL_RAPIDJSON_REPO_BUILD_DIR "")
set(YGGDRASIL_RAPIDJSON_MACROS_FILE "")

if(YggdrasilRapidJSON_FOUND)
message(FATAL_ERROR "YggdrasilRapidJSON_FOUND, but yggdrasil_rapidjson_options not defined")
elseif(NOT YGGDRASIL_RAPIDJSON_REPO_DIR)
if(WIN32)
set(YGGDRASIL_RAPIDJSON_CONFIG_FILE_PATH_SUFFIXES "Library/cmake")
else()
set(YGGDRASIL_RAPIDJSON_CONFIG_FILE_PATH_SUFFIXES "lib/cmake/YggdrasilRapidJSON")
endif()
find_file(
YGGDRASIL_RAPIDJSON_CONFIG_FILE
YggdrasilRapidJSONConfig.cmake
PATHS "${YggdrasilRapidJSON_DIR}"
PATH_SUFFIXES "${YGGDRASIL_RAPIDJSON_CONFIG_FILE_PATH_SUFFIXES}"
)
unset(YGGDRASIL_RAPIDJSON_CONFIG_FILE_PATH_SUFFIXES)
if(YGGDRASIL_RAPIDJSON_CONFIG_FILE)
message(DEBUG "Located YggdrasilRapidJSON config file at ${YGGDRASIL_RAPIDJSON_CONFIG_FILE}")
cmake_path(
GET YGGDRASIL_RAPIDJSON_CONFIG_FILE
PARENT_PATH YGGDRASIL_RAPIDJSON_MACROS_FILE
)
cmake_path(
APPEND YGGDRASIL_RAPIDJSON_MACROS_FILE
YggdrasilRapidJSONMacros.cmake
)
else()
find_file(
YGGDRASIL_RAPIDJSON_CONFIG_FILE
YggdrasilRapidJSONConfig.cmake.in
PATHS "${YggdrasilRapidJSON_DIR}"
)
if(YGGDRASIL_RAPIDJSON_CONFIG_FILE)
message(DEBUG "Located YggdrasilRapidJSON config template file at ${YGGDRASIL_RAPIDJSON_CONFIG_FILE}")
cmake_path(
GET YGGDRASIL_RAPIDJSON_CONFIG_FILE
PARENT_PATH YGGDRASIL_RAPIDJSON_REPO_DIR
)
endif()
endif()
unset(YGGDRASIL_RAPIDJSON_CONFIG_FILE)
endif()
if(YGGDRASIL_RAPIDJSON_REPO_DIR)
if(NOT EXISTS "${YGGDRASIL_RAPIDJSON_REPO_DIR}")
message(FATAL_ERROR "Directory specified by option YGGDRASIL_RAPIDJSON_REPO_DIR=\"${YGGDRASIL_RAPIDJSON_REPO_DIR}\" does not exist")
endif()
if(NOT IS_ABSOLUTE "${YGGDRASIL_RAPIDJSON_REPO_DIR}")
cmake_path(
ABSOLUTE_PATH YGGDRASIL_RAPIDJSON_REPO_DIR
NORMALIZE
)
endif()
include(FetchContent)
FetchContent_Declare(
YggdrasilRapidJSON
SOURCE_DIR "${YGGDRASIL_RAPIDJSON_REPO_DIR}"
EXCLUDE_FROM_ALL
OVERRIDE_FIND_PACKAGE
)
FetchContent_Populate(YggdrasilRapidJSON)
cmake_path(
APPEND YGGDRASIL_RAPIDJSON_REPO_DIR "_build_for_${PROJECT_NAME}"
OUTPUT_VARIABLE YGGDRASIL_RAPIDJSON_REPO_BUILD_DIR
)
elseif(NOT YGGDRASIL_RAPIDJSON_MACROS_FILE)
if(YGGDRASIL_RAPIDJSON_CLONE_IF_MISSING)
set(YGGDRASIL_RAPIDJSON_CLONE_MSG_LEVEL WARNING)
else()
set(YGGDRASIL_RAPIDJSON_CLONE_MSG_LEVEL FATAL_ERROR)
endif()
message(
${YGGDRASIL_RAPIDJSON_CLONE_MSG_LEVEL}
"Could not locate the YggdrasilRapidJSON package via find_file (YggdrasilRapidJSON_DIR=${YggdrasilRapidJSON_DIR}), importing it from github as an external project..."
)
unset(YGGDRASIL_RAPIDJSON_CLONE_MSG_LEVEL)
include(FetchContent)
FetchContent_Declare(
YggdrasilRapidJSON
GIT_REPOSITORY https://github.com/cropsinsilico/yggdrasil-rapidjson.git
GIT_TAG origin/yggdrasil
EXCLUDE_FROM_ALL
OVERRIDE_FIND_PACKAGE
)
FetchContent_Populate(YggdrasilRapidJSON)
set(YGGDRASIL_RAPIDJSON_REPO_DIR "${yggdrasilrapidjson_SOURCE_DIR}")
set(YGGDRASIL_RAPIDJSON_REPO_BUILD_DIR "${yggdrasilrapidjson_BINARY_DIR}")
endif()
if(NOT YGGDRASIL_RAPIDJSON_MACROS_FILE)
cmake_path(
APPEND YGGDRASIL_RAPIDJSON_REPO_DIR
YggdrasilRapidJSONMacros.cmake
OUTPUT_VARIABLE YGGDRASIL_RAPIDJSON_MACROS_FILE
)
endif()
message(STATUS "Including YggdrasilRapidJSON macros from \"${YGGDRASIL_RAPIDJSON_MACROS_FILE}\" (REPO_DIR=${YGGDRASIL_RAPIDJSON_REPO_DIR})")
include("${YGGDRASIL_RAPIDJSON_MACROS_FILE}")
endif()
endmacro()

macro(find_yggdrasil_rapidjson)
include_yggdrasil_rapidjson_macros()
if(YGGDRASIL_RAPIDJSON_REPO_DIR)
# TODO: Move this into a generated dummy config file that can be
# used by find_package
foreach(suffix BUILD_EXAMPLES BUILD_TESTS BUILD_DOC)
if(NOT YGGDRASIL_RAPIDJSON_${suffix})
set(YGGDRASIL_RAPIDJSON_${suffix} OFF)
endif()
endforeach()
add_subdirectory(
"${YGGDRASIL_RAPIDJSON_REPO_DIR}"
"${YGGDRASIL_RAPIDJSON_REPO_BUILD_DIR}"
EXCLUDE_FROM_ALL
)
# Required for cmake <3.28 when EXCLUDE_FROM_ALL was added to
# FetchContent_Declare
set_property(
DIRECTORY "${YGGDRASIL_RAPIDJSON_REPO_DIR}"
PROPERTY EXCLUDE_FROM_ALL ON
)
set(YggdrasilRapidJSON_VERSION "${YGGDRASIL_RAPIDJSON_VERSION}")
cmake_path(
APPEND YGGDRASIL_RAPIDJSON_REPO_DIR "include"
OUTPUT_VARIABLE YggdrasilRapidJSON_INCLUDE_DIRS
)
if(YggdrasilRapidJSON_VERSION VERSION_LESS "1.1.0.6")
yggdrasil_rapidjson_options_config(LOCAL)
yggdrasil_rapidjson_target_config(YggdrasilRapidJSON INTERFACE LOCAL)
endif()
else()
find_package(YggdrasilRapidJSON REQUIRED)
endif()

endmacro()
5 changes: 2 additions & 3 deletions conda.recipe/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
context:
name: "yggdrasil-python-rapidjson"
python_name: "yggdrasil_python_rapidjson"
version: "1.23.0.0"
version: "1.23.0.1"

package:
name: ${{ name|lower }}
Expand Down Expand Up @@ -33,7 +32,7 @@ requirements:
- ${{ stdlib('c') }}
- ${{ compiler('c') }}
- ${{ compiler('cxx') }}
- yggdrasil-rapidjson
- yggdrasil-rapidjson >=1.1.0.5
host:
- hatch-fancy-pypi-readme
- numpy
Expand Down
Loading