Skip to content
Merged
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
33 changes: 0 additions & 33 deletions .github/workflows/enscripten.yaml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This is a format job. Pre-commit has a first-party GitHub action, so we use
# that: https://github.com/pre-commit/action

name: Format

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
2 changes: 1 addition & 1 deletion .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["3.9", "3.13", "pypy-3.10"]
python-version: ["3.9", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jobs:
env:
CIBW_ENABLE: cpython-prerelease
CIBW_ARCHS_WINDOWS: auto ARM64
CIBW_SKIP: pp* *i686
CIBW_TEST_SKIP: "*macosx* *win* *aarch64"

- name: Verify clean directory
run: git diff --exit-code
Expand Down Expand Up @@ -97,3 +99,4 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ project(
VERSION ${SKBUILD_PROJECT_VERSION}
LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
# Find the module development requirements (requires FindPython from 3.17 or
# scikit-build-core's built-in backport)
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
Expand Down
91 changes: 2 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,92 +1,5 @@
# jsoncons

[![Gitter][gitter-badge]][gitter-link]
I'm using this [jsoncon](https://github.com/danielaparker/jsoncon) python binding to filter & transform json data.

| CI | status |
|----------------------|--------|
| conda.recipe | [![Conda Actions Status][actions-conda-badge]][actions-conda-link] |
| pip builds | [![Pip Actions Status][actions-pip-badge]][actions-pip-link] |


An example project built with [pybind11][] and [scikit-build-core][]. Python
3.9+ (see older commits for 3.7+, or even older versions of Python using [scikit-build (classic)][]).


[gitter-badge]: https://badges.gitter.im/pybind/Lobby.svg
[gitter-link]: https://gitter.im/pybind/Lobby
[actions-badge]: https://github.com/pybind/jsoncons/workflows/Tests/badge.svg
[actions-conda-link]: https://github.com/pybind/jsoncons/actions?query=workflow%3AConda
[actions-conda-badge]: https://github.com/pybind/jsoncons/workflows/Conda/badge.svg
[actions-pip-link]: https://github.com/pybind/jsoncons/actions?query=workflow%3APip
[actions-pip-badge]: https://github.com/pybind/jsoncons/workflows/Pip/badge.svg
[actions-wheels-link]: https://github.com/pybind/jsoncons/actions?query=workflow%3AWheels
[actions-wheels-badge]: https://github.com/pybind/jsoncons/workflows/Wheels/badge.svg

## Installation

- Clone this repository
- `pip install ./jsoncons`

## Test call

```python
import jsoncons

jsoncons.add(1, 2)
```

## Files

This example has several files that are a good idea, but aren't strictly
necessary. The necessary files are:

* `pyproject.toml`: The Python project file
* `CMakeLists.txt`: The CMake configuration file
* `src/main.cpp`: The source file for the C++ build
* `src/jsoncons/__init__.py`: The Python portion of the module. The root of the module needs to be `<package_name>`, `src/<package_name>`, or `python/<package_name>` to be auto-discovered.

These files are also expected and highly recommended:

* `.gitignore`: Git's ignore list, also used by `scikit-build-core` to select files for the SDist
* `README.md`: The source for the PyPI description
* `LICENSE`: The license file

There are also several completely optional directories:

* `.github`: configuration for [Dependabot][] and [GitHub Actions][]
* `conda.recipe`: Example recipe. Normally you should submit projects to conda-forge instead of building them yourself, but this is useful for testing the example.
* `docs/`: Documentation
* `tests/`: Tests go here

And some optional files:

* `.pre-commit-config.yaml`: Configuration for the fantastic static-check runner [pre-commit][].
* `noxfile.py`: Configuration for the [nox][] task runner, which helps make setup easier for contributors.

This is a simplified version of the recommendations in the [Scientific-Python
Development Guide][], which is a _highly_ recommended read for anyone
interested in Python package development (Scientific or not). The guide also
has a cookiecutter that includes scikit-build-core and pybind11 as a backend
choice.

### CI Examples

There are examples for CI in `.github/workflows`. A simple way to produces
binary "wheels" for all platforms is illustrated in the "wheels.yml" file,
using [cibuildwheel][].

## License

pybind11 is provided under a BSD-style license that can be found in the LICENSE
file. By using, distributing, or contributing to this project, you agree to the
terms and conditions of this license.

[cibuildwheel]: https://cibuildwheel.readthedocs.io
[scientific-python development guide]: https://learn.scientific-python.org/development
[dependabot]: https://docs.github.com/en/code-security/dependabot
[github actions]: https://docs.github.com/en/actions
[pre-commit]: https://pre-commit.com
[nox]: https://nox.thea.codes
[pybind11]: https://pybind11.readthedocs.io
[scikit-build-core]: https://scikit-build-core.readthedocs.io
[scikit-build (classic)]: https://scikit-build.readthedocs.io
See `test_json_query`, `test_json_query_json`.
Binary file removed out.bin
Binary file not shown.
Empty file removed out.json
Empty file.
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[build-system]
requires = ["scikit-build-core>=0.10", "pybind11"]
# https://github.com/pybind/scikit_build_example/commit/90f61def6fae75e4908b871e177a69d2b81f4548
requires = ["scikit-build-core>=0.3.3", "pybind11"]
build-backend = "scikit_build_core.build"


[project]
name = "jsoncons"
version = "0.0.1"
description="A minimal example package (with pybind11)"
description="python binding for jsoncons (only what I needed for now)"
readme = "README.md"
authors = [
{ name = "My Name", email = "me@email.com" },
{ name = "zhixiong.tang", email = "me@email.com" },
]
requires-python = ">=3.9"
requires-python = ">=3.7"
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
Expand All @@ -35,7 +36,7 @@ minimum-version = "build-system.requires"


[tool.pytest.ini_options]
minversion = "8.0"
minversion = "6.0"
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
xfail_strict = true
log_cli_level = "INFO"
Expand Down
1 change: 1 addition & 0 deletions src/include/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from https://github.com/danielaparker/jsoncons/tree/master/include
2 changes: 2 additions & 0 deletions src/jsoncons/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from ._core import (
Json,
JsonQuery,
JsonQueryRepl,
__doc__,
Expand All @@ -14,6 +15,7 @@
"__version__",
"JsonQuery",
"JsonQueryRepl",
"Json",
"msgpack_decode",
"msgpack_encode",
]
Loading
Loading