Skip to content

Commit

Permalink
use meson-python
Browse files Browse the repository at this point in the history
  • Loading branch information
ocefpaf committed Jun 26, 2024
1 parent 1cd1418 commit 47e7536
Show file tree
Hide file tree
Showing 38 changed files with 334 additions and 2,548 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "Bot"
groups:
github-actions:
patterns:
- '*'
35 changes: 35 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Full Tests

on:
pull_request:
push:
# branches: [main]

jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
os: [ubuntu-latest]
fail-fast: false

steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4

- name: Setup Micromamba Python ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7 #v1
with:
environment-name: TEST
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} pip python-build compilers --channel conda-forge
- name: Install wheel and run tests
shell: bash -l {0}
run: >
python -m pip install -e . --no-deps --force-reinstall
&& python -m build --wheel . --outdir dist
&& cp -r test/ dist/
&& cd dist && pip install pytest *.whl
&& python -m pytest -rxs test
56 changes: 0 additions & 56 deletions .travis.yml

This file was deleted.

19 changes: 17 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
include LICENSE
include versioneer.py
include xcape/_version.py
include README.md
include pyproject.toml

graft xcape

prune .github
prune *.egg-info
prune doc
prune test

exclude .coveragerc
exclude ruff.toml
exclude .gitignore
exclude .isort.cfg
exclude .pre-commit-config.yaml
exclude *.yml
exclude xcape/_version.py
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# xcape

Fast convective parameters for numpy, dask, and xarray

