Skip to content

Commit

Permalink
Quick doc update
Browse files Browse the repository at this point in the history
ibarrond committed Sep 20, 2023
1 parent c02478e commit 3efbdc7
Showing 3 changed files with 32 additions and 40 deletions.
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -30,8 +30,8 @@

* :bolditalic:`Version`: |release|.
* :bolditalic:`Status`: STABLE.
* :bolditalic:`Language`: Python (3.5+) & Cython on top of C++17.
* :bolditalic:`OS`: Windows (tested with ``MSVC2017``, ``MSVC2019``) and Linux / WSL (tested on ``gcc6``, ``gcc8``). MacOS not supported.
* :bolditalic:`Language`: Python (3.7+) & Cython on top of C++17.
* :bolditalic:`OS`: Windows (tested with ``MSVC2017``, ``MSVC2019``), Linux / WSL (tested on ``gcc6`` upwards) and MacOS (``gcc6`` upwards, NO CLANG).

.. warning:: |warning| *REQUIRED: Python must have been compiled with C++17:* ``g++>=6`` *|* ``MSVC 2017+`` |warning|

24 changes: 23 additions & 1 deletion docs/source/getting_started/1_installation.rst
Original file line number Diff line number Diff line change
@@ -18,4 +18,26 @@ To uninstall, just run:

.. code-block:: bash
pip uninstall Pyfhel
pip uninstall Pyfhel
**Installing a C/C++ Compiler**

`Pyfhel` requires a C/C++ compiler with C++17 support. We have tested:
- *gcc6* to *gcc12* in Linux/MacOS/Windows WSL. To install:
- Ubuntu: `sudo apt install gcc g++`
- MacOS: `brew install gcc`. MacOS users must also set several environment variables by running:
```bash
# Brew installs GCC in /opt/homebrew/bin on Apple Silicon and /usr/local/bin on Intel.
if [[ $(uname -m) = "arm64" ]]; then BREW_GCC_PATH="/opt/homebrew/bin"; else BREW_GCC_PATH="/usr/local/bin"; fi
# Set CC/CXX environment variables to the most recent GNU GCC
export CC="$BREW_GCC_PATH/$(ls $BREW_GCC_PATH | grep ^gcc-[0-9] | sort -V -r | head -n 1)"
export CXX="$BREW_GCC_PATH/$(ls $BREW_GCC_PATH | grep ^g++-[0-9] | sort -V -r | head -n 1)"
# Set MACOSX_DEPLOYMENT_TARGET to avoid version mismatch warnings
echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=${{ env.MACOSX_DEPLOYMENT_TARGET }}"
```
- *MSVC2017* and *MSVC2019* in Windows. To install:
- Install Visual C++ Build tools (Download `here <https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170>`, guide in `here <https://stackoverflow.com/questions/40504552>`)
44 changes: 7 additions & 37 deletions docs/source/getting_started/2_contributing.rst
Original file line number Diff line number Diff line change
@@ -3,43 +3,13 @@ Contributing

This is the process to develop/contribute to Pyfhel:

1. *Code a new feature/fix a bug*. Since this project is built using Cython, please refer to `cython documentation <https://cython.readthedocs.io/en/latest/>`_ if you want to help develop it.
2. *Recompile the cython extensions*. After modifying any of the `.pyx`|`pxd` cython files (or the *Afhel* `.cpp` files) you must recompile the cython files. To do so, run the following command:
This is the standard process to develop/contribute:
1. *Code a new feature/fix a bug*. Using [Cython](https://cython.readthedocs.io/en/latest/) for the ``.pyx`` and ``.pxd`` extensions, C++ for ``Afhel`` or Python for examples/tests/other.

.. code-block:: bash
2. *Build/Install Pyfhel locally*. Use ``pip install -v -v .`` for a verbose installation.

# This will turn `Pyfhel/*.pyx` into the corresponding `Pyfhel/*.cpp` file.
# Do not edit the `Pyfhel/*.cpp` files directly!
> python3 setup.py --CYTHONIZE --fullname
Compiling Pyfhel/Pyfhel.pyx because it changed.
Compiling Pyfhel/PyPtxt.pyx because it depends on ./Pyfhel/iostream.pxd.
[1/2] Cythonizing Pyfhel/Pyfhel.pyx
[2/2] Cythonizing Pyfhel/PyPtxt.pyx
Pyfhel-3.0.1
3. *Test changes (requires installing `pytest`)*. Run the tests locally by executing ``pytest .`` in the root directory, and make sure all tests pass.

- *Code coverage (requires installing ``pytest-cov``)*. Add an empty ``.cov`` file in the root directory, and build/install the project locally (``pip install .``). To run coverage tests, execute ``pytest --cov .`` in the root directory, and then ``coverage html`` to obtain a report.

3. *Reinstall Pyfhel locally*. Use either `pip install .` or `python3 setup.py build` (for verbose output and fine control. Run `python3 setup.py --help` for further options).

4. *Test changes locally*. Run the `test.py` file in your environment and make sure all tests are OK:

.. code-block:: bash
python3 Pyfhel/test.py
test_PyCtxt_creation_deletion (__main__.PyfhelTestCase) ... (0.0s) ...ok
test_PyPtxt_PyCtxt (__main__.PyfhelTestCase) ... (0.0s) ...ok
[...]
test_Pyfhel_5d_save_restore_int (__main__.PyfhelTestCase) ... (1.239s) ...ok
----------------------------------------------------------------------
Ran 29 tests in 11.907s
OK
5. *Test changes locally*. Run the `test.py` file in your environment and make sure all tests are OK:

6. *Update the version*. To update it, just change the version number on top of this README: Pyfhel [**vA.B.C**]. Bugfixes and minor corrections should increase **C**. New features should increase **B**. Backwards incompatible changes should increase **A**.

7. *Optional: Add a demo showcasing the new functionality*. The demo will be automatically run as part of the tests and included in the documentation. Check other demos for inspiration on the format.

8. *Optional: Update the docs*. (automatic generation with sphinx in readthedocs).

You're ready to go! Just create a pull request to the `original repo <https://github.com/ibarrond/Pyfhel>`_.
You're ready to go! Just create a pull request to the original repo.

0 comments on commit 3efbdc7

Please sign in to comment.