-
-
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.
Merge pull request #1 from earthobservations/dev
Add first version of Goethe
- Loading branch information
Showing
30 changed files
with
2,400 additions
and
2 deletions.
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,4 @@ | ||
# These are supported funding model platforms | ||
github: ["gutzbenj"] | ||
patreon: "earthobservations" | ||
custom: ['paypal.me/BenjaminGutzmann'] |
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,9 @@ | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: 75% | ||
|
||
patch: | ||
default: | ||
target: 75% |
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,12 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "monthly" | ||
versioning-strategy: lockfile-only |
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,57 @@ | ||
name: Coverage | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
name: Check code coverage | ||
steps: | ||
- name: Acquire sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
architecture: x64 | ||
|
||
- name: Setup Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Get Poetry cache directory | ||
id: poetry-cache-dir | ||
run: | | ||
echo "::set-output name=dir::$(poetry config cache-dir)" | ||
- name: Apply cache | ||
id: poetry-cache-flag | ||
uses: actions/cache@v3 | ||
env: | ||
# Increase this value to reset cache if `poetry.lock` has not changed. | ||
CACHE_NUMBER: 1 | ||
with: | ||
path: ${{ steps.poetry-cache-dir.outputs.dir }} | ||
key: poetry-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-${{ env.CACHE_NUMBER }} | ||
|
||
- name: Install library | ||
run: poetry install | ||
|
||
- name: Generate coverage report | ||
run: | | ||
poetry run pytest --cov=goethe tests/ | ||
poetry run coverage xml | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./coverage.xml | ||
flags: unittests | ||
env_vars: OS,PYTHON | ||
name: codecov-umbrella | ||
fail_ci_if_error: false |
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,45 @@ | ||
name: Linter | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
name: Code style checks | ||
steps: | ||
- name: Acquire sources | ||
uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
architecture: x64 | ||
|
||
- name: Setup Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Get Poetry cache directory | ||
id: poetry-cache-dir | ||
run: | | ||
echo "::set-output name=dir::$(poetry config cache-dir)" | ||
- name: Apply cache | ||
id: poetry-cache-flag | ||
uses: actions/cache@v3 | ||
env: | ||
# Increase this value to reset cache if `poetry.lock` has not changed. | ||
CACHE_NUMBER: 1 | ||
with: | ||
path: ${{ steps.poetry-cache-dir.outputs.dir }} | ||
key: poetry-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-${{ env.CACHE_NUMBER }} | ||
|
||
- name: Install library | ||
run: poetry install --no-root | ||
|
||
- name: Run lint on code | ||
run: poetry run poe lint |
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,43 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: [ published ] | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
architecture: x64 | ||
|
||
- name: Setup Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Get Poetry cache directory | ||
id: poetry-cache-dir | ||
run: | | ||
echo "::set-output name=dir::$(poetry config cache-dir)" | ||
- name: Apply cache | ||
id: poetry-cache-flag | ||
uses: actions/cache@v3 | ||
env: | ||
# Increase this value to reset cache if `poetry.lock` has not changed. | ||
CACHE_NUMBER: 1 | ||
with: | ||
path: ${{ steps.poetry-cache-dir.outputs.dir }} | ||
key: poetry-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-${{ env.CACHE_NUMBER }} | ||
|
||
- name: Install library | ||
run: poetry install | ||
|
||
- name: Build | ||
run: poetry build | ||
|
||
- name: Publish | ||
run: poetry publish --username=__token__ --password=${{ secrets.PYPI_TOKEN }} |
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,55 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
jobs: | ||
tests: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: ["3.8", "3.9", "3.10"] | ||
env: | ||
OS: ${{ matrix.os }} | ||
PYTHON: ${{ matrix.python-version }} | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
name: Python ${{ matrix.python-version }} on OS ${{ matrix.os }} | ||
steps: | ||
|
||
- name: Acquire sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
|
||
- name: Setup Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Apply cache | ||
id: poetry-cache-flag | ||
uses: actions/cache@v3 | ||
env: | ||
# Increase this value to reset cache if `poetry.lock` has not changed. | ||
CACHE_NUMBER: 1 | ||
with: | ||
path: .venv | ||
key: poetry-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-${{ env.CACHE_NUMBER }} | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
if: steps.poetry-cache-flag.outputs.cache-hit != 'true' | ||
|
||
- name: Test | ||
run: poetry run poe 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/.idea | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
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,94 @@ | ||
goethe | ||
###### | ||
|
||
Create RST documents programmatically with Python | ||
|
||
Introduction | ||
************ | ||
|
||
Goethe gives you the opportunity to create your individual RST project in Python | ||
|
||
1. **programmatically** - write your project as Python script in OOP style, place variables where ever you want | ||
2. **dynamically** - render the project to dict, json or actual files and even PDF | ||
|
||
Setup | ||
***** | ||
|
||
Via Pip: | ||
|
||
.. code-block:: bash | ||
pip install goethe | ||
Via Github (latest): | ||
|
||
.. code-block:: bash | ||
pip install git+https://github.com/earthobservations/goethe | ||
Structure | ||
********* | ||
|
||
Goethe uses 3 main levels of abstraction: | ||
|
||
- Goethe - initialize an RST project with a Goethe | ||
- FlatChapter - add a chapter based on one file at the same level as the Goethe | ||
- DeepChapter - add a chapter based on a folder with its own index | ||
|
||
A simple project could look like e.g. | ||
|
||
.. code-block:: python | ||
Goethe("myproj") | ||
FlatChapter("overview") | ||
DeepChapter("depper_level) | ||
FlatChapter("overview") | ||
DeepChapter("second_chapter") | ||
with following file structure: | ||
.. code-block:: python | ||
./ | ||
index.rst | ||
overview.rst | ||
./deeper_level | ||
index.rst | ||
overview.rst | ||
./deeper_level/second_chapter | ||
index.rst | ||
Features | ||
******** | ||
- setup a RST project | ||
- export to dict, files or html | ||
- flat and deep chapters to build unlimited depth of documentation | ||
- modules of RST: | ||
- toctree | ||
- paragraph | ||
Backlog | ||
******* | ||
Examples | ||
******** | ||
Visualized examples can be found in the ``examples`` folder. | ||
License | ||
******* | ||
Distributed under the MIT License. See ``LICENSE`` for more info. | ||
Backlog | ||
******* | ||
Changelog | ||
********* | ||
Development | ||
=========== |
Empty file.
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,11 @@ | ||
# Goethe - Create Sphinx RST documents programmatically with Python | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2022, Benjamin Gutzmann, earthobservations developers. | ||
# Distributed under the MIT License. See LICENSE for more info. | ||
from goethe.chapter import DeepChapter, FlatChapter | ||
from goethe.content import _CONTENT_TYPE, _Content | ||
from goethe.goethe import Goethe | ||
from goethe.header import Header | ||
from goethe.paragraph import Paragraph | ||
from goethe.section import Section | ||
from goethe.toctree import TocTree |
Oops, something went wrong.