[![pypi package](https://badge.fury.io/py/xcape.svg)](https://badge.fury.io/py/xcape)
[![conda
forge](https://anaconda.org/conda-forge/xcape/badges/version.svg)](https://anaconda.org/conda-forge/xcape)
<!-- TODO: GHA [![travis-ci build status](https://travis-ci.com/xgcm/xcape.svg?branch=master)](https://travis-ci.com/xgcm/xcape) -->
[![code coverage](https://codecov.io/github/xgcm/xcape/coverage.svg?branch=master)](https://codecov.io/github/xgcm/xcape?branch=master)
[![documentation status](https://readthedocs.org/projects/xcape/badge/?version=latest)](http://xcape.readthedocs.org/en/stable/?badge=latest)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/xgcm/xcape)
[![DOI](https://zenodo.org/badge/202226985.svg)](https://zenodo.org/badge/latestdoi/202226985)

For more information, including installation instructions, read the full
[xcape documentation](https://xcape.readthedocs.io/en/latest/).

## Funding Support

Development of this package was supported by NSF award OCE-1740648
(original Pangeo EarthCube award).

## To Install Development Version

```shell
python setup.py build_ext pip install -e .
```
41 changes: 0 additions & 41 deletions README.rst

This file was deleted.

175 changes: 175 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
project(
'xcape',
['c', 'fortran'],
version: '1.0',
meson_version: '>= 1.1.0',
default_options: ['warning_level=1', 'buildtype=release']
)

py = import('python').find_installation(pure: false)
py_dep = py.dependency()

# NumPy include directory - needed in all submodules
incdir_numpy = run_command(py,
[
'-c',
'import os; os.chdir(".."); import numpy; print(numpy.get_include())'
],
check: true
).stdout().strip()

inc_np = include_directories(incdir_numpy)

incdir_f2py = incdir_numpy / '..' / '..' / 'f2py' / 'src'
inc_f2py = include_directories(incdir_f2py)
fortranobject_c = incdir_f2py / 'fortranobject.c'


CAPE_CODE_model_lev = custom_target(
'CAPE_CODE_model_lev',
input: ['xcape/fortran/CAPE_CODE_model_lev.pyf', 'xcape/fortran/CAPE_CODE_model_lev.f90'],
output: ['CAPE_CODE_model_levmodule.c', 'CAPE_CODE_model_lev-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@', '-m', 'CAPE_CODE_model_lev', '--lower'],
)

py.extension_module(
'CAPE_CODE_model_lev',
['xcape/fortran/CAPE_CODE_model_lev.f90', CAPE_CODE_model_lev],
fortranobject_c,
include_directories: [inc_np, inc_f2py],
dependencies: [py_dep],
install : true,
subdir: 'xcape/fortran',
)

CAPE_CODE_pressure_lev = custom_target(
'CAPE_CODE_pressure_lev',
input: ['xcape/fortran/CAPE_CODE_pressure_lev.pyf', 'xcape/fortran/CAPE_CODE_pressure_lev.f90'],
output: ['CAPE_CODE_pressure_levmodule.c', 'CAPE_CODE_pressure_lev-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@', '-m', 'CAPE_CODE_pressure_lev', '--lower'],
)

py.extension_module(
'CAPE_CODE_pressure_lev',
['xcape/fortran/CAPE_CODE_pressure_lev.f90', CAPE_CODE_pressure_lev],
fortranobject_c,
include_directories: [inc_np, inc_f2py],
dependencies: [py_dep],
install : true,
subdir: 'xcape/fortran',
)

Bunkers_model_lev = custom_target(
'Bunkers_model_lev',
input: ['xcape/fortran/Bunkers_model_lev.pyf', 'xcape/fortran/Bunkers_model_lev.f90'],
output: ['Bunkers_model_levmodule.c', 'Bunkers_model_lev-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@', '-m', 'Bunkers_model_lev', '--lower'],
)

py.extension_module(
'Bunkers_model_lev',
['xcape/fortran/Bunkers_model_lev.f90', Bunkers_model_lev],
fortranobject_c,
include_directories: [inc_np, inc_f2py],
dependencies: [py_dep],
install : true,
subdir: 'xcape/fortran',
)

Bunkers_pressure_lev = custom_target(
'Bunkers_pressure_lev',
input: ['xcape/fortran/Bunkers_pressure_lev.pyf', 'xcape/fortran/Bunkers_pressure_lev.f90'],
output: ['Bunkers_pressure_levmodule.c', 'Bunkers_pressure_lev-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@', '-m', 'Bunkers_pressure_lev', '--lower'],
)

py.extension_module(
'Bunkers_pressure_lev',
['xcape/fortran/Bunkers_pressure_lev.f90', Bunkers_pressure_lev],
fortranobject_c,
include_directories: [inc_np, inc_f2py],
dependencies: [py_dep],
install : true,
subdir: 'xcape/fortran',
)

SREH_model_lev = custom_target(
'SREH_model_lev',
input: ['xcape/fortran/SREH_model_lev.pyf', 'xcape/fortran/SREH_model_lev.f90'],
output: ['SREH_model_levmodule.c', 'SREH_model_lev-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@', '-m', 'SREH_model_lev', '--lower'],
)

py.extension_module(
'SREH_model_lev',
['xcape/fortran/SREH_model_lev.f90', SREH_model_lev],
fortranobject_c,
include_directories: [inc_np, inc_f2py],
dependencies: [py_dep],
install : true,
subdir: 'xcape/fortran',
)

SREH_pressure_lev = custom_target(
'SREH_pressure_lev',
input: ['xcape/fortran/SREH_pressure_lev.pyf', 'xcape/fortran/SREH_pressure_lev.f90'],
output: ['SREH_pressure_levmodule.c', 'SREH_pressure_lev-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@', '-m', 'SREH_pressure_lev', '--lower'],
)

py.extension_module(
'SREH_pressure_lev',
['xcape/fortran/SREH_pressure_lev.f90', SREH_pressure_lev],
fortranobject_c,
include_directories: [inc_np, inc_f2py],
dependencies: [py_dep],
install : true,
subdir: 'xcape/fortran',
)

stdheight_2D_model_lev = custom_target(
'stdheight_2D_model_lev',
input: ['xcape/fortran/stdheight_2D_model_lev.pyf', 'xcape/fortran/stdheight_2D_model_lev.f90'],
output: ['stdheight_2D_model_levmodule.c', 'stdheight_2D_model_lev-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@', '-m', 'stdheight_2D_model_lev', '--lower'],
)

py.extension_module(
'stdheight_2D_model_lev',
['xcape/fortran/stdheight_2D_model_lev.f90', stdheight_2D_model_lev],
fortranobject_c,
include_directories: [inc_np, inc_f2py],
dependencies: [py_dep],
install : true,
subdir: 'xcape/fortran',
)

stdheight_2D_pressure_lev = custom_target(
'stdheight_2D_pressure_lev',
input: ['xcape/fortran/stdheight_2D_pressure_lev.pyf', 'xcape/fortran/stdheight_2D_pressure_lev.f90'],
output: ['stdheight_2D_pressure_levmodule.c', 'stdheight_2D_pressure_lev-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@', '-m', 'stdheight_2D_pressure_lev', '--lower'],
)

py.extension_module(
'stdheight_2D_pressure_lev',
['xcape/fortran/stdheight_2D_pressure_lev.f90', stdheight_2D_pressure_lev],
fortranobject_c,
include_directories: [inc_np, inc_f2py],
dependencies: [py_dep],
install : true,
subdir: 'xcape/fortran',
)


py.install_sources(
'xcape/__init__.py',
'xcape/cape_fortran.py',
'xcape/cape_numba.py',
'xcape/core.py',
'xcape/duck_array_ops.py',
'xcape/srh.py',
'xcape/stdheight.py',
'xcape/xarray.py',
subdir: 'xcape'
)
Loading

0 comments on commit 47e7536

Please sign in to comment.