Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Alternative software for `miniforge`:
The python_github_tutorial package dependencies can be installed via conda, and this package tagged in conda via pip install:

To perform the python_github_tutorial package build, please run the following commands
from the ``<YOUR_FILE_PATH/python_github_tutorial`` directory.
from the ``<YOUR_FILE_PATH>/python_github_tutorial`` directory.

Create and install conda package:

Expand All @@ -38,25 +38,29 @@ Activate the environment the environment

`conda activate python_github_tutorial`

Install the developement enviroment
Install the developement environment

`pip install -e .`

Note: If you update the conda package, you may have to redo the pip install. Without doing this, it may allow incompatable versions of the dependencies to be installed, etc.:
> [!NOTE]
> If you update the conda package, you may have to redo the pip install. Without doing this, it may allow incompatable versions of the dependencies to be installed, etc.:


## Run the example

This is an example of the supplimentary functions in the utils directory (``<YOUR_FILE_PATH/python_github_tutorial/python_github_tutorial/utils``) and the main function in the main_functions directory (``<YOUR_FILE_PATH/python_github_tutorial/python_github_tutorial/main_functions``).
This is an example of the supplimentary functions in the utils directory (``<YOUR_FILE_PATH>/python_github_tutorial/python_github_tutorial/utils``) and the main function in the main_functions directory (``<YOUR_FILE_PATH>/python_github_tutorial/python_github_tutorial/main_functions``).
The example (``examples.py``) is located here ``<YOUR_FILE_PATH>/python_github_tutorial/examples_to_run``. The instructions to run it are provided below:

The example is located here ``<YOUR_FILE_PATH/python_github_tutorial/examples_to_run``. The instructions to run it are provided below:
The example is located here ``<YOUR_FILE_PATH>/python_github_tutorial/examples_to_run``. The instructions to run it are provided below:

`cd examples_to_run`

`python examples.py`

## Run the interactive example in Visual Studios Code (VScode)

This interactive example (``interactive_examples.py``) is located here ``<YOUR_FILE_PATH>/python_github_tutorial/examples_to_run``.

This is the same example but running it as an interactive job (i.e., like a Jupyter notebook). The example is located here 'examples_to_run/interactive_examples.py'.

When using Visual Studios Code (VScode), the '# %%' above each section makes it a cell, which can be run individually by holding shift and pressing enter.
Expand All @@ -69,7 +73,7 @@ The unit tests via ``pytest`` ensure that the code is build properly, running co
accurate results.

To perform these tests (unit tests) for the python_github_tutorial package, please run the following commands
from the ``<YOUR_FILE_PATH/python_github_tutorial/python_github_tutorial/tests`` directory:
from the ``<YOUR_FILE_PATH>/python_github_tutorial/python_github_tutorial/tests`` directory:

Run all the tests:

Expand All @@ -89,22 +93,31 @@ Run individual test on 'test_main_functions.py':

`pytest test_main_functions.py`

Run individual test on 'test_docs_build.py':

`cd python_github_tutorial/tests`

`pytest test_docs_build.py`

## Build the documentation (docs)

Building these HTML files locally via sphinx, which will allow you to access them with your
local internet browsing application or HTML viewer (chrome, safari, VScode, etc.).
The HTML files will be located in the ``<YOUR_FILE_PATH/python_github_tutorial/docs/_build/html`` directory after they are built.
After the files are built, the HTML files will be located in the ``<YOUR_FILE_PATH>/python_github_tutorial/docs/_build/html`` directory after they are built.

The python_github_tutorial utilizes [sphinx](https://www.sphinx-doc.org/en/master/index.html) to construct the documentation.
The user can build the documentation locally by executing the following command from the ``docs`` directory:

To perform the documents (docs) build for the python_github_tutorial package, please run the following commands
from the ``<YOUR_FILE_PATH/python_github_tutorial/docs`` directory:
The user can build the documentation locally by executing the following command from the ``docs`` directory.
To perform the documents (docs) build for the python_github_tutorial package, please run the following commands from the ``<YOUR_FILE_PATH>/python_github_tutorial/docs`` directory:



`conda activate python_github_tutorial`

`cd docs`

`make html`

After the files are built, the HTML files will be located in the ``<YOUR_FILE_PATH>/python_github_tutorial/docs/_build/html`` directory after they are built.

You can find the docs `html` build here -> `docs/_build/html`. When in the `docs/_build/html` directory, click on any `html` file and it will open the full docs.
4 changes: 0 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# html_theme = 'default'
import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
hhtml_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
18 changes: 9 additions & 9 deletions docs/environment_docs.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: python_github_tutorial_docs
channels:
- conda-forge
- defaults
dependencies:
- python
- python=3.12.*
- numpy
- pytest
- pip
- pytest-cov
- coverage
- mock
- ipython
- nbconvert
- jupyter
- ipython
- nbconvert
- jupyter
- pygments
- numpydoc
- sphinx=6.1.1
- sphinx_rtd_theme
- sphinx
- nbsphinx
- sphinxcontrib
- pip
- pip:
- sphinxcontrib-packages
- sphinxcontrib-svg2pdfconverter
- sphinxcontrib-video
- sphinxcontrib-serializinghtml
99 changes: 89 additions & 10 deletions docs/getting_started/installation/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,20 @@ Installation

Install an editable version from the source (GitHub)
----------------------------------------------------

This project's environment can be built using ``miniforge``.
Alternative software for ``miniforge``:
- You use can use ``anaconda`` or ``miniconda``, which use the same ``conda`` command.
- You use can use ``micromamba`` or ``mamba``, supplimenting ``micromamba`` or ``mamba`` respectively for ``conda`` when using them.

The python_github_tutorial package dependencies can be installed via conda, and this package tagged in conda via pip install:

To perform the python_github_tutorial package build, please run the following commands
from the ``<YOUR_FILE_PATH>/python_github_tutorial`` directory.

::

$ cd path_to_first_python_github_tutorial_dirctory_with_environment_yml_file
$ cd python_github_tutorial

$ conda env create -f environment.yml

Expand All @@ -15,31 +26,99 @@ Install an editable version from the source (GitHub)
$ pip install -e .


.. note::

If you update the conda package, you may have to redo the pip install. Without doing this, it may allow incompatable versions of the dependencies to be installed, etc.:


Run the Example
---------------

This is an example of the supplimentary functions in the utils directory (``<YOUR_FILE_PATH>/python_github_tutorial/python_github_tutorial/utils``) and the main function in the main_functions directory (``<YOUR_FILE_PATH>/python_github_tutorial/python_github_tutorial/main_functions``).
The example (``examples.py``) is located here ``<YOUR_FILE_PATH>/python_github_tutorial/examples_to_run``. The instructions to run it are provided below:

::

$ cd examples_to_run

$ python examples.py

Run the Interactive Example in Visual Studios Code (VScode)
-----------------------------------------------------------

This interactive example (``interactive_examples.py``) is located here ``<YOUR_FILE_PATH>/python_github_tutorial/examples_to_run``.

This is the same example but running it as an interactive job (i.e., like a Jupyter notebook). The example is located here 'examples_to_run/interactive_examples.py'.

When using Visual Studios Code (VScode), the '# %%' above each section makes it a cell, which can be run individually by holding shift and pressing enter.


Building the HTML documenation files (GitHub)
---------------------------------------------

Building these HTML files locally via sphinx, which will allow you to access them with your
local internet browsing application or HTML viewer (chrome, safari, VScode, etc.).
The HTML files will be located in the ``docs/_build/html`` directory after they are built.
Building these HTML files locally via sphinx, which will allow you to access them with your
local internet browsing application or HTML viewer (chrome, safari, VScode, etc.).

The python_github_tutorial utilizes `sphinx <https://www.sphinx-doc.org/en/master/index.html>`_ to construct the documentation.
The user can build the documentation locally by executing the following command from the ``docs`` directory::

The user can build the documentation locally by executing the following command from the ``docs`` directory.
To perform the documents (docs) build for the python_github_tutorial package, please run the following commands from the ``<YOUR_FILE_PATH>/python_github_tutorial/docs`` directory:

::

$ conda activate python_github_tutorial

$ cd docs

$ make html


After the files are built, the HTML files will be located in the ``<YOUR_FILE_PATH>/python_github_tutorial/docs/_build/html`` directory after they are built.

You can find the docs `html` build here -> `docs/_build/html`. When in the `docs/_build/html` directory, click on any `html` file and it will open the full docs.


Testing the software installation
----------------------------------

The python_github_tutorial software tests the installation using `pytest <https://docs.pytest.org/en/stable/>`_.
The unit tests via ``pytest`` ensure that the code is build properly, running correctly and producing
accurate results.

To perform these tests (unit tests) for the python_github_tutorial package, please run the following commands
from the ``python_github_tutorial/tests`` directory::
To perform these tests (unit tests) for the python_github_tutorial package, please run the following commands
from the ``<YOUR_FILE_PATH>/python_github_tutorial/python_github_tutorial/tests`` directory:

$ conda activate python_github_tutorial

$ pytest -v

Run all the tests:

::

$ cd python_github_tutorial/tests

$ pytest -v


Run individual test on 'test_math.py':

::

$ cd python_github_tutorial/tests

$ pytest test_math.py


Run individual test on 'test_main_functions.py':

::

$ cd python_github_tutorial/tests

$ pytest test_main_functions.py

Run individual test on 'test_docs_build.py':

::

$ cd python_github_tutorial/tests

$ pytest test_docs_build.py
13 changes: 7 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This Github tutorial shows the following:

* Code structure in a GitHub repository.
* Setup and building GitHub documentation.
* Basic structure and docstring (code documentation) for Python functions and classes.
* Basic structure and docstrings for Python functions and classes.


Code structure in a GitHub repository
Expand All @@ -32,21 +32,22 @@ Setup and building GitHub documentation
---------------------------------------

This Github repository shows a simple example of how GitHub documentation is created via sphinx.
This documentation can be build via `readthedocs <https://about.readthedocs.com/?ref=dotorg-homepage>`_
for everyone to find on the internet.
This documentation can also be build locally via ``sphinx`` and the ``make html`` command in the ``docs``
This documentation can also be build locally via `sphinx <https://www.sphinx-doc.org/en/master/>`_ and the ``make html`` command in the ``docs``
directory, which builds the html files locally that can be viewed in your local
This documentation can be build via `readthedocs <https://about.readthedocs.com/?ref=dotorg-homepage>`_
for everyone to find on the internet using the same files and structure.
internet browsing application or html viewer (chrome, safari, VScode, etc.).


Basic structure and docstring (code documentation) for Python functions and classes
-----------------------------------------------------------------------------------
Basic structure and docstrings for Python functions and classes
---------------------------------------------------------------

This Github repository demonstrates how to write object-oriented Python code using classes and functions.
In addition to the code structure itself, it is also an example of how to write Python docstrings.
Python docstrings are the documentation for the classes and functions, which describe the
input variables, attributes, methods, and outputs/output variables.


.. toctree::
:caption: Overview
:maxdepth: 2
Expand Down
5 changes: 4 additions & 1 deletion docs/reference/units.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
Units
=====

In this python_github_tutorial package, the input and output values are unitless (i.e., no units were used).
In this ``python_github_tutorial`` package, the input and output values are unitless (i.e., no units were used).

If units were used in your software, you should specify them here and how they are utilized.
This includes specifiying the unitless variables, so the user knows. A good code will test for
the unit values and unitless values, minimizing user input error.

.. note::

Scientists and Engineers may find this ``unyt`` python package useful.

The `unyt <https://unyt.readthedocs.io/en/stable/>`_ can automatically convert units
for you so the users can input any units, provided they are in the proper form.
If the ``unyt`` package is used, it should be mentioned here, specifying where and
Expand Down
8 changes: 3 additions & 5 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
name: python_github_tutorial
channels:
- conda-forge
- defaults
dependencies:
- python
- python=3.12.*
- numpy
- pytest
- pytest-cov
- coverage
- pip
- mock
- ipython
- nbconvert
- jupyter
- pygments
- numpydoc
- sphinx
- sphinx_rtd_theme
- nbsphinx
- sphinxcontrib
- pip
- pip:
- sphinxcontrib-packages
- sphinxcontrib-svg2pdfconverter
- sphinxcontrib-video
- sphinxcontrib-serializinghtml
Loading
Loading