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

Move Python package to new layout #45

Merged
merged 10 commits into from
Aug 31, 2023
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
12 changes: 7 additions & 5 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ jobs:
- name: Run doctests
if: success() && matrix.python-version == '3.10'
run: |
# Needs editable install to run --doctest-modules
pip install -e python
pytest python --doctest-modules
pytest --pyargs geoarrow --doctest-modules
# No Cython docs yet
# pip install pytest-cython
# pytest --pyargs geoarrow --doctest-cython

- name: Coverage
if: success() && matrix.python-version == '3.10'
Expand All @@ -57,10 +58,11 @@ jobs:
pushd python

# Build with Cython + gcc coverage options
pip install -e .[test]
GEOARROW_COVERAGE=1 python3 setup.py build_ext --inplace

# Run tests + coverage.py (generates .coverage + coverage.xml files)
python -m pytest --cov ./geoarrow
python -m pytest --cov ./src/geoarrow
python -m coverage xml

# Collect C coverage information
Expand All @@ -69,7 +71,7 @@ jobs:
--exclude "/usr/*" \
--exclude "/Library/*" \
--exclude "*/_lib.cpp" \
--exclude "*/geoarrow/geoarrow/*" \
--exclude "*/src/geoarrow/geoarrow/*" \
--output-file=coverage.info

lcov --list coverage.info
Expand Down
4 changes: 2 additions & 2 deletions python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
# specific language governing permissions and limitations
# under the License.

geoarrow/geoarrow
geoarrow/_lib.cpp
src/geoarrow/geoarrow
src/geoarrow/_lib.cpp

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
4 changes: 2 additions & 2 deletions python/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# under the License.

exclude bootstrap.py
include geoarrow/geoarrow/*.h
include geoarrow/geoarrow/*.hpp
include src/geoarrow/geoarrow/*.h
include src/geoarrow/geoarrow/*.hpp
2 changes: 1 addition & 1 deletion python/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

if __name__ == '__main__':
this_dir = os.path.abspath(os.path.dirname(__file__))
vendor_dir = os.path.join(this_dir, 'geoarrow', 'geoarrow')
vendor_dir = os.path.join(this_dir, 'src', 'geoarrow', 'geoarrow')
vendor_source_dir = os.path.join(this_dir, '..', 'src', 'geoarrow')

if os.path.exists(vendor_dir):
Expand Down
6 changes: 3 additions & 3 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@

[project]
name = "geoarrow"
version = "1.0.0-alpha0"
version = "0.1.0-alpha0"
description = ""
authors = [{name = "Dewey Dunnington", email = "[email protected]"}]
license = {text = "Apache-2.0"}
requires-python = ">=3.8"

[project.optional-dependencies]
test = ["pyarrow", "pytest", "pandas", "numpy", "geopandas"]
test = ["pyarrow<13.0.0", "pytest", "pandas", "numpy", "geopandas"]

[project.urls]
homepage = "https://arrow.apache.org"
repository = "https://github.com/geoarrow/geoarrow-cpp"
repository = "https://github.com/geoarrow/geoarrow-c"

[build-system]
requires = [
Expand Down
8 changes: 4 additions & 4 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
if os.path.exists(bootstrap_py):
subprocess.run([sys.executable, bootstrap_py])

vendor_dir = os.path.join(this_dir, 'geoarrow', 'geoarrow')
vendor_dir = os.path.join(this_dir, 'src', 'geoarrow', 'geoarrow')
vendored_files = os.listdir(vendor_dir)
sources = [f'geoarrow/geoarrow/{f}' for f in vendored_files if f.endswith('.c')]
sources = [f'src/geoarrow/geoarrow/{f}' for f in vendored_files if f.endswith('.c')]

# Workaround because setuptools has no easy way to mix C and C++ sources
# if extra flags are required (e.g., -std=c++11 like we need here).
Expand Down Expand Up @@ -64,9 +64,9 @@ def new__compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
ext_modules=[
Extension(
name='geoarrow._lib',
include_dirs=['geoarrow/geoarrow', 'geoarrow/geoarrow_python'],
include_dirs=['src/geoarrow/geoarrow', 'src/geoarrow/geoarrow_python'],
language='c++',
sources=['geoarrow/_lib.pyx'] + sources,
sources=['src/geoarrow/_lib.pyx'] + sources,
extra_compile_args = ['-std=c++11'] + coverage_compile_args,
extra_link_args = [] + coverage_link_args,
define_macros= [] + coverage_define_macros
Expand Down
File renamed without changes.
File renamed without changes.
Loading
Loading