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

Build babelized projects with meson #90

Merged
merged 39 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
08170fa
Move zest.releaser config to pyproject.toml
mdpiper Mar 5, 2024
78aaec3
Set up Meson build for a single Fortran component
mdpiper Mar 5, 2024
109a9a0
Remove setuptools config from pyproject.toml
mdpiper Mar 6, 2024
4fe09ad
Set version, but not readme, in dynamic metadata
mdpiper Mar 6, 2024
ef17988
Merge branch 'develop' into mdpiper/build-with-meson
mdpiper Mar 6, 2024
731111a
Read package dependencies from babel.toml file
mdpiper Mar 6, 2024
1e5a1a1
Filter dependencies on default empty string
mdpiper Mar 7, 2024
af3f7e5
Update bmi-example-fortran
mdpiper Mar 7, 2024
1632c48
Get the name of the first component to babelize
mdpiper Mar 7, 2024
e421ff0
Set --no-build-isolation for editable installs
mdpiper Mar 7, 2024
3fb374b
Include package requirements for example
mdpiper Mar 8, 2024
f764837
use conda; install bmiheatf in _inst; create bmiheatf.pc
mcflugen Mar 9, 2024
87c4650
add bmiheatf as a dependency
mcflugen Mar 9, 2024
1e36265
Merge branch 'mdpiper/build-with-meson' of github.com:csdms/babelizer…
mcflugen Mar 9, 2024
5ae3a8f
remove requirements from babel.toml
mcflugen Mar 9, 2024
a88ff05
install build tools on a per language basis
mcflugen Mar 10, 2024
6feaaa9
add bmi-tester as a testing dependency
mcflugen Mar 11, 2024
5ce7b93
install language-specific build tools
mcflugen Mar 11, 2024
170623c
create a pkg-config file for heatf; back to using conda
mcflugen Mar 11, 2024
9bd8139
add c and cpp to builds
mcflugen Mar 11, 2024
91a3704
update setup-miniconda
mcflugen Mar 11, 2024
c795a9d
install pkg-config in test environment
mcflugen Mar 11, 2024
a16ef56
fix heatf pkg-config file and bmic, bmicxx pkg-config names
mcflugen Mar 11, 2024
74852c2
update c, cxx submodules
mcflugen Mar 11, 2024
b3210a9
back to lowercase for pkg-config names
mcflugen Mar 11, 2024
b7f33b6
use setuptools for pure-python projects
mcflugen Mar 11, 2024
ec29a4b
build multiple extension; remove bmiheat dependency
mcflugen Mar 11, 2024
3c3a1aa
remove setup.py, setup_utils.py
mcflugen Mar 12, 2024
227bbf9
bump versions of setup-miniconda, checkout
mcflugen Mar 12, 2024
4b66408
remove meson.build for python projects
mcflugen Mar 12, 2024
367ea4c
Merge branch 'develop' into mdpiper/build-with-meson
mcflugen Mar 12, 2024
016c13e
remove setup.py setup_utils.py from prettification
mcflugen Mar 12, 2024
a32086a
Update bmi-example-fortran to tip of mdpiper/use-pkgconfig branch
mdpiper Mar 13, 2024
06d2544
Remove hardcoded pkg-config files
mdpiper Mar 13, 2024
9839e43
Clean lint
mdpiper Mar 13, 2024
ef40631
Add a news fragment
mdpiper Mar 13, 2024
e717535
Update bmi-example-fortran to v2.1.3
mdpiper Mar 14, 2024
1848402
Remove Makefile; trim .gitignore
mdpiper Mar 14, 2024
4d7dbb2
Include brief instructions for installing from source
mdpiper Mar 14, 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
6 changes: 3 additions & 3 deletions .github/workflows/test-langs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ jobs:
with:
submodules: true

- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: conda-forge
channel-priority: true

- name: Install dependencies
run: python -m pip install nox tomli

- name: Install compilers
run: mamba install c-compiler cxx-compiler fortran-compiler
if: matrix.language != 'python'
run: conda install ${{ matrix.language }}-compiler cmake make

