-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: setup of initial files for ci linting packaging docs and tests
- Loading branch information
Pablo Vasconez
committed
May 31, 2024
1 parent
4618f0f
commit 73d02f5
Showing
19 changed files
with
855 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[run] | ||
omit = */tests/* | ||
source = src/baec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[flake8] | ||
# just stop shouting as black decides line lengths. | ||
max-line-length = 180 | ||
# E203, W504: due to black fmt | ||
ignore = E203,W503 | ||
exclude = ["test*"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# name: deploy docs | ||
|
||
# on: | ||
# push: | ||
# branches: | ||
# - main | ||
|
||
# jobs: | ||
# deploy_docs: | ||
# name: Deploy docs | ||
# runs-on: ubuntu-20.04 | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
|
||
# - name: Install python 3.9 | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: 3.9 | ||
|
||
# - name: Install dependencies | ||
# run: | | ||
# python -m pip install --upgrade pip setuptools | ||
# pip install -r requirements.txt | ||
# pip install . | ||
|
||
# - name: Build docs | ||
# run: sphinx-build -b html docs public | ||
|
||
# - name: Publish docs | ||
# uses: peaceiris/actions-gh-pages@v3 | ||
# with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# publish_dir: ./public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- "docs/**" | ||
- "**.md" | ||
pull_request: | ||
paths-ignore: | ||
- "docs/**" | ||
- "**.md" | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
name: Unit test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
# shellcheck disable=SC2102 | ||
pip install -e .[test] | ||
- name: Test | ||
run: coverage run -m pytest | ||
|
||
- name: Post coverage results | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
flag-name: run-${{ matrix.python-version }} | ||
parallel: true | ||
|
||
finish: | ||
needs: test | ||
if: ${{ always() }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Coveralls Finished | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
parallel-finished: true | ||
|
||
lint: | ||
name: Formatting check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
# Full git history is needed to get a proper list of changed test_files within `super-linter` | ||
fetch-depth: 0 | ||
|
||
- name: Lint | ||
uses: github/super-linter@v5 | ||
env: | ||
VALIDATE_ALL_CODEBASE: false | ||
DEFAULT_BRANCH: main | ||
FILTER_REGEX_EXCLUDE: .*tests/.* | ||
|
||
VALIDATE_JSCPD: false | ||
VALIDATE_CSS: false | ||
VALIDATE_BASH: false | ||
VALIDATE_YAML: false | ||
VALIDATE_PYTHON_PYLINT: false | ||
VALIDATE_NATURAL_LANGUAGE: false | ||
VALIDATE_MARKDOWN: false | ||
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
LINTER_RULES_PATH: / | ||
PYTHON_BLACK_CONFIG_FILE: pyproject.toml | ||
PYTHON_ISORT_CONFIG_FILE: pyproject.toml | ||
PYTHON_MYPY_CONFIG_FILE: pyproject.toml | ||
PYTHON_FLAKE8_CONFIG_FILE: .flake8 | ||
|
||
test_docs: | ||
name: Test docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install python 3.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
pip install -r requirements.txt | ||
pip install . | ||
- name: Build docs | ||
run: sphinx-build -b html docs public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# name: Release | ||
|
||
# on: | ||
# push: | ||
# tags: ['*'] | ||
|
||
# jobs: | ||
# deploy: | ||
# runs-on: ubuntu-latest | ||
|
||
# environment: | ||
# name: release | ||
|
||
# # Mandatory permission for trusted publishing to PyPi | ||
# permissions: | ||
# id-token: write | ||
|
||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: "3.11" | ||
|
||
# - name: Install dependencies | ||
# run: | | ||
# pip install setuptools build | ||
|
||
# - name: Build a binary wheel and a source tarball | ||
# run: python3 -m build | ||
|
||
# - name: Store the distribution packages | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: python-package-distributions | ||
# path: dist/ | ||
|
||
# - name: Publish distribution 📦 to PyPI | ||
# uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,105 @@ | ||
# BAEC | ||
# BAEC Model Generator SDK | ||
Python SDK to create Model Generators and add them into the BAEC platform. | ||
|
||
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) | ||
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) | ||
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/) | ||
[![Coverage Status](https://coveralls.io/repos/github/cemsbv/py-pilecore/badge.svg)](https://coveralls.io/github/cemsbv/py-pilecore) | ||
|
||
|
||
This repository is created by [CEMS BV](https://cemsbv.nl/). | ||
|
||
# Installation | ||
|
||
To install a package in this repository run: | ||
|
||
`$ pip install baec` | ||
|
||
|
||
## ENV VARS | ||
|
||
To use `baec` with `FitCore` to fit and predict settlements, add the follow ENV vars to your environment. Or provide them when asked. | ||
|
||
``` | ||
* NUCLEI_TOKEN | ||
- Your NUCLEI user token | ||
``` | ||
|
||
You can obtain your `NUCLEI_TOKEN` on [NUCLEI](https://nuclei.cemsbv.io/#/). | ||
Go to `personal-access-tokens` and create a new user token. | ||
|
||
# Contribution | ||
|
||
## Environment | ||
|
||
We recommend developing in Python3.10 with a clean virtual environment (using `virtualenv` or `conda`), installing the requirements from the requirements.txt file: | ||
|
||
Example using `virtualenv` and `pip` to install the dependencies in a new environment .env on Linux: | ||
|
||
```bash | ||
python -m venv .env | ||
source .env/bin/activate | ||
python -m pip install --upgrade pip setuptools | ||
pip install -r requirements.txt | ||
pip install -e . | ||
``` | ||
|
||
## Documentation | ||
|
||
Build the docs: | ||
|
||
```bash | ||
python -m pip install --upgrade pip setuptools | ||
pip install -r requirements.txt | ||
pip install . | ||
|
||
sphinx-build -b html docs public | ||
``` | ||
|
||
## Format | ||
|
||
We format our code with black and isort. | ||
|
||
```bash | ||
black --config "pyproject.toml" src/baec tests notebooks | ||
isort --settings-path "pyproject.toml" src/baec tests notebooks | ||
``` | ||
|
||
## Lint | ||
|
||
To maintain code quality we use the GitHub super-linter. | ||
|
||
To run the linters locally, run the `run_super_linters.sh` bash script from the root directory. | ||
|
||
## UnitTest | ||
|
||
Test the software with the use of coverage: | ||
|
||
```bash | ||
python -m pip install --upgrade pip setuptools | ||
pip install -r requirements.txt | ||
pip install -e . | ||
coverage run -m pytest | ||
``` | ||
|
||
## Requirements | ||
|
||
Requirements are autogenerated by the `pip-compile` command with python 3.10 | ||
|
||
Install pip-tools with: | ||
|
||
```bash | ||
pip install pip-tools | ||
``` | ||
|
||
Generate requirements.txt file with: | ||
|
||
```bash | ||
pip-compile --extra=test --extra=lint --extra=docs --output-file=requirements.txt pyproject.toml | ||
``` | ||
|
||
Update the requirements within the defined ranges with: | ||
|
||
```bash | ||
pip-compile --upgrade --extra=test --extra=lint --extra=docs --output-file=requirements.txt pyproject.toml | ||
``` |
Oops, something went wrong.