Skip to content

Commit a2232ab

Browse files
committed
clean up variable names in templates
1 parent 73fc90c commit a2232ab

27 files changed

+105
-123
lines changed

babelizer/_post_hook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def remove_trailing_whitespace(path: str | Path) -> None:
104104
def run(context: dict[str, Any]) -> None:
105105
PROJECT_DIRECTORY = Path.cwd().resolve()
106106

107-
package_name = context["package_name"]
107+
package_name = context["package"]["name"]
108108
language = context["language"]
109109

110110
LIB_DIRECTORY = PROJECT_DIRECTORY / Path(package_name, "lib")

babelizer/data/templates/.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151

5252
- name: Test
5353
run: |
54-
python -c 'import {{ package_name }}'
54+
python -c 'import {{ package.name }}'
5555
{%- for babelized_class in components %}
56-
bmi-test {{ package_name }}.bmi:{{ babelized_class }} -vvv
56+
bmi-test {{ package.name }}.bmi:{{ babelized_class }} -vvv
5757
{%- endfor %}

babelizer/data/templates/CREDITS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Credits
22
=======
33

4-
* {{ info.full_name }} <{{ info.email }}>
4+
* {{ info.package_author }} <{{ info.package_author_email }}>

babelizer/data/templates/MANIFEST.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
recursive-include {{ package_name }}/data *
1+
recursive-include {{ package.name }}/data *
22
include LICENSE
33
include requirements.txt
44
include *.rst
55
include *.txt
66
include Makefile
77
include babel.toml
8-
recursive-include {{ package_name }} *.pyx
8+
recursive-include {{ package.name }} *.pyx
99
recursive-include docs *.py
1010
recursive-include docs *.rst
1111
recursive-include docs Makefile
1212
recursive-exclude meta *
1313
recursive-exclude recipe *
14-
recursive-exclude {{ package_name }} *.cpp
15-
recursive-exclude {{ package_name }} *.c
14+
recursive-exclude {{ package.name }} *.cpp
15+
recursive-exclude {{ package.name }} *.c

babelizer/data/templates/README.rst

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
1-
{{ '=' * package_name | length }}
2-
{{ package_name }}
3-
{{ '=' * package_name | length }}
1+
{{ '=' * package.name | length }}
2+
{{ package.name }}
3+
{{ '=' * package.name | length }}
44

5-
{% set is_open_source = open_source_license != 'Not open source' -%}
6-
7-
{% if is_open_source %}
85
.. image:: https://img.shields.io/badge/CSDMS-Basic%20Model%20Interface-green.svg
96
:target: https://bmi.readthedocs.io/
107
:alt: Basic Model Interface
118

12-
.. image:: https://img.shields.io/badge/recipe-{{ package_name }}-green.svg
13-
:target: https://anaconda.org/conda-forge/{{ package_name }}
9+
.. image:: https://img.shields.io/badge/recipe-{{ package.name }}-green.svg
10+
:target: https://anaconda.org/conda-forge/{{ package.name }}
1411

15-
.. image:: https://readthedocs.org/projects/{{ package_name | replace("_", "-") }}/badge/?version=latest
16-
:target: https://{{ package_name | replace("_", "-") }}.readthedocs.io/en/latest/?badge=latest
12+
.. image:: https://readthedocs.org/projects/{{ package.name | replace("_", "-") }}/badge/?version=latest
13+
:target: https://{{ package.name | replace("_", "-") }}.readthedocs.io/en/latest/?badge=latest
1714
:alt: Documentation Status
1815

19-
.. image:: https://github.com/{{ info.github_username }}/{{ package_name }}/actions/workflows/test.yml/badge.svg
20-
:target: https://github.com/{{ info.github_username }}/{{ package_name }}/actions/workflows/test.yml
16+
.. image:: https://github.com/{{ info.github_username }}/{{ package.name }}/actions/workflows/test.yml/badge.svg
17+
:target: https://github.com/{{ info.github_username }}/{{ package.name }}/actions/workflows/test.yml
2118