- name: Run the language tests
run: nox -s "test-langs-${{ matrix.python-version }}(lang='${{ matrix.language }}')" --python ${{ matrix.python-version }} --verbose
Expand Down
4 changes: 4 additions & 0 deletions babelizer/data/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ def write_api_yaml(folderpath, **kwds):
if "Not open source" == "{{ cookiecutter.open_source_license }}":
remove_file("LICENSE")

{%- if cookiecutter.language == 'python' %}
remove_file("meson.build")
{%- endif %}

datadir = Path("meta")
package_datadir = Path("{{ cookiecutter.package_name }}") / "data"
if not package_datadir.exists():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
python-version: [{{ cookiecutter.ci.python_version | join(", ") }}]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ '{{' }} matrix.python-version {{ '}}' }}
Expand All @@ -39,16 +39,15 @@ jobs:

- name: Install requirements
run: |
conda install mamba
mamba install --file=requirements-build.txt --file=requirements-library.txt
mamba list
conda install --file=requirements-build.txt --file=requirements-library.txt
conda list

- name: Build and install package
run: |
pip install -e .

- name: Install testing dependencies
run: mamba install --file=requirements-testing.txt
run: conda install --file=requirements-testing.txt

- name: Test
run: |
Expand Down
105 changes: 8 additions & 97 deletions babelizer/data/{{cookiecutter.package_name}}/.gitignore
Original file line number Diff line number Diff line change
@@ -1,114 +1,25 @@
# Byte-compiled / optimized / DLL files
.DS_Store
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
.ipynb_checkpoints
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
# lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
docs/_generated/
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# nox virtual envs
.nox/
*.so
*.o
*.mod
*.smod

{% if cookiecutter.language == 'fortran' -%}
{%- if cookiecutter.language != 'python' -%}
{%- for babelized_class in cookiecutter.components %}
# Fortran files generated by the babelizer
{{cookiecutter.package_name}}/lib/bmi_interoperability.mod
{{cookiecutter.package_name}}/lib/bmi_interoperability.smod
{{cookiecutter.package_name}}/lib/bmi_interoperability.o
{{cookiecutter.package_name}}/lib/{{ babelized_class|lower }}.c
{%- endfor %}
{%- endif %}
94 changes: 0 additions & 94 deletions babelizer/data/{{cookiecutter.package_name}}/Makefile

This file was deleted.

44 changes: 34 additions & 10 deletions babelizer/data/{{cookiecutter.package_name}}/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,44 @@ Quickstart

.. start-quickstart

To get started you will need to install the *{{ cookiecutter.package_name }}* package, which is currently distributed
on *conda-forge*. The easiest way to install *{{ cookiecutter.package_name }}* into your current environment using either *mamba* or *conda*.
To get started you will need to install the *{{ cookiecutter.package_name }}* package.
Here are two ways to do so.

.. tab:: mamba
Install from conda-forge
------------------------

.. code:: bash
If the *{{ cookiecutter.package_name }}* package is distributed on *conda-forge*, install it into your current environment with *conda*.

mamba install {{ cookiecutter.package_name }}
.. code:: bash

.. tab:: conda
conda install -c conda-forge {{ cookiecutter.package_name }}

.. code:: bash
Install from source
-------------------

You can build and install the *{{ cookiecutter.package_name }}* package from source using *conda* and *pip*.

First, from the source directory, install package dependencies into your current environment with *conda*.

.. code:: bash

conda install -c conda-forge --file requirements.txt --file requirements-build.txt --file requirements-library.txt

Then install the package itself with *pip*.
{%- if cookiecutter.language == 'python' %}

conda install {{ cookiecutter.package_name }}
.. code:: bash

pip install -e .

{%- else %}

.. code:: bash

pip install --no-build-isolation --editable .

Note that for an editable install, the ``--no-build-isolation`` flag must be set.
{%- endif %}

.. end-quickstart

Expand All @@ -87,8 +111,8 @@ Usage

.. start-usage

There are two ways to use the data components provided by this package: directly through it's Basic
Model Interface, or as a PyMT plugin.
There are two ways to use the components provided by this package: directly through its Basic
Model Interface (BMI), or as a PyMT plugin.

A BMI is provided by each component in this package:
{%- for babelized_class, component in cookiecutter.components|dictsort -%}
Expand Down
Loading
Loading