Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying pyproject.toml and scikit-build-core #378

Merged
merged 38 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
963c950
trying a scikit-build-core setup
ajfriend Jun 1, 2024
fd6c2f8
trying things
ajfriend Jun 1, 2024
48bd3be
vendor FindCython
isaacbrodsky Jun 21, 2024
a9e9729
fix build
isaacbrodsky Jun 21, 2024
c5394a1
remove unused
isaacbrodsky Jun 21, 2024
a14ee96
cython tests working
ajfriend Jun 21, 2024
957cbed
fix lint action
ajfriend Jun 21, 2024
71d636b
coverage fix
ajfriend Jun 21, 2024
f8fd3d0
drop annotation stuff for now, because i can't get it working
ajfriend Jun 22, 2024
9cd175f
book building
ajfriend Jun 22, 2024
073db04
all target
ajfriend Jun 22, 2024
8645c63
try again
ajfriend Jun 22, 2024
dc65bbc
don't install all
ajfriend Jun 22, 2024
4d5c66b
numpy!
ajfriend Jun 22, 2024
a0d58b7
pip install h3.tar.gz[test]
ajfriend Jun 22, 2024
325aa09
drop wheel builds for 3.6 and 3.7
ajfriend Jun 22, 2024
ef436ce
move coverage config to pyproject.toml
ajfriend Jun 22, 2024
5ffa556
remove requirements-dev.txt
ajfriend Jun 22, 2024
a810bbe
remove cmake from the build system requirements
ajfriend Jun 22, 2024
f738c6d
single sourcing the version number in _version.py
ajfriend Jun 22, 2024
0ce30f7
i think scikitbuild-core doesn't work with dynamic = ['version']. try…
ajfriend Jun 22, 2024
47ece53
uber's
ajfriend Jun 22, 2024
42e614f
alphabetical files in cmakelists.txt
ajfriend Jun 22, 2024
b1efd87
tidy up files in the sdist
ajfriend Jun 22, 2024
4392e2e
move pytest config to pyproject.toml
ajfriend Jun 22, 2024
c08b8c5
CIBW_TEST_COMMAND: pytest
ajfriend Jun 22, 2024
db649a1
CIBW_TEST_COMMAND: pytest {project}/tests
ajfriend Jun 22, 2024
9d5c620
CIBW_TEST_REQUIRES: pytest pytest-cov numpy
ajfriend Jun 22, 2024
36f14dc
get better coverage on the testing code
ajfriend Jun 22, 2024
f9d4f24
fix api reference link (#385)
pieterprovoost Aug 25, 2024
9a7442b
Added Bindings for Vertex-Related Functions (#388)
Shiran-Yuan Aug 27, 2024
459235a
Bump actions/download-artifact from 4.1.4 to 4.1.7 in /.github/workfl…
dependabot[bot] Sep 3, 2024
58731ba
prep for v4.0.0b6 release (#394)
ajfriend Sep 4, 2024
40cdd86
alphabetical files in cmakelists.txt
ajfriend Jun 22, 2024
e548205
Merge branch 'master' into aj/toml
ajfriend Sep 4, 2024
72820a4
single
ajfriend Sep 4, 2024
7d18958
test with numpy>=2
ajfriend Sep 4, 2024
121314a
drop lower bound on numpy version
ajfriend Sep 4, 2024
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
5 changes: 0 additions & 5 deletions .coveragerc

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements.in
pip install -r requirements-dev.txt
pip install .[all]

- name: Build the book
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/coverage-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
- name: Install from source
run: |
pip install --upgrade pip setuptools wheel
pip install .[all]
pip install .[test]

- name: Lint
run: flake8 src/h3 setup.py tests
run: flake8 src/h3 tests

- name: Pylint
# As a test for visibility of API bindings, we want to ensure that pylint has no
Expand All @@ -35,8 +35,8 @@ jobs:

- name: Coverage
run: |
pip install Cython
cythonize -i tests/test_cython/cython_example.pyx
pip install cython
cythonize tests/test_cython/cython_example.pyx
pytest --cov=h3 --full-trace --cov-report=xml

- name: Upload coverage to Codecov
Expand All @@ -45,14 +45,3 @@ jobs:
file: ./coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Copy Cython annotations to project dir
run: |
mkdir annotations
cp _skbuild/*/cmake-build/src/h3/_cy/*.html ./annotations

- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v4.3.1
with:
name: annotations
path: ./annotations
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
- name: Install from source
run: |
pip install --upgrade pip setuptools wheel
pip install .[all]
pip install .[test]

- name: Tests
run: |
pip install Cython
cythonize -i tests/test_cython/cython_example.pyx
pip install cython
cythonize tests/test_cython/cython_example.pyx
pytest tests --cov=h3 --full-trace
14 changes: 1 addition & 13 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
pip install --upgrade pip setuptools wheel
pip install pytest
cp dist/h3-*.tar.gz h3.tar.gz
pip install h3.tar.gz[all]
pip install h3.tar.gz[test]

- name: Test sdist
run: pytest --cov=h3 --full-trace
Expand Down Expand Up @@ -76,12 +76,6 @@ jobs:
build: 'cp*-manylinux_x86_64'
name: Linux Intel glibc 64-bit

- os: ubuntu-22.04
build: 'cp36-musllinux_x86_64'
name: Linux Intel musl 64-bit 3.6
- os: ubuntu-22.04
build: 'cp37-musllinux_x86_64'
name: Linux Intel musl 64-bit 3.7
- os: ubuntu-22.04
build: 'cp38-musllinux_x86_64'
name: Linux Intel musl 64-bit 3.8
Expand All @@ -98,12 +92,6 @@ jobs:
build: 'cp312-musllinux_x86_64'
name: Linux Intel musl 64-bit 3.12

- os: ubuntu-22.04
build: 'cp36-manylinux_aarch64'
name: Linux Aarch64 3.6
- os: ubuntu-22.04
build: 'cp37-manylinux_aarch64'
name: Linux Aarch64 3.7
- os: ubuntu-22.04
build: 'cp38-manylinux_aarch64'
name: Linux Aarch64 3.8
Expand Down
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
cmake_minimum_required(VERSION 3.7.2)
cmake_minimum_required(VERSION 3.15...3.26)

project(h3)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Always make a release build
set(CMAKE_BUILD_TYPE Release)

find_package(
Python
COMPONENTS Interpreter Development.Module
REQUIRED)

# Avoid building tooling we won't need for release
# See all options with `cmake -LA` in an `h3/build` directory,
# or at https://h3geo.org/docs/next/core-library/compilation-options/
Expand Down Expand Up @@ -37,4 +42,4 @@ install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/src/h3lib/src/h3lib/include/h3api.h"
DESTINATION
src/h3/_cy)
${SKBUILD_PROJECT_NAME}/_cy)
24 changes: 0 additions & 24 deletions MANIFEST.in

This file was deleted.

22 changes: 9 additions & 13 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PYTHON=$(shell command -v python || command -v python3)


build-docs:
./env/bin/pip install -r requirements-dev.txt
./env/bin/pip install .[all]
./env/bin/jupyter-book build docs/ --warningiserror --keep-going --all

open:
Expand All @@ -14,39 +14,35 @@ init: purge
git submodule update --init
$(PYTHON) -m venv env
./env/bin/pip install --upgrade pip wheel setuptools
./env/bin/pip install .[all]
./env/bin/pip install -r requirements.in
./env/bin/pip install .[test]

clear:
-./env/bin/pip uninstall -y h3
-@rm -rf MANIFEST
-@rm -rf annotations
-@rm -rf .pytest_cache _skbuild dist .coverage build docs/_build
-@rm -rf .pytest_cache _skbuild dist .coverage build docs/_build .ruff_cache
-@find . -type d -name '__pycache__' | xargs rm -r
-@find . -type d -name '*.egg-info' | xargs rm -r
-@find . -type f -name '*.pyc' | xargs rm -r
-@find . -type f -name '*.so' | xargs rm -r
-@find . -type d -name '*.ipynb_checkpoints' | xargs rm -r
-@find ./tests -type f -name '*.c' | xargs rm -r
-@find ./tests -type f -name '*.html' | xargs rm -r

rebuild: clear
./env/bin/pip install .[all]
./env/bin/pip install .[test]

purge: clear
-@rm -rf env

annotations: rebuild
mkdir -p annotations
cp _skbuild/*/cmake-build/src/h3/_cy/*.html ./annotations

test:
./env/bin/cythonize -i tests/test_cython/cython_example.pyx
./env/bin/pip install cython
./env/bin/cythonize tests/test_cython/cython_example.pyx
./env/bin/pytest tests --cov=h3 --cov-report term-missing --durations=10

lint:
./env/bin/flake8 src/h3 setup.py tests
./env/bin/flake8 src/h3 tests
./env/bin/pylint --disable=all --enable=import-error tests/

lab:
./env/bin/pip install -r requirements-dev.txt
./env/bin/pip install .[all]
./env/bin/jupyter lab
92 changes: 88 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,90 @@
[build-system]
requires = [
'scikit-build',
'cython',
'cmake',
requires = ['scikit-build-core', 'cython']
build-backend = 'scikit_build_core.build'

[project]
name = 'h3'
version = '4.0.0b6'
description = "Uber's hierarchical hexagonal geospatial indexing system"
readme = 'readme.md'
license = {file = 'LICENSE'}
authors = [
{ name = 'Uber Technologies', email = 'ajfriend@gmail.com' },
]
maintainers = [
{ name = 'AJ Friend', email = 'ajfriend@gmail.com' },
]
requires-python = '>=3.8'

dependencies = []

classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: C',
'Programming Language :: Cython',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
'Operating System :: Microsoft :: Windows',
'Topic :: Scientific/Engineering :: GIS',
]

[project.urls]
Homepage = 'https://github.com/organization/package'
Documentation = 'https://package.readthedocs.io/'
'Bug Tracker' = 'https://github.com/organization/package/issues'
Discussions = 'https://github.com/organization/package/discussions'
Changelog = 'https://package.readthedocs.io/en/latest/changelog.html'


[project.optional-dependencies]
numpy = ['numpy<2']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to be limited to numpy<2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope! Dropped it.

test = ['pytest', 'pytest-cov', 'flake8', 'pylint', 'numpy<2']
all = [
'jupyter-book',
'flake8',
'sphinx>=7.3.3', # https://github.com/sphinx-doc/sphinx/issues/12290
'jupyterlab',
'jupyterlab-geojson',
'geopandas',
'geodatasets',
'matplotlib',
'contextily',
'cartopy',
'geoviews',
'numpy<2',
'pytest',
'pytest-cov',
'pylint',
]

[tool.coverage.run]
omit = [
'*/h3/api/basic_int/__init__.py',
'*/h3/api/memview_int/__init__.py',
'*/h3/api/numpy_int/__init__.py'
]


[tool.scikit-build]
sdist.exclude = [
'src/h3lib',
'docs',
'dev_notes.md',
'makefile',
]
sdist.include = [
'src/h3lib/LICENSE',
'src/h3lib/README.md',
'src/h3lib/VERSION',
'src/h3lib/CMakeLists.txt',
'src/h3lib/cmake/*',
'src/h3lib/src/h3lib/*'
ajfriend marked this conversation as resolved.
Show resolved Hide resolved
]
8 changes: 0 additions & 8 deletions requirements-dev.txt

This file was deleted.

15 changes: 0 additions & 15 deletions requirements.in

This file was deleted.

44 changes: 0 additions & 44 deletions setup.py

This file was deleted.

Loading
Loading