Skip to content

Commit

Permalink
Merge pull request #283 from snek5000/doc/copier-template
Browse files Browse the repository at this point in the history
Doc/copier template
  • Loading branch information
ashwinvis committed Apr 9, 2023
2 parents 9504ab4 + f9f4a50 commit 090a305
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 12 deletions.
11 changes: 11 additions & 0 deletions docs/examples/snek5000-canonical/.copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changes here will be overwritten by Copier
_commit: 23.04.1
_src_path: gh://snek5000/template-snek5000-solver
author: Ashwin Vishnu
ci: none
description: An empty solver to demonstrate the packaging layout of a typical Snek5000
solver
kth_framework: false
package_name: snek5000_canonical
project_name: snek5000-canonical
short_name: canonical
2 changes: 1 addition & 1 deletion docs/examples/snek5000-canonical/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2019, Ashwin Vishnu
Copyright (c) 2023, Ashwin Vishnu
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
59 changes: 59 additions & 0 deletions docs/examples/snek5000-canonical/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "snek5000_canonical"
version = "0.0.1"
description = "An empty solver to demonstrate the packaging layout of a typical Snek5000 solver"
readme = "README.md"
requires-python = ">=3.8"
license = {file = "LICENSE"}
authors = [
{name = "Ashwin Vishnu" }
]
keywords = ["Snek5000", "Fluidsim", "Nek5000", "CFD"]
dependencies = [
"snek5000 >= 0.9.0"
]

[project.optional-dependencies]
tests = [
"nox",
"pytest",
"pytest-cov"
]

[project.entry-points."snek5000.solvers"]
canonical = "snek5000_canonical.solver"

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
snek5000_canonical = ["*.usr.f", "*.par.cfg", "Snakefile", "etc/*.yml"]

[tool.coverage.run]
source = ["snek5000_canonical", "./tests"]
data_file = ".coverage/coverage"
omit = [
"*/try_*.py",
"*/_old_*.py",
"tests/test_slow_*.py",
]

[tool.coverage.report]
show_missing = true
exclude_lines = [
"if __name__ == .__main__.:",
'if "sphinx" in sys.modules:',
"raise ValueError",
"raise NotImplementedError",
"except KeyError:",
"except ImportError:",
"except AttributeError:",
"except NotImplementedError:"
]

[tool.coverage.html]
directory = ".coverage/html"
6 changes: 6 additions & 0 deletions docs/how-to/control-fortran-warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ configfile: "config_simul.yml"
Output.update_snakemake_config(config, short_name, verbosity=1)
```

## How to halt compilation if Fortran warnings arise from case file (`*.usr`)

Fortran warnings from Nek5000 code-base maybe inevitable, but it is indeed
possible to keep the case file tidy and subject to a stricter set of Fortran
convention.
24 changes: 13 additions & 11 deletions docs/tuto_packaging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Create your own Snek5000 solver, packaging your Nek5000 user source code
========================================================================

.. tip::
You can now use the Copier template
<https://github.com/snek5000/template-snek5000-solver/> to render the
following packaging structure effortlessly!


This document describes how to package a Nek5000 source code in your own
repository via ``snek5000``'s API. What is described is the bare minimum to
get started. Assume your files are named ``canonical.usr``, ``canonical.par``
Expand All @@ -19,8 +25,7 @@ repository) like this::
.
├── LICENSE
├── README.md
├── setup.cfg
├── setup.py
├── pyproject.toml
└── src
   └── snek5000_canonical
      ├── Snakefile
Expand All @@ -40,18 +45,15 @@ as needed.
layout. In snek5000 solvers, one can rename this file with the ``.usr.f``
extension so that editors can correctly highlight the Fortran code.

setup.py
--------

.. literalinclude:: examples/snek5000-canonical/setup.py

.. _setup.cfg:
.. _pyproject.toml:

setup.cfg
---------
pyproject.toml
--------------

.. literalinclude:: examples/snek5000-canonical/setup.cfg
:language: cfg
.. literalinclude:: examples/snek5000-canonical/pyproject.toml
:language: toml
:end-before: [tool.coverage.run]

.. _init.py:

Expand Down

0 comments on commit 090a305

Please sign in to comment.