Skip to content

Commit 6861a8a

Browse files
Revathyvenugopal162pyansys-ci-botjorgepilotoMaxJPRey
authored
docs: add contribute section (#636)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Jorge Martínez <[email protected]> Co-authored-by: Maxime Rey <[email protected]>
1 parent 51700b5 commit 6861a8a

File tree

12 files changed

+442
-14
lines changed

12 files changed

+442
-14
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
version: 2
22
updates:
3-
- package-ecosystem: "pip" # See documentation for possible values
4-
directory: "/" # Location of package manifests
3+
- package-ecosystem: "pip"
4+
directory: "/"
55
insecure-external-code-execution: allow
66
schedule:
77
interval: "daily"
88
labels:
99
- "maintenance"
1010
- "dependencies"
11+
assignees:
12+
- "pyansys-ci-bot"
13+
commit-message:
14+
prefix: "build"
1115

1216
- package-ecosystem: "github-actions"
1317
directory: "/"
@@ -19,3 +23,7 @@ updates:
1923
- "pyansys-ci-bot"
2024
commit-message:
2125
prefix: "ci"
26+
groups:
27+
actions:
28+
patterns:
29+
- "*"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ share/python-wheels/
2828
.installed.cfg
2929
*.egg
3030
MANIFEST
31+
.DS_Store
3132

3233
# PyInstaller
3334
# Usually these files are written by a python script from a template

CONTRIBUTING.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Contributing
22

3-
If you are interested in contributing to our project, please make sure to review
4-
our contribution guidelines, which are specified in the
5-
[PyAnsys Developer's Documentation - Contributing](https://dev.docs.pyansys.com/how-to/contributing.html) page. This document
6-
outlines the process for submitting issues, proposing changes, and making pull
7-
requests to our codebase. Following these guidelines will help ensure that your
8-
contributions are properly integrated and reviewed, and will help maintain the
9-
overall quality and consistency of the project. Thank you for your interest in
10-
contributing to our community.
3+
We absolutely welcome any code contributions and we hope that this
4+
guide will facilitate an understanding of the Ansys Sphinx theme code
5+
repository. It is important to note that while the Ansys Sphinx theme software
6+
package is maintained by ANSYS, Inc. and any submissions will be reviewed
7+
thoroughly before merging, we still seek to foster a community that can
8+
support user questions and develop new features to make this software
9+
a useful tool for all users. As such, we welcome and encourage any
10+
questions or submissions to this repository.
11+
12+
For contributing to this project, please refer to the [PyAnsys Developer's Guide].
13+
Further information about contributing to Ansys Sphinx theme can be found in [Contributing].
14+
15+
[PyAnsys Developer's Guide]: https://dev.docs.pyansys.com/index.html
16+
[Contributing]: https://sphinxdocs.ansys.com/version/dev/contribute.html
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs: add contribute section

doc/source/conf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from datetime import datetime
44
import os
55
from pathlib import Path
6+
import subprocess
67
from typing import List
78

89
from github import Github
@@ -162,6 +163,11 @@
162163
"version": f"v{version}" if not version.endswith("dev0") else "main",
163164
},
164165
"pdf_guide": {"version": get_version_match(__version__)}, # noqa: E501
166+
"toxenvs": {
167+
"envs": subprocess.run(
168+
["tox", "list", "-d", "-q"], capture_output=True, text=True
169+
).stdout.splitlines()[1:],
170+
},
165171
}
166172

167173

@@ -297,3 +303,8 @@ def download_and_process_files(example_links: List[str]) -> List[str]:
297303

298304
jinja_contexts["examples"] = {"inputs_examples": file_names}
299305
jinja_contexts["admonitions"] = {"inputs_admonitions": admonitions_links}
306+
307+
308+
jinja_globals = {
309+
"ANSYS_SPHINX_THEME_VERSION": version,
310+
}

doc/source/contribute.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
Contribute
3+
##########
4+
5+
Thank you for your interest in contributing to Ansys Sphinx theme! Contributions are welcome
6+
to make the project better, whether it's fixing bugs, adding new features, or
7+
improving documentation. Below are the guidelines to follow when contributing.
8+
9+
10+
.. grid::
11+
:gutter: 1 2 3 3
12+
:padding: 1 2 3 3
13+
14+
.. grid-item-card:: :fa:`user` User
15+
:link: contribute/user
16+
:link-type: doc
17+
18+
Learn how to contribute as a user.
19+
20+
.. grid-item-card:: :fa:`code-fork` Developer
21+
:link: contribute/developer
22+
:link-type: doc
23+
24+
Learn how to contribute as a developer.
25+
26+
27+
.. toctree::
28+
:hidden:
29+
:maxdepth: 1
30+
:caption: Contribute
31+
32+
User<contribute/user>
33+
Developer<contribute/developer>
Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
Contributing as a developer
2+
###########################
3+
4+
.. grid:: 1 1 3 3
5+
6+
.. grid-item-card:: :fa:`code-fork` Fork the repository
7+
:padding: 2 2 2 2
8+
:link: fork-the-repository
9+
:link-type: ref
10+
11+
Learn how to fork the project and get your own copy.
12+
13+
.. grid-item-card:: :fa:`download` Clone the repository
14+
:padding: 2 2 2 2
15+
:link: clone-the-repository
16+
:link-type: ref
17+
18+
Download your own copy in your local machine.
19+
20+
.. grid-item-card:: :fa:`download` Install for developers
21+
:padding: 2 2 2 2
22+
:link: install-for-developers
23+
:link-type: ref
24+
25+
Install the project in editable mode.
26+
27+
28+
.. _fork-the-repository:
29+
30+
Fork the repository
31+
===================
32+
33+
Forking the repository is the first step for contributing to the project. This
34+
allows you to have your own copy of the project so you can make changes without
35+
affection the main project. Once you have made your changes, you can submit a
36+
pull-request to the main project to have your changes reviewed and merged.
37+
38+
.. button-link:: https://github.com/ansys/ansys-sphinx-theme/fork
39+
:color: primary
40+
:align: center
41+
42+
:fa:`code-fork` Fork this project
43+
44+
.. note::
45+
46+
If you are an Ansys employee, you can skip this step.
47+
48+
.. _clone-the-repository:
49+
50+
Clone the repository
51+
====================
52+
53+
Make sure you `configure SSH`_ with your GitHub
54+
account. This allows you to clone the repository without having to use tokens
55+
or passwords. Also, make sure you have `git`_ installed in your machine.
56+
57+
To clone the repository using SSH, run:
58+
59+
.. code-block:: bash
60+
61+
git clone [email protected]:ansys/ansys-sphinx-theme
62+
63+
.. _install-for-developers:
64+
65+
Install for developers
66+
======================
67+
68+
Installing Ansys sphinx theme in development mode allows you to perform changes to the code
69+
and see the changes reflected in your environment without having to reinstall
70+
the library every time you make a change.
71+
72+
Virtual environment
73+
-------------------
74+
75+
Start by navigating to the project's root directory by running:
76+
77+
.. code-block:: bash
78+
79+
cd ansys-sphinx-theme
80+
81+
Then, create a new virtual environment named ``.venv`` to isolate your system's
82+
Python environment by running:
83+
84+
.. code-block:: bash
85+
86+
python -m venv .venv
87+
88+
Finally, activate this environment by running:
89+
90+
.. tab-set::
91+
92+
.. tab-item:: Windows
93+
94+
.. tab-set::
95+
96+
.. tab-item:: CMD
97+
98+
.. code-block:: bash
99+
100+
.venv\Scripts\activate.bat
101+
102+
.. tab-item:: PowerShell
103+
104+
.. code-block:: bash
105+
106+
.venv\Scripts\Activate.ps1
107+
108+
.. tab-item:: macOS/Linux/UNIX
109+
110+
.. code-block:: bash
111+
112+
source .venv/bin/activate
113+
114+
Development mode
115+
----------------
116+
117+
Now, install Ansys sphinx theme in editable mode by running:
118+
119+
.. code-block:: bash
120+
121+
python -m pip install --editable .
122+
123+
Verify the installation by checking the version of the library:
124+
125+
126+
.. code-block:: python
127+
128+
from ansys_sphinx_theme import __version__
129+
print(f"Ansys sphinx thenme version is {__version__}")
130+
131+
.. jinja::
132+
133+
.. code-block:: bash
134+
135+
>>> Ansys sphinx theme version is {{ ANSYS_SPHINX_THEME_VERSION }}
136+
137+
Install ``Tox``
138+
---------------
139+
140+
Once the project is installed, you can install `Tox`_. This is a cross-platform
141+
automation tool. The main advantage of Tox is that it allows you to test your
142+
project in different environments and configurations in a temporary and
143+
isolated Python virtual environment. To install Tox, run:
144+
145+
.. code-block:: bash
146+
147+
python -m pip install tox
148+
149+
Finally, verify the installation by listing all the different environments
150+
(automation rules) for Ansys Sphinx theme:
151+
152+
.. code-block:: bash
153+
154+
python -m tox list
155+
156+
.. jinja:: toxenvs
157+
158+
.. dropdown:: Default Tox environments
159+
:animate: fade-in
160+
:icon: three-bars
161+
162+
.. list-table::
163+
:header-rows: 1
164+
:widths: auto
165+
166+
* - Environment
167+
- Description
168+
- usage
169+
{% for environment in envs %}
170+
{% set name, description = environment.split("->") %}
171+
* - {{ name }}
172+
- {{ description }}
173+
- python -m tox -e {{ name }}
174+
{% endfor %}
175+
176+
177+
Adhere to code style
178+
--------------------
179+
180+
Ansys Sphinx theme follows the PEP8 standard as outlined in
181+
`PEP 8 <https://dev.docs.pyansys.com/coding-style/pep8.html>`_ in
182+
the *PyAnsys Developer's Guide* and implements style checking using
183+
`pre-commit <https://pre-commit.com/>`_.
184+
185+
To ensure your code meets minimum code styling standards, run these commands::
186+
187+
pip install pre-commit
188+
pre-commit run --all-files
189+
190+
or use tox as above::
191+
192+
tox -e code-style
193+
194+
You can also install this as a pre-commit hook by running this command::
195+
196+
pre-commit install
197+
198+
This way, it's not possible for you to push code that fails the style checks::
199+
200+
$ pre-commit install
201+
$ git commit -am "added my cool feature"
202+
ruff.....................................................................Passed
203+
ruff-format..............................................................Passed
204+
codespell................................................................Passed
205+
prettier.................................................................Passed
206+
check for merge conflicts................................................Passed
207+
debug statements (python)................................................Passed
208+
check yaml...............................................................Passed
209+
trim trailing whitespace.................................................Passed
210+
Validate GitHub Workflows................................................Passed
211+
Add License Headers......................................................Passed
212+
213+
214+
Build the documentation
215+
-----------------------
216+
217+
To build documentation locally, you can either use Tox as mentioned above or
218+
run the following commands:
219+
220+
1. Install the required dependencies by running::
221+
222+
python -m pip install -e .[doc]
223+
224+
2. Build the documentation by running::
225+
226+
# On Linux or macOS
227+
make -C doc/ html
228+
229+
# On Windows
230+
doc\make.bat html
231+
232+
3. The documentation is built in the ``doc/_build/html`` directory. Open the
233+
``index.html`` file in your browser to view the documentation.
234+
235+
You can clean the build directory by running::
236+
237+
# On Linux or macOS
238+
make -C doc/ clean
239+
240+
# On Windows
241+
doc\make.bat clean

0 commit comments

Comments
 (0)