@@ -2,3 +2,153 @@ Py{{ cookiecutter.product_name }} {{ cookiecutter.library_name }}
2
2
{{ '=' * (cookiecutter.project_name_slug | length) }}
3
3
4
4
{{ cookiecutter.short_description }}
5
+
6
+
7
+ How to install
8
+ --------------
9
+
10
+ At least two installation modes are provided: user and developer.
11
+
12
+ For users
13
+ ^^^^^^^^^
14
+
15
+ In order to install Py{{ cookiecutter.product_name }} {{ cookiecutter.library_name }}, make sure you
16
+ have the required build system tool. To do so, run:
17
+
18
+ .. code :: bash
19
+
20
+ python -m pip install -U pip {{ cookiecutter.build_system }}
21
+
22
+ Then, you can simply execute:
23
+
24
+ {% if cookiecutter.build_system in ["flit", "setuptools"] %}
25
+
26
+ .. code :: bash
27
+
28
+ python -m pip install {{ cookiecutter.pkg_name }}
29
+
30
+ {% elif cookiecutter.build_system == "poetry" %}
31
+
32
+ .. code :: bash
33
+
34
+ poetry run python -m pip install {{ cookiecutter.pkg_name }}
35
+
36
+ {% endif %}
37
+
38
+
39
+ For developers
40
+ ^^^^^^^^^^^^^^
41
+
42
+ Installing Py{{ cookiecutter.product_name }} {{ cookiecutter.library_name }} in developer mode allows
43
+ you to modify the source and enhance it.
44
+
45
+ Before contributing to the project, please refer to the `PyAnsys Developer's guide `_. You will
46
+ need to follow these steps:
47
+
48
+ 1. Start by cloning this repository:
49
+
50
+ .. code :: bash
51
+
52
+ git clone {{ cookiecutter.repository_url }}
53
+
54
+ 2. Create a fresh-clean Python environment and activate it:
55
+
56
+ .. code :: bash
57
+
58
+ python -m venv .venv && source venv .venv
59
+
60
+ 3. Make sure you have the latest required build system and testing/CI tools:
61
+
62
+ .. code :: bash
63
+
64
+ python -m pip install -U pip {{ cookiecutter.build_system }} tox
65
+
66
+ 4. Install the project in editable mode:
67
+
68
+ {% if cookiecutter.build_system in ["flit", "setuptools"] %}
69
+
70
+ .. code :: bash
71
+
72
+ python -m pip install --editable {{ cookiecutter.pkg_name }}
73
+
74
+ {% elif cookiecutter.build_system == "poetry" %}
75
+
76
+ .. code :: bash
77
+
78
+ poetry run python -m pip install {{ cookiecutter.pkg_name }}
79
+
80
+ {% endif %}
81
+
82
+ 5. Finally, verify your development installation by running:
83
+
84
+ .. code :: bash
85
+
86
+ tox
87
+
88
+
89
+ How to testing
90
+ --------------
91
+
92
+ This project takes advantage of `tox `_. This tool allows to automate common
93
+ development tasks (similar to Makefile) but it is oriented towards Python
94
+ development.
95
+
96
+ Using tox
97
+ ^^^^^^^^^
98
+
99
+ As Makefile has rules, `tox `_ has environments. In fact, the tool creates its
100
+ own virtual environment so anything being tested is isolated from the project in
101
+ order to guarantee project's integrity. The following environments commands are provided:
102
+
103
+ - **tox -e style **: will check for coding style quality.
104
+ - **tox -e py3X **: being X the minor version of your Python environment. Checks for unit tests.
105
+ - **tox -e py3X-coverage **: checks for unit testing and code coverage.
106
+ - **tox -e doc **: checs for documentation building process.
107
+
108
+
109
+ Raw testing
110
+ ^^^^^^^^^^^
111
+
112
+ If required, you can always call the style commands (`black `_, `isort `_,
113
+ `flake8 `_...) or unit testing ones (`pytest `_) from the command line. However,
114
+ this does not guarantee that your project is being tested in an isolated
115
+ environment, which is the reason why tools like `tox `_ exist.
116
+
117
+
118
+ A note on pre-commit
119
+ ^^^^^^^^^^^^^^^^^^^^
120
+
121
+ The style checks take advantage of `pre-commit `_. Developers are not forced but
122
+ encouraged to install this tool via:
123
+
124
+ .. code :: bash
125
+
126
+ python -m pip install pre-commit && pre-commit install
127
+
128
+
129
+ Documentation
130
+ -------------
131
+
132
+ For building documentation, you can either run the usual rules provided in the
133
+ `Sphinx `_ Makefile, such us:
134
+
135
+ .. code :: bash
136
+
137
+ make -C doc/ html && your_browser_name doc/html/index.html
138
+
139
+ However, the recommended way of checking documentation integrity is using:
140
+
141
+ .. code :: bash
142
+
143
+ tox -e doc && your_browser_name .tox/doc_out/html/index.html
144
+
145
+
146
+ .. LINKS AND REFERENCES
147
+ .. _black : https://github.com/psf/black
148
+ .. _flake8 : https://flake8.pycqa.org/en/latest/
149
+ .. _isort : https://github.com/PyCQA/isort
150
+ .. _PyAnsys Developer's guide : https://dev.docs.pyansys.com/
151
+ .. _pre-commit : https://pre-commit.com/
152
+ .. _pytest : https://docs.pytest.org/en/stable/
153
+ .. _Sphinx : https://www.sphinx-doc.org/en/master/
154
+ .. _tox : https://tox.wiki/
0 commit comments