diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index 50bffbd..57f6308 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -9,22 +9,24 @@ on: jobs: build: + name: Build with Pip strategy: fail-fast: false matrix: - platform: [ubuntu-20.04, windows-2019, macos-13] - python-version: ["3.9"] + platform: [windows-latest, macos-latest, ubuntu-latest] + python-version: ["3.9", "3.12"] runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Add requirements run: python -m pip install --upgrade wheel setuptools diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 0fdc8d5..928c2e8 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -10,12 +10,19 @@ on: types: - published +env: + FORCE_COLOR: 3 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build_sdist: name: Build SDist runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -25,8 +32,9 @@ jobs: - name: Check metadata run: pipx run twine check dist/* - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: + name: cibw-sdist path: dist/*.tar.gz @@ -39,7 +47,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -49,7 +57,7 @@ jobs: with: platforms: all - - uses: pypa/cibuildwheel@v2.17.0 + - uses: pypa/cibuildwheel@v2.22 env: # CIBW_ARCHS: auto64 CIBW_ARCHS_LINUX: x86_64 aarch64 @@ -65,8 +73,9 @@ jobs: shell: bash - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: + name: cibw-wheels-${{ matrix.os }} path: wheelhouse/*.whl @@ -75,17 +84,28 @@ jobs: needs: [build_wheels, build_sdist] runs-on: ubuntu-latest if: github.event_name == 'release' && github.event.action == 'published' + environment: pypi + permissions: + id-token: write + attestations: write steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: artifact + pattern: cibw-* path: dist - - uses: pypa/gh-action-pypi-publish@v1.6.4 + - name: Generate artifact attestation for sdist and wheels + uses: actions/attest-build-provenance@v1 + with: + subject-path: "dist/*" + + - uses: pypa/gh-action-pypi-publish@release/v1 with: + attestations: true password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/headers b/headers index c33a336..0a21abb 160000 --- a/headers +++ b/headers @@ -1 +1 @@ -Subproject commit c33a3362a258e4f93583cea2d161b09cc7d4da24 +Subproject commit 0a21abb45cd8269b08363d638903dd4ff1de048b diff --git a/pyproject.toml b/pyproject.toml index 63a1346..83554da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,8 +5,7 @@ build-backend = "scikit_build_core.build" [project] name = "pybind11_geobuf" -version = "0.2.2" -url = "https://geobuf-cpp.readthedocs.io" +version = "0.2.3" description="c++ geobuf with python binding" readme = "README.md" authors = [ @@ -25,6 +24,11 @@ classifiers = [ "Programming Language :: Python :: 3.12", ] + +[project.urls] +Homepage = "https://geobuf-cpp.readthedocs.io" + + [project.optional-dependencies] test = ["pytest", "scipy"] diff --git a/src/main.cpp b/src/main.cpp index 1208d93..38561e5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -226,8 +226,8 @@ PYBIND11_MODULE(_core, m) str: Decoded and formatted PBF content as a string. )docstring"); - py::class_(m, "Encoder", py::module_local()) // - .def(py::init>(), // + py::class_(m, "Encoder", py::module_local(), py::dynamic_attr()) // + .def(py::init>(), // py::kw_only(), "max_precision"_a = static_cast( std::pow(10, MAPBOX_GEOBUF_DEFAULT_PRECISION)), @@ -366,7 +366,7 @@ PYBIND11_MODULE(_core, m) // ; - py::class_(m, "Decoder", py::module_local()) // + py::class_(m, "Decoder", py::module_local(), py::dynamic_attr()) // .def(py::init<>(), R"docstring( Initialize a Decoder object. @@ -566,7 +566,8 @@ PYBIND11_MODULE(_core, m) ; using PackedRTree = FlatGeobuf::PackedRTree; - py::class_(m, "PackedRTree", py::module_local()) + py::class_(m, "PackedRTree", py::module_local(), + py::dynamic_attr()) .def( "search", [](const PackedRTree &self, double minX, double minY, double maxX, @@ -613,7 +614,7 @@ PYBIND11_MODULE(_core, m) ; using Planet = cubao::Planet; - py::class_(m, "Planet", py::module_local()) + py::class_(m, "Planet", py::module_local(), py::dynamic_attr()) .def(py::init<>(), R"docstring( Initialize an empty Planet object. )docstring") @@ -697,7 +698,8 @@ PYBIND11_MODULE(_core, m) ; using GeobufIndex = cubao::GeobufIndex; - py::class_(m, "GeobufIndex", py::module_local()) // + py::class_(m, "GeobufIndex", py::module_local(), + py::dynamic_attr()) // .def(py::init<>(), R"docstring( Default constructor for GeobufIndex. )docstring") diff --git a/src/pybind11_rapidjson.cpp b/src/pybind11_rapidjson.cpp index b3b2b90..e5f094d 100644 --- a/src/pybind11_rapidjson.cpp +++ b/src/pybind11_rapidjson.cpp @@ -32,7 +32,7 @@ using RapidjsonDocument = mapbox::geojson::rapidjson_document; void bind_rapidjson(py::module &m) { auto rj = - py::class_(m, "rapidjson") // + py::class_(m, "rapidjson", py::module_local()) // .def(py::init<>(), "Initialize an empty RapidJSON value") .def(py::init( [](const py::object &obj) { return to_rapidjson(obj); }), @@ -402,7 +402,7 @@ void bind_rapidjson(py::module &m) .def(py::self != py::self, "Compare two RapidJSON values for inequality") // ; - py::enum_(rj, "type") + py::enum_(rj, "type", py::module_local()) .value("kNullType", rapidjson::kNullType, "Null type") .value("kFalseType", rapidjson::kFalseType, "False type") .value("kTrueType", rapidjson::kTrueType, "True type")