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
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ on:
- 'src/**'
- 'tests/**'
- '.clang-format'
- 'MANIFEST.in'
- 'meson.build'
- 'pyproject.toml'
- 'setup.py'
workflow_dispatch:

jobs:
Expand All @@ -29,11 +28,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: |
pip install -v .[cov] && pytest
pip install -C build-dir=build -C setup-args=-Db_coverage=true -C setup-args=-Dbuildtype=debug -v .[cov]
pytest
gcovr --json-summary-pretty | tee coverage.json
[ $(jq '.line_percent*10' coverage.json) -ge 950 ]
env:
CXXFLAGS: --coverage
- uses: stellarhub/push-gist-action@v1
with:
token: ${{ secrets.PAT }}
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/.idea/
/build/
/cov/
/dist/
/docs/_build/
/docs/_static/fonts/
/docs/_static/images/
/src/pysorteddict.egg-info/
/tests/performance/.ipynb_checkpoints/

__pycache__
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

28 changes: 28 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
project(
'pysorteddict',
'cpp',
default_options: [
'cpp_std=c++20',
# On Windows, MSVC must be used, but Meson uses MinGW (if available).
# Hence, force it to use MSVC. This is harmless on other platforms. See
# https://mesonbuild.com/meson-python/how-to-guides/meson-args.html.
'vsenv=true',
]
)

source_directory = 'src' / 'pysorteddict'
source_files = files(
source_directory / 'sorted_dict_items_type.cc',
source_directory / 'sorted_dict_keys_type.cc',
source_directory / 'sorted_dict_module.cc',
source_directory / 'sorted_dict_type.cc',
source_directory / 'sorted_dict_values_type.cc',
source_directory / 'sorted_dict_view_type.cc',
)

py = import('python').find_installation(pure: false)
py.extension_module(
'pysorteddict',
source_files,
install: true,
)
35 changes: 15 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
[build-system]
requires = [
# See https://github.com/pypa/cibuildwheel/issues/2015. The macOS linker
# receives an unrecognised flag when building a PyPy 3.10 wheel if a
# different version is used.
"setuptools==72.1.0; platform_system == 'Darwin' and platform_python_implementation == 'PyPy'",
# See https://github.com/pypa/cibuildwheel/issues/2676. The Windows linker
# can't find the static Python library file when building a CPython 3.14t
# wheel if the above version is used. In newer versions, licence
# classifiers are deprecated. Hence, find a middle ground.
"setuptools<=76.1.0",
]
build-backend = "setuptools.build_meta"
requires = ["meson-python"]
build-backend = "mesonpy"

[dependency-groups]
docs = ["furo~=2024.8", "myst-parser~=4.0"]
Expand Down Expand Up @@ -59,20 +49,25 @@ enable = ["pypy", "pypy-eol"]
test-command = "pytest {package}"
test-requires = ["pytest-xdist"]

[tool.cibuildwheel.config-settings]
setup-args = ["-Db_lto=true"]

[tool.hatch.envs.default]
dev-mode = false

[tool.hatch.envs.cov]
detached = true
features = ["cov"]

[tool.hatch.envs.cov.env-vars]
CXXFLAGS = "--coverage"

[tool.hatch.envs.cov.scripts]
# To report C++ code coverage, the build directory must persist, because
# reporting coverage requires data from both coverage and object files.
cov = [
"rm -fr build/ cov/ && pip install . && pytest",
"mkdir -p cov/ && gcovr --html-details cov/index.html",
"rm -fr build/ cov/",
"pip install -C build-dir=build -C setup-args=-Db_coverage=true -C setup-args=-Dbuildtype=debug -q .",
"pytest",
"mkdir cov/",
"gcovr --html-details cov/index.html",
]

[tool.hatch.envs.docs]
Expand All @@ -86,6 +81,9 @@ detached = true
# command will fail.
docs = "sphinx-build docs/ docs/_build/"

[tool.meson-python.args]
compile = ["-v"]

[tool.pytest.ini_options]
addopts = "--dist=worksteal -n logical"

Expand All @@ -97,6 +95,3 @@ line-length = 119
"docs/conf.py" = ["A001", "INP001"]
"examples/*" = ["S101", "T201"]
"tests/functional/*" = ["S101", "S311"]

[tool.setuptools]
include-package-data = false
23 changes: 0 additions & 23 deletions setup.py

This file was deleted.

Loading