Skip to content

Commit

Permalink
add contibuting and readthedocs
Browse files Browse the repository at this point in the history
  • Loading branch information
berislavlopac committed Oct 5, 2022
1 parent f1c1218 commit 5222b87
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 77 deletions.
24 changes: 24 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

formats:
- epub
- pdf

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.9"

mkdocs:
configuration: mkdocs.yml

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
72 changes: 72 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Contribute to momoa

## Development Environment

[Poetry](https://python-poetry.org) is used for dependency and package management. The steps for setting up the development environment:

1. Install Poetry: either [globally](https://python-poetry.org/docs/#installation), or in a Python virtual environment (using `pip install poetry`).

3. Install the project (if outside a virtual environment, Poetry will create one):

$ poetry install


### Code Validation

[tox](https://tox.wiki) is being used to execute multiple code validation checks at once:

```shell
$ tox
```

This command will automatically run a number of code validation checks, as well as the unit test suite for multiple versions of Python.

**Note:** For local development, use `pyenv` to install multiple versions of Python and set them up as local in the root directory of the project; for example:

```shell
$ pyenv install 3.8.13
$ pyenv install 3.9.12
$ pyenv install 3.10.4
$ pyenv local 3.8.13 3.9.12 3.10.4
```
This is not needed for the CI, which runs one one Python version (image) at a time.

#### Manual Validation

During development, each code check can be executed independently:

```shell
$ flake8 # code linting
$ mypy --install-types --non-interactive momoa/ # Python typing analysis
$ black --check . # Python code formatting
$ isort --check . # Import statement optimisation
$ pydocstyle momoa/ # styling and completeness of docstrings
```

For unit tests use:

```shell
$ pytest --cov --spec
```

The indicated options add extra details to the report:

* `--cov` adds a test coverage report
* `--spec` formats the test report as a list of spec statements


## API Documentation

The project documentation can be served locally by running:

```shell
$ python -m mkdocs serve
```

To build the static documentation site, run:

```shell
$ python -m mkdocs build
```

This will create the HTML documentation in the `site` directory.
70 changes: 0 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,3 @@

A library for definition, validation and serialisation of models based on JSONSchema specifications.

## Development Environment

[Poetry](https://python-poetry.org) is used for dependency and package management. The steps for setting up the development environment:

1. Install Poetry: either [globally](https://python-poetry.org/docs/#installation), or in a Python virtual environment (using `pip install poetry`).

3. Install the project (if outside a virtual environment, Poetry will create one):

$ poetry install


### Code Validation

[tox](https://tox.wiki) is being used to execute multiple code validation checks at once:

```shell
$ tox
```

This command will automatically run a number of code validation checks, as well as the unit test suite for multiple versions of Python.

**Note:** For local development, use `pyenv` to install multiple versions of Python and set them up as local in the root directory of the project; for example:

```shell
$ pyenv install 3.8.13
$ pyenv install 3.9.12
$ pyenv install 3.10.4
$ pyenv local 3.8.13 3.9.12 3.10.4
```
This is not needed for the CI, which runs one one Python version (image) at a time.

#### Manual Validation

During development, each code check can be executed independently:

```shell
$ flake8 # code linting
$ mypy --install-types --non-interactive momoa/ # Python typing analysis
$ black --check . # Python code formatting
$ isort --check . # Import statement optimisation
$ pydocstyle momoa/ # styling and completeness of docstrings
```

For unit tests use:

```shell
$ pytest --cov --spec
```

The indicated options add extra details to the report:

* `--cov` adds a test coverage report
* `--spec` formats the test report as a list of spec statements


## API Documentation

The project documentation can be served locally by running:

```shell
$ python -m mkdocs serve
```

To build the static documentation site, run:

```shell
$ python -m mkdocs build
```

This will create the HTML documentation in the `site` directory.
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mkdocs>=1.2.3
mkapi>=1.0.14
7 changes: 1 addition & 6 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
site_name: Momoa
repo_url:
repo_url: https://github.com/berislavlopac/momoa
site_description: A library for definition, validation and serialisation of models based on JSONSchema specifications.
site_author: Berislav Lopac <berislav@lopac.net>
use_directory_urls: false
Expand All @@ -10,11 +10,6 @@ extra_css:
plugins:
- search
- mkapi
markdown_extensions:
- toc:
permalink: yes
- codehilite:
guess_lang: no
nav:
- index.md
- reference.md
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ statham-schema = "^0.13.5"
stringcase = "^1.2.0"
python-dateutil = "^2.8.2"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
pytest = ">=7.1.2"
pytest-cov = ">=3.0.0"
black = ">=22.1.0"
Expand Down

0 comments on commit 5222b87

Please sign in to comment.