Skip to content

Commit

Permalink
initial code transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
berislavlopac committed Oct 4, 2022
0 parents commit f1c1218
Show file tree
Hide file tree
Showing 26 changed files with 1,380 additions and 0 deletions.
190 changes: 190 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*-coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
test-reports/

# Various testing files
.mutmut-cache

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints
.ipynb

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# same reasoning as for Pipenv applies here
poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/



# PyCharm stuff
.idea
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Editor workspace files
.vscode

.testmondata

# macOS
.DS_Store

# Docker stuff for local dev
docker-compose.override.yml

.skip-hooks

tmp/


# run configurations
.run/
/.run/

# kube manifest
helm/baked_manifest.yaml
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Momoa

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.
17 changes: 17 additions & 0 deletions docs/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
div.autodoc-signature {
font-size: large;
margin-bottom: 5px;
}

div.autodoc-signature code {
font-size: large;
}

div.autodoc-docstring {
padding-left: 5px;
}

div.autodoc-members {
padding-left: 20px;
margin-bottom: 15px;
}
Loading

0 comments on commit f1c1218

Please sign in to comment.