22-
.. image:: https://github.com/{{ info.github_username }}/{{ package_name }}/actions/workflows/flake8.yml/badge.svg
23-
:target: https://github.com/{{ info.github_username }}/{{ package_name }}/actions/workflows/flake8.yml
19+
.. image:: https://github.com/{{ info.github_username }}/{{ package.name }}/actions/workflows/flake8.yml/badge.svg
20+
:target: https://github.com/{{ info.github_username }}/{{ package.name }}/actions/workflows/flake8.yml
2421

25-
.. image:: https://github.com/{{ info.github_username }}/{{ package_name }}/actions/workflows/black.yml/badge.svg
26-
:target: https://github.com/{{ info.github_username }}/{{ package_name }}/actions/workflows/black.yml
27-
{%- endif %}
22+
.. image:: https://github.com/{{ info.github_username }}/{{ package.name }}/actions/workflows/black.yml/badge.svg
23+
:target: https://github.com/{{ info.github_username }}/{{ package.name }}/actions/workflows/black.yml
2824

2925

3026
.. start-intro
@@ -44,7 +40,7 @@ Python and the Python Modeling Toolkit, PyMT.
4440
- PyMT
4541
{% for babelized_class, component in components|dictsort -%}
4642
* - {{ component.library }}
47-
- :class:`~{{ package_name }}.{{ babelized_class }}`
43+
- :class:`~{{ package.name }}.{{ babelized_class }}`
4844
-
4945
.. code-block:: pycon
5046
@@ -54,33 +50,31 @@ Python and the Python Modeling Toolkit, PyMT.
5450
.. end-intro
5551
5652
57-
{% if is_open_source %}
58-
* Free software: {{ open_source_license }}
59-
* Documentation: https://{{ package_name | replace("_", "-") }}.readthedocs.io.
60-
{% endif %}
53+
* Free software: {{ info.package_license }}
54+
* Documentation: https://{{ package.name | replace("_", "-") }}.readthedocs.io.
6155

6256

6357
Quickstart
6458
==========
6559

6660
.. start-quickstart
6761
68-
To get started you will need to install the *{{ package_name }}* package.
62+
To get started you will need to install the *{{ package.name }}* package.
6963
Here are two ways to do so.
7064

7165
Install from conda-forge
7266
------------------------
7367

74-
If the *{{ package_name }}* package is distributed on *conda-forge*, install it into your current environment with *conda*.
68+
If the *{{ package.name }}* package is distributed on *conda-forge*, install it into your current environment with *conda*.
7569

7670
.. code:: bash
7771
78-
conda install -c conda-forge {{ package_name }}
72+
conda install -c conda-forge {{ package.name }}
7973
8074
Install from source
8175
-------------------
8276

83-
You can build and install the *{{ package_name }}* package from source using *conda* and *pip*.
77+
You can build and install the *{{ package.name }}* package from source using *conda* and *pip*.
8478

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

@@ -116,15 +110,15 @@ Model Interface (BMI), or as a PyMT plugin.
116110

117111
A BMI is provided by each component in this package:
118112
{%- for babelized_class, component in components|dictsort -%}
119-
:class:`~{{ package_name}}.{{ babelized_class }}`
113+
:class:`~{{ package.name}}.{{ babelized_class }}`
120114
{% endfor %}.
121115

122116

123117
{% for babelized_class, component in components|dictsort -%}
124118

125119
.. code-block:: pycon
126120
127-
>>> from {{ package_name}} import {{ babelized_class }}
121+
>>> from {{ package.name}} import {{ babelized_class }}
128122
>>> model = {{ babelized_class }}()
129123
>>> model.get_component_name() # Get the name of the component
130124
>>> model.get_output_var_names() # Get a list of the component's output variables

babelizer/data/templates/docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# You can set these variables from the command line.
55
SPHINXOPTS =
66
SPHINXBUILD = python -msphinx
7-
SPHINXPROJ = {{ package_name }}
7+
SPHINXPROJ = {{ package.name }}
88
SOURCEDIR = .
99
BUILDDIR = _build
1010

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# auto-generated with sphinx-apidoc
2-
{{ package_name }}*.rst
2+
{{ package.name }}*.rst

babelizer/data/templates/docs/conf.py.jinja

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# {{ package_name }} documentation build configuration file, created by
1+
# {{ package.name }} documentation build configuration file, created by
22
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
33
#
44
# This file is execfile()d with the current directory set to its
@@ -18,7 +18,7 @@
1818
import os
1919
import pathlib
2020

21-
import {{ package_name }}
21+
import {{ package.name }}
2222

2323
docs_dir = os.path.dirname(__file__)
2424

@@ -58,18 +58,18 @@ source_suffix = ".rst"
5858
master_doc = "index"
5959

6060
# General information about the project.
61-
project = "{{ package_name }}"
62-
copyright = "{{ now|datetimeformat('%Y') }}, {{ info.full_name }}"
63-
author = "{{ info.full_name }}"
61+
project = "{{ package.name }}"
62+
copyright = "{{ now|datetimeformat('%Y') }}, {{ info.package_author }}"
63+
author = "{{ info.package_author }}"
6464

6565
# The version info for the project you're documenting, acts as replacement
6666
# for |version| and |release|, also used in various other places throughout
6767
# the built documents.
6868
#
6969
# The short X.Y version.
70-
version = {{ package_name }}.__version__
70+
version = {{ package.name }}.__version__
7171
# The full version, including alpha/beta/rc tags.
72-
release = {{ package_name }}.__version__
72+
release = {{ package.name }}.__version__
7373

7474
# The language for content autogenerated by Sphinx. Refer to documentation
7575
# for a list of supported languages.
@@ -96,7 +96,7 @@ todo_include_todos = False
9696
# a list of builtin themes.
9797
#
9898
html_theme = "furo"
99-
html_title = "{{ package_name }}"
99+
html_title = "{{ package.name }}"
100100

101101

102102
# Theme options are theme-specific and customize the look and feel of a
@@ -105,7 +105,7 @@ html_title = "{{ package_name }}"
105105
#
106106
html_theme_options = {
107107
"announcement": None,
108-
"source_repository": "https://github.com/{{ info.github_username }}/{{ package_name }}/",
108+
"source_repository": "https://github.com/{{ info.github_username }}/{{ package.name }}/",
109109
"source_branch": "main",
110110
"source_directory": "docs",
111111
"sidebar_hide_name": False,
@@ -132,7 +132,7 @@ html_static_path = ["_static"]
132132
# -- Options for HTMLHelp output ---------------------------------------
133133

134134
# Output file base name for HTML help builder.
135-
htmlhelp_basename = "{{ package_name }}doc"
135+
htmlhelp_basename = "{{ package.name }}doc"
136136

137137
# -- Options for intersphinx extension ---------------------------------------
138138

babelizer/data/templates/docs/developer_install.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@ Developer Install
66

77
.. important::
88

9-
The following commands will install *{{ package_name }}* into your current environment. Although
10-
not necessary, we **highly recommend** you install *{{ package_name }}* into its own
9+
The following commands will install *{{ package.name }}* into your current environment. Although
10+
not necessary, we **highly recommend** you install *{{ package.name }}* into its own
1111
:ref:`virtual environment <virtual_environments>`.
1212

13-
If you will be modifying code or contributing new code to *{{ package_name }}*, you will first
14-
need to get *{{ package_name }}*'s source code and then install *{{ package_name }}* from that code.
13+
If you will be modifying code or contributing new code to *{{ package.name }}*, you will first
14+
need to get *{{ package.name }}*'s source code and then install *{{ package.name }}* from that code.
1515

1616
Source Install
1717
--------------
1818

19-
*{{ package_name }}* is actively being developed on GitHub, where the code is freely available.
19+
*{{ package.name }}* is actively being developed on GitHub, where the code is freely available.
2020
If you would like to modify or contribute code, you can either clone our
2121
repository
2222

2323
.. code-block:: bash
2424
25-
git clone git://github.com/pymt-lab/{{ package_name }}.git
25+
git clone git://github.com/pymt-lab/{{ package.name }}.git
2626
27-
or download the `tarball <https://github.com/{{ info.github_username }}/{{ package_name }}/tarball/master>`_
27+
or download the `tarball <https://github.com/{{ info.github_username }}/{{ package.name }}/tarball/master>`_
2828
(a zip file is available for Windows users):
2929

3030
.. code-block:: bash
3131
32-
curl -OL https://github.com/{{ info.github_username }}/{{ package_name }}/tarball/master
32+
curl -OL https://github.com/{{ info.github_username }}/{{ package.name }}/tarball/master
3333
3434
Once you have a copy of the source code, you can install it into your current
3535
Python environment,
@@ -38,21 +38,21 @@ Python environment,
3838

3939
.. code-block:: bash
4040
41-
cd {{ package_name }}
41+
cd {{ package.name }}
4242
mamba install --file=requirements.txt
4343
pip install -e .
4444
4545
.. tab:: conda
4646

4747
.. code-block:: bash
4848
49-
cd {{ package_name }}
49+
cd {{ package.name }}
5050
conda install --file=requirements.txt
5151
pip install -e .
5252
5353
.. tab:: pip
5454

5555
.. code-block:: bash
5656
57-
cd {{ package_name }}
57+
cd {{ package.name }}
5858
pip install -e .

babelizer/data/templates/docs/environments.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ should stick with *pip*.
1818
.. code-block:: bash
1919
2020
conda install mamba -c conda-forge
21-
mamba create -n {{ package_name }}
22-
mamba activate {{ package_name }}
21+
mamba create -n {{ package.name }}
22+
mamba activate {{ package.name }}
2323
2424
.. tab:: conda
2525

2626
.. code-block:: bash
2727
28-
conda create -n {{ package_name }}
29-
conda activate {{ package_name }}
28+
conda create -n {{ package.name }}
29+
conda activate {{ package.name }}
3030
3131
.. tab:: venv
3232

babelizer/data/templates/docs/index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
.. image:: _static/logo-light.svg
22
:align: center
33
:scale: 15%
4-
:alt: {{ package_name }}
5-
:target: https://{{ package_name }}.readthedocs.org/
4+
:alt: {{ package.name }}
5+
:target: https://{{ package.name }}.readthedocs.org/
66
:class: only-light
77

88
.. image:: _static/logo-dark.svg
99
:align: center
1010
:scale: 15%
11-
:alt: {{ package_name }}
12-
:target: https://{{ package_name }}.readthedocs.org/
11+
:alt: {{ package.name }}
12+
:target: https://{{ package.name }}.readthedocs.org/
1313
:class: only-dark
1414

1515
.. include:: ../README.rst
@@ -23,7 +23,7 @@
2323

2424
quickstart
2525
usage
26-
API <api/{{ package_name }}>
26+
API <api/{{ package.name }}>
2727
babel
2828
.. contributing
2929

babelizer/data/templates/docs/quickstart.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ Quickstart
33

44
.. note::
55

6-
The following commands will install *{{ package_name}}* into your current
6+
The following commands will install *{{ package.name}}* into your current
77
environment. Although not necessary, we **highly recommend** you install
8-
*{{ package_name}}* into its own
8+
*{{ package.name}}* into its own
99
:ref:`virtual environment <virtual_environments>`.
1010

1111
.. include:: ../README.rst
1212
:start-after: .. start-quickstart
1313
:end-before: .. end-quickstart
1414

15-
If you would like the very latest development version of *{{ package_name}}*
16-
or want to modify or contribute code to the *{{ package_name}}* project,
15+
If you would like the very latest development version of *{{ package.name}}*
16+
or want to modify or contribute code to the *{{ package.name}}* project,
1717
you will need to do a :ref:`developer installation <developer_install>` of
18-
*{{ package_name }}* from source.
18+
*{{ package.name }}* from source.

0 commit comments

Comments
 (0)