Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Gui-FernandesBR committed Nov 15, 2023
2 parents 6f544bb + 597a81a commit 53176f6
Show file tree
Hide file tree
Showing 19 changed files with 685 additions and 244 deletions.
46 changes: 46 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Python files
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
db.sqlite3
/db.sqlite3
pip-log.txt
pip-delete-this-directory.txt
.pytest_cache/

# Documentation and Tests
docs/
.coverage
readthedocs.yml
.travis.yml
Makefile

# Binary and Package files
*.egg-info/
*.egg
dist/
build/

# VCS
.git/
.gitignore
.gitattributes
.github/

# IDEs and Editors
.vscode

# Virtual environments
.venv
venv
ENV/
env/

# Others
*.log

# Docker
Dockerfile
.dockerignore
25 changes: 20 additions & 5 deletions .github/workflows/test_pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "**.py"
- ".github/**"

jobs:
fail_if_pull_request_is_draft:
fail_if_pr_is_draft:
if: github.event.pull_request.draft == true
runs-on: ubuntu-18.04
steps:
- name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass.
run: exit 1
run_pytest_and_doctest:
pytest_and_doctest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -23,7 +24,10 @@ jobs:
- windows-latest
python-version:
- 3.8
- 3.11
- 3.12
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -44,6 +48,17 @@ jobs:
pip install -r requirements-tests.txt
- name: Test with pytest
run: |
pytest
pytest --cov=rocketpy --cov-report=xml
cd rocketpy
pytest --doctest-modules
pytest --doctest-modules --cov=rocketpy --cov-report=xml
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/reports/
env_vars: OS,PYTHON
fail_ci_if_error: true
files: ./coverage.xml, ./rocketpy/coverage.xml
flags: unittests
name: codecov-umbrella
verbose: true
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Set base image
# python:latest will get the latest version of python, on linux
# Get a full list of python images here: https://hub.docker.com/_/python/tags
FROM python:latest

# set the working directory in the container
WORKDIR /RocketPy

# Ensure pip is updated
RUN python3 -m pip install --upgrade pip

# Copy the dependencies file to the working directory
COPY requirements.txt .
COPY requirements-tests.txt .

# Install dependencies
# Use a single RUN instruction to minimize the number of layers
RUN pip install \
-r requirements.txt \
-r requirements-tests.txt

# copy the content of the local src directory to the working directory
COPY . .

# command to run on container start
# print the operational system and the python version
CMD [ "python3", "-c", "import platform;import sys; print('Python ', sys.version, ' running on ', platform.platform())" ]

# Install the rocketpy package # TODO: check if I can put this in editable mode
RUN pip install .
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/RocketPy-Team/rocketpy/blob/master/docs/notebooks/getting_started_colab.ipynb)
[![PyPI](https://img.shields.io/pypi/v/rocketpy?color=g)](https://pypi.org/project/rocketpy/)
[![Documentation Status](https://readthedocs.org/projects/rocketpyalpha/badge/?version=latest)](https://docs.rocketpy.org/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/RocketPy-Team/RocketPy/graph/badge.svg?token=Ecc3bsHFeP)](https://codecov.io/gh/RocketPy-Team/RocketPy)
[![Contributors](https://img.shields.io/github/contributors/RocketPy-Team/rocketpy)](https://github.com/RocketPy-Team/RocketPy/graphs/contributors)
[![Chat on Discord](https://img.shields.io/discord/765037887016140840?logo=discord)](https://discord.gg/b6xYnNh)
[![Sponsor RocketPy](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/RocketPy-Team)
Expand Down
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.8'

services:
python38-linux:
image: python:3.8
volumes:
- .:/app
working_dir: /app
command: bash -c "pip install . && pip install -r requirements-tests.txt && pytest && cd rocketpy && pytest --doctest-modules"
logging:
options:
max-size: "10m"
max-file: "3"

python312-linux:
image: python:3.12
volumes:
- .:/app
working_dir: /app
command: bash -c "pip install . && pip install -r requirements-tests.txt && pytest && cd rocketpy && pytest --doctest-modules"
logging:
options:
max-size: "10m"
max-file: "3"
97 changes: 97 additions & 0 deletions docs/development/build_docs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
RocketPy documentation
======================

RocketPy uses `Sphinx <https://www.sphinx-doc.org/>`_ to generate the
documentation.
Sphinx makes it easy to create documentation for Python projects and it is
widely used for Python projects, such as
`NumPy <https://numpy.org/doc/stable/>`_,
`Pandas <https://pandas.pydata.org/docs/>`_ and
`SciPy <https://docs.scipy.org/doc/scipy/>`_.


The `ReadTheDocs <https://about.readthedocs.com/?ref=readthedocs.com>`_ is used
to host the documentation. It is a free service that automatically builds
documentation from your sphinx source files and hosts them for free.

RocketPy official documentation is available at
`https://docs.rocketpy.org <https://docs.rocketpy.org/en/latest/index.html>`_.


How to build the documentation in your local machine
----------------------------------------------------

When you find yourself modifying the documentation files and trying to see the
results, you can build the documentation in your local machine.
This is important to check if the documentation is being generated correctly
before pushing the changes to the repository.

To build the documentation in your local machine, you need to install a set of
requirements that are needed to run the sphinx generator.
All these requirements are listed in the ``requirements.txt`` file inside the
``docs`` folder.

To install the requirements, navigate the terminal to the ``docs`` folder and
run the following command:

.. code-block:: bash
pip install -r requirements.txt
After installing the requirements, you can build the documentation by running
the following command in your terminal:

.. code-block:: bash
make html
The file named ``Makefile`` contains the commands to build the documentation.
The ``make html`` command will generate the documentation in the ``docs/_build/html``
folder.

To see the documentation, open the ``docs/_build/html/index.html`` file in your
browser.

.. note:: Watch out for any warnings or errors that may appear in the terminal
when building the documentation. If you find any, fix them before
pushing the changes to the repository or at least warn the team about
them.

Sometimes you may face problems when building the documentation after several
times of building it.
This may happen because sphinx does not clean the ``docs/_build`` folder before
building the documentation again.
To clean the ``docs/_build`` folder, run the following command in your terminal:

.. code-block:: bash
make clean
After cleaning the ``docs/_build`` folder, you can build the documentation again
by running the ``make html`` command.

If the error persists, it may be related to other files, such as the ``.rst``
files or the ``conf.py`` file.

.. danger:: Do not modify the Makefile or the ``make.bat`` files. These files are
automatically generated by sphinx and any changes will be lost.


How to integrate the documentation with ReadTheDocs
---------------------------------------------------

The documentation is automatically built and hosted by `ReadTheDocs`.
Every time a commit is pushed to the repository, `ReadTheDocs` will build the
documentation and host it automatically.
This includes other branches besides the master branch.
However, the documentation will only be available for the master branch, and you
need to configure the `ReadTheDocs` project to build the documentation for other
branches.

The connection between the GitHub repository and the `ReadTheDocs` project is
already configured and defined in the ``readthedocs.yml`` file, available at the
root of the repository.

.. note:: You need admin permissions to configure the `ReadTheDocs` project. Ask
the team for help if you don't have admin permissions.

Loading

0 comments on commit 53176f6

Please sign in to comment.