-
Notifications
You must be signed in to change notification settings - Fork 8
docs(contributing): basic layout #199
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
base: main
Are you sure you want to change the base?
Changes from all commits
f23c076
da0774c
aeefe64
49af9cf
31a1f6b
e06d2c5
4d47f24
9ea1964
8d114af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docs(contributing): basic layout |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,45 @@ | ||||||||||||||||||
Contribute | ||||||||||||||||||
########## | ||||||||||||||||||
|
||||||||||||||||||
Thank you for your interest in contributing to PyWorkbench. Contributions for | ||||||||||||||||||
making the project better can include fixing bugs, adding new features, and | ||||||||||||||||||
improving the documentation. | ||||||||||||||||||
|
||||||||||||||||||
.. important:: | ||||||||||||||||||
|
||||||||||||||||||
This project adheres to the `Contributor Covenant Code of Conduct`_. By | ||||||||||||||||||
participating, you agree to uphold this code of conduct. | ||||||||||||||||||
|
||||||||||||||||||
Start by selecting your role in the project: | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Adding content to make this Contribute topic and the one for PyHeart consistent. |
||||||||||||||||||
|
||||||||||||||||||
.. grid:: 1 1 3 3 | ||||||||||||||||||
|
||||||||||||||||||
.. grid-item-card:: :fa:`user` User | ||||||||||||||||||
:link: contribute/user | ||||||||||||||||||
:link-type: doc | ||||||||||||||||||
:padding: 2 2 2 2 | ||||||||||||||||||
|
||||||||||||||||||
Report bugs, suggest features, and ask questions. | ||||||||||||||||||
|
||||||||||||||||||
.. grid-item-card:: :fa:`book` Documentarian | ||||||||||||||||||
:link: contribute/documentarian | ||||||||||||||||||
:link-type: doc | ||||||||||||||||||
:padding: 2 2 2 2 | ||||||||||||||||||
|
||||||||||||||||||
Improve the documentation and write new content. | ||||||||||||||||||
|
||||||||||||||||||
.. grid-item-card:: :fa:`laptop-code` Developer | ||||||||||||||||||
:link: contribute/developer | ||||||||||||||||||
:link-type: doc | ||||||||||||||||||
:padding: 2 2 2 2 | ||||||||||||||||||
|
||||||||||||||||||
Fix bugs, add new features, and improve the codebase. | ||||||||||||||||||
|
||||||||||||||||||
.. toctree:: | ||||||||||||||||||
:hidden: | ||||||||||||||||||
:maxdepth: 3 | ||||||||||||||||||
:caption: Contribute | ||||||||||||||||||
|
||||||||||||||||||
User<contribute/user> | ||||||||||||||||||
Documentarian<contribute/documentarian> | ||||||||||||||||||
Developer<contribute/developer> |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,184 @@ | ||||||||||||||
Contribute as a developer | ||||||||||||||
######################### | ||||||||||||||
|
||||||||||||||
.. grid:: 1 1 3 3 | ||||||||||||||
|
||||||||||||||
.. grid-item-card:: :fa:`code-fork` Fork the repository | ||||||||||||||
:padding: 2 2 2 2 | ||||||||||||||
:link: fork-the-repository | ||||||||||||||
:link-type: ref | ||||||||||||||
|
||||||||||||||
Fork the project to create a copy. | ||||||||||||||
|
||||||||||||||
.. grid-item-card:: :fa:`download` Clone the repository | ||||||||||||||
:padding: 2 2 2 2 | ||||||||||||||
:link: clone-the-repository | ||||||||||||||
:link-type: ref | ||||||||||||||
|
||||||||||||||
Clone the repository to download the copy to your local machine. | ||||||||||||||
|
||||||||||||||
.. grid-item-card:: :fa:`download` Install for developers | ||||||||||||||
:padding: 2 2 2 2 | ||||||||||||||
:link: install-for-developers | ||||||||||||||
:link-type: ref | ||||||||||||||
|
||||||||||||||
Install the project in editable mode. | ||||||||||||||
|
||||||||||||||
.. grid-item-card:: :fa:`vial-circle-check` Run the tests | ||||||||||||||
:padding: 2 2 2 2 | ||||||||||||||
:link: run-tests | ||||||||||||||
:link-type: ref | ||||||||||||||
|
||||||||||||||
Verify your changes to the project by running tests. | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jorgepiloto I see PyHeart has two additional sections: Code style compliance and Run the CI/CD pipelines. Do you possibly want to add this type of content to this library? |
||||||||||||||
|
||||||||||||||
.. _fork-the-repository: | ||||||||||||||
|
||||||||||||||
Fork the repository | ||||||||||||||
=================== | ||||||||||||||
|
||||||||||||||
Forking the repository is the first step to contributing to the project. This | ||||||||||||||
allows you to have your own copy of the project so that you can make changes without | ||||||||||||||
affecting the main project. Once you have made your changes, you can submit a | ||||||||||||||
pull request to the main project to have your changes reviewed and merged. | ||||||||||||||
|
||||||||||||||
.. button-link:: https://github.com/ansys/pyworkbench/fork | ||||||||||||||
:color: primary | ||||||||||||||
:align: center | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We should be avoiding center alignment. |
||||||||||||||
|
||||||||||||||
:fa:`code-fork` Fork this project | ||||||||||||||
|
||||||||||||||
.. note:: | ||||||||||||||
|
||||||||||||||
If you are an Ansys employee, you can skip this step. | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the instructions for external contributors? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jorgepiloto I can see now that my comment doesn't really make sense. The "Fork the repository" step doesn't have to be completed by Ansys employees, and external contributors can refer to GitHub resources or the PyAnsys dev guide for forking instructions. Should we say something to this effect though--or is it just obvious to developers? If so, just resolve this comment! |
||||||||||||||
|
||||||||||||||
.. _clone-the-repository: | ||||||||||||||
|
||||||||||||||
Clone the repository | ||||||||||||||
==================== | ||||||||||||||
|
||||||||||||||
Make sure that you `configure SSH`_ with your GitHub | ||||||||||||||
account. This allows you to clone the repository without having to use tokens | ||||||||||||||
or passwords. Also, make sure you have `git`_ installed on your machine. | ||||||||||||||
|
||||||||||||||
Clone the repository using SSH: | ||||||||||||||
|
||||||||||||||
.. code-block:: bash | ||||||||||||||
|
||||||||||||||
git clone [email protected]:ansys/pyworkbench | ||||||||||||||
|
||||||||||||||
.. note:: | ||||||||||||||
|
||||||||||||||
If you are not an Ansys employee, you must fork the repository and | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
replace ``ansys`` with your GitHub username in the ``git clone`` command. | ||||||||||||||
|
||||||||||||||
.. _install-for-developers: | ||||||||||||||
|
||||||||||||||
Install for developers | ||||||||||||||
====================== | ||||||||||||||
|
||||||||||||||
Installing PyWorkbench in development mode lets you change the code | ||||||||||||||
and see these changes reflected in your environment without having to reinstall | ||||||||||||||
the library every time you make a change. | ||||||||||||||
|
||||||||||||||
Virtual environment | ||||||||||||||
------------------- | ||||||||||||||
|
||||||||||||||
Start by navigating to the project's root directory: | ||||||||||||||
|
||||||||||||||
.. code-block:: | ||||||||||||||
|
||||||||||||||
cd pyworkbench | ||||||||||||||
|
||||||||||||||
Then, create a new virtual environment named ``.venv`` to isolate your system's | ||||||||||||||
Python environment: | ||||||||||||||
|
||||||||||||||
.. code-block:: text | ||||||||||||||
|
||||||||||||||
python -m venv .venv | ||||||||||||||
|
||||||||||||||
Finally, activate this environment: | ||||||||||||||
|
||||||||||||||
.. tab-set:: | ||||||||||||||
|
||||||||||||||
.. tab-item:: Windows | ||||||||||||||
|
||||||||||||||
.. tab-set:: | ||||||||||||||
|
||||||||||||||
.. tab-item:: CMD | ||||||||||||||
|
||||||||||||||
.. code-block:: text | ||||||||||||||
|
||||||||||||||
.venv\Scripts\activate.bat | ||||||||||||||
|
||||||||||||||
.. tab-item:: PowerShell | ||||||||||||||
|
||||||||||||||
.. code-block:: text | ||||||||||||||
|
||||||||||||||
.venv\Scripts\Activate.ps1 | ||||||||||||||
|
||||||||||||||
.. tab-item:: macOS/Linux/UNIX | ||||||||||||||
|
||||||||||||||
.. code-block:: text | ||||||||||||||
|
||||||||||||||
source .venv/bin/activate | ||||||||||||||
|
||||||||||||||
Development mode | ||||||||||||||
---------------- | ||||||||||||||
|
||||||||||||||
Now, install PyWorkbench in editable mode: | ||||||||||||||
|
||||||||||||||
.. code-block:: text | ||||||||||||||
|
||||||||||||||
python -m pip install --editable . | ||||||||||||||
|
||||||||||||||
Verify the installation by checking the version of the library: | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
.. code-block:: python | ||||||||||||||
|
||||||||||||||
from ansys.workbench.core import __version__ | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
print(f"pyworkbench version is {__version__}") | ||||||||||||||
|
||||||||||||||
.. jinja:: | ||||||||||||||
|
||||||||||||||
.. code-block:: text | ||||||||||||||
|
||||||||||||||
>>> pyworkbench version is {{ PYWORKBENCH_VERSION }} | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
||||||||||||||
Install Tox | ||||||||||||||
----------- | ||||||||||||||
|
||||||||||||||
Once the project is installed, you can install `Tox`_. This is a cross-platform | ||||||||||||||
automation tool. The main advantage of Tox is that it allows you to test your | ||||||||||||||
project in different environments and configurations in a temporary and | ||||||||||||||
isolated Python virtual environment. | ||||||||||||||
Comment on lines
+155
to
+157
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I replaced with the wording that was in PyHeart as it sounded better! |
||||||||||||||
|
||||||||||||||
Install Tox: | ||||||||||||||
|
||||||||||||||
.. code-block:: text | ||||||||||||||
|
||||||||||||||
python -m pip install tox | ||||||||||||||
|
||||||||||||||
Verify the Tox installation by listing all the different environments | ||||||||||||||
(automation rules) for PyWorkbench: | ||||||||||||||
|
||||||||||||||
.. code-block:: text | ||||||||||||||
|
||||||||||||||
tox list | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be |
||||||||||||||
|
||||||||||||||
.. _run-tests: | ||||||||||||||
|
||||||||||||||
Run the tests | ||||||||||||||
============= | ||||||||||||||
|
||||||||||||||
Once you have made your changes, you can run the tests to verify that your | ||||||||||||||
changes did not break the project. PyWorkbench tests support different markers | ||||||||||||||
to avoid running the whole suite of tests. These markers are associated with a | ||||||||||||||
dedicated Tox environment. | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if we can use this instead--to match PyAnsys Heart wording: PyWorkbench tests support different markers |
||||||||||||||
|
||||||||||||||
.. code-block:: text | ||||||||||||||
|
||||||||||||||
tox -e tests |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,139 @@ | ||||||||||
Contributing as a documentarian | ||||||||||
############################### | ||||||||||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
.. grid:: 1 1 3 3 | ||||||||||
|
||||||||||
.. grid-item-card:: :fa:`pencil` Write documentation | ||||||||||
:padding: 2 2 2 2 | ||||||||||
:link: write-documentation | ||||||||||
:link-type: ref | ||||||||||
|
||||||||||
Learn how to get started, use, and contribute to the project. | ||||||||||
|
||||||||||
.. grid-item-card:: :fa:`laptop-code` Add a new example | ||||||||||
:padding: 2 2 2 2 | ||||||||||
:link: write-examples | ||||||||||
:link-type: ref | ||||||||||
|
||||||||||
Write a new example to showcase the capabilities of PyWorkbench. | ||||||||||
|
||||||||||
.. grid-item-card:: :fa:`file-code` Build the documentation | ||||||||||
:padding: 2 2 2 2 | ||||||||||
:link: build-documentation | ||||||||||
:link-type: ref | ||||||||||
|
||||||||||
Render the documentation to see your changes reflected. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
.. _write-documentation: | ||||||||||
|
||||||||||
Write documentation | ||||||||||
=================== | ||||||||||
|
||||||||||
`Sphinx`_ is the tool used to generate PyWorkbench documentation. You write most of the content | ||||||||||
in `ReStructuredText`_ files. However, some of the content, like the | ||||||||||
:ref:`examples <Examples>`, use a mix of `Markdown`_ and Python. If | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
you are interested in writing examples, see :ref:`writing examples <write-examples>`. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We just want to use the section title here. |
||||||||||
|
||||||||||
The documentation is located in the ``doc/source`` directory. The landing page | ||||||||||
is declared in the ``doc/source/index.rst`` file. The subdirectories contain | ||||||||||
the pages of different documentation sections. Finally, the | ||||||||||
``doc/source/_static/`` folder contains various assets like images, and CSS | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
files. | ||||||||||
|
||||||||||
The layout of the ``doc/source`` directory is reflected in the URLs of the | ||||||||||
online documentation pages. For example, the | ||||||||||
``doc/source/contribute/documentarian.rst``file renders as | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
``https://workbench.docs.pyansys.com/contribute/documentarian`` URL. | ||||||||||
|
||||||||||
Thus, if you create a file, it important to follow these rules: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
- Use lowercase letters for file and directory names. | ||||||||||
- Use short and descriptive names. | ||||||||||
- Use hyphens to separate words. | ||||||||||
- Play smart with the hierarchy of the files and directories. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
You must include all files in a table of contents. No orphan files are | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
permitted. If a file is not included in the table of contents, Sphinx raises a | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
warning that causes the build to fail. | ||||||||||
|
||||||||||
A table of contents can be declared using a directive like this: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
.. code-block:: rst | ||||||||||
|
||||||||||
.. toctree:: | ||||||||||
:hidden: | ||||||||||
:maxdepth: 3 | ||||||||||
|
||||||||||
path-to-file-A | ||||||||||
path-to-file-B | ||||||||||
path-to-file-C | ||||||||||
... | ||||||||||
|
||||||||||
The path to the file is relative to the directory where the table of contents | ||||||||||
is declared. | ||||||||||
|
||||||||||
.. _write-examples: | ||||||||||
|
||||||||||
Write a new example | ||||||||||
=================== | ||||||||||
|
||||||||||
The :ref:`examples <Examples>` section of the documentation showcases different | ||||||||||
capabilities of PyWorkbench. Each example is a standalone Python script. Despite | ||||||||||
being PY files, they are written in a mix of `Markdown`_ and Python. This | ||||||||||
is possible thanks to the `myst-parser`_ Sphinx extension. In addition, these | ||||||||||
Python files can be opened as Jupyter Notebooks thanks to the `jupytext`_ | ||||||||||
extension. | ||||||||||
|
||||||||||
Documentarians writing new examples are encouraged to open a new Jupyter Lab | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I doubt a documentarian (and am speaking for even myself) will know how to open a new Jupyter Lab session and write the example as a Jupyter Notebook. I feel like only a developer will know how to do this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good point. I will include the proper command in Tox and document it in here. |
||||||||||
session and write the example as a Jupyter Notebook. This way, the | ||||||||||
documentarian can test the code and see the output in real time. The created | ||||||||||
Jupyter Notebook gets stored as a Python file automatically. | ||||||||||
|
||||||||||
Note that the examples are contained in its own repository, which you can find | ||||||||||
in `PyWorkbench examples repository`_. | ||||||||||
|
||||||||||
Finally, here are some tips for writing examples: | ||||||||||
|
||||||||||
- Start the example with an explanation of the main topic. For example, if you | ||||||||||
are discussing a certain orbital maneuver, explain what that maneuver | ||||||||||
entails. Similarly, if an example is centered around satellite coverage, | ||||||||||
provide an explanation of what coverage is. Try to use as many relevant | ||||||||||
keywords as possible in this section to optimize for Search Engine | ||||||||||
Optimization. | ||||||||||
Comment on lines
+101
to
+102
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
- The second section of the example must be a problem statement. This statement | ||||||||||
must include all of the parameters needed in the example, as well as a | ||||||||||
description of what the example aims to determine. Write this section in an | ||||||||||
imperative form. | ||||||||||
|
||||||||||
- Include an explanation with each code cell. In a Jupyter Notebook, this | ||||||||||
entails adding a Markdown cell before each code cell. The explanations should | ||||||||||
be included before, not after, the corresponding code. | ||||||||||
|
||||||||||
.. _build-documentation: | ||||||||||
|
||||||||||
Build the documentation | ||||||||||
======================= | ||||||||||
|
||||||||||
`Tox`_ is used for automating the build of the documentation. There are | ||||||||||
different environments for cleaning the build, building the documentation | ||||||||||
in different formats such as HTML, and running the tests. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
The following environments are available: | ||||||||||
|
||||||||||
.. dropdown:: Documentation environments | ||||||||||
:animate: fade-in | ||||||||||
:icon: three-bars | ||||||||||
|
||||||||||
.. list-table:: | ||||||||||
:header-rows: 1 | ||||||||||
:widths: auto | ||||||||||
|
||||||||||
* - Environment | ||||||||||
- Command | ||||||||||
* - doc-style | ||||||||||
- python -m tox -e doc-style | ||||||||||
* - doc-links | ||||||||||
- python -m tox -e doc-links | ||||||||||
* - doc-html | ||||||||||
- python -m tox -e html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorgepiloto So much of this content seems like what we talked about as part of the url_include and snippet approach. Will it eventually be implemented as we planned? Your examples also sound rather PySDK-specific, not Workbench specific or generic enough to be part of a template. Should we consider that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @PipKat, having this as a template would be the best. By using Tox, like this project does, the commands are the same for every project. This allows the content to be "templatized".