Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
feat: Generator plugins and project restructure (#3)
Browse files Browse the repository at this point in the history
* feat: dev push

Nothing to say so far, things are getting along, but nothing's ready yet.

Signed-off-by: Predeactor <predeactor0@gmail.com>

* feat: some more changes

Signed-off-by: Predeactor <predeactor0@gmail.com>

* chore: revert "feat: some more changes"

This reverts commit 74748f2.

* chore: revert "feat: dev push"

This reverts commit 3e81f02.

The taken path was probably not correct...

* feat: remove api docs (for now), meta changes & typesheds

Signed-off-by: Predeactor <predeactor0@gmail.com>

* feat: generator plugin, project structure reformat

Here's a little list of what has been introduced in this commit:
- Added plugins system for Generator
- Fixed testing in VSC (Unable to launch debug session)
- Reordered API docs
- Removed all import in root's __init__.py
- Remove contracts code structure
- Remove "to_dict" methods to FileGenerator and Generator
- Recreated tests to be more consistent and safe, and clearer

Signed-off-by: Predeactor <predeactor0@gmail.com>

* feat: separated plugin class

* feat: apply requested changes

Signed-off-by: Predeactor <predeactor0@gmail.com>
  • Loading branch information
Julien Mauroy committed Sep 9, 2022
1 parent e1a12c5 commit 8ba0343
Show file tree
Hide file tree
Showing 42 changed files with 1,342 additions and 866 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
- id: pretty-format-json
args:
- "--autofix"
- "--indent=4"
- "--indent=2"
- "--no-sort-keys"

# Checks for git-related issues
Expand Down
39 changes: 22 additions & 17 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
{
"configurations": [
{
"name": "Launch tests",
"type": "python",
"request": "launch",
"module": "unittest",
"justMyCode": true
},
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"preLaunchTask": "[Fabricius]: Build docs",
"name": "Launch docs",
"file": "${workspaceFolder}/docs/build/html/index.html"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Launch tests",
"type": "python",
"module": "unittest",
"args": [
"--failfast"
],
"request": "launch",
"console": "integratedTerminal",
"justMyCode": true
},
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"preLaunchTask": "Build docs",
"name": "Launch docs",
"file": "${workspaceFolder}/docs/build/html/index.html"
}
]
}
30 changes: 15 additions & 15 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "[Fabricius]: Build docs",
"type": "shell",
"command": "poetry run make html",
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"cwd": "${workspaceFolder}/docs"
}
}
]
"version": "2.0.0",
"tasks": [
{
"label": "Build docs",
"type": "shell",
"command": "poetry run make html",
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"cwd": "${workspaceFolder}/docs"
}
}
]
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform

- Make sure that you are using the latest version.
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://fabricius.readthedocs.io). If you are looking for support, you might want to check [this section](#i-have-a-question)).
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/Predeactor/Fabriciusissues?q=label%3Abug).
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/Predeactor/Fabricius/issues?q=label%3Abug).
- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
- Collect information about the bug:
- Stack trace (Traceback)
Expand Down
7 changes: 0 additions & 7 deletions docs/source/api/constants.rst

This file was deleted.

27 changes: 0 additions & 27 deletions docs/source/api/contracts.rst

This file was deleted.

45 changes: 45 additions & 0 deletions docs/source/api/fabricius.generator.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
fabricius.generator package
===========================

Submodules
----------

fabricius.generator.errors module
---------------------------------

.. automodule:: fabricius.generator.errors
:members:
:undoc-members:
:show-inheritance:

fabricius.generator.file module
-------------------------------

.. automodule:: fabricius.generator.file
:members:
:undoc-members:
:show-inheritance:

fabricius.generator.generator module
------------------------------------

.. automodule:: fabricius.generator.generator
:members:
:undoc-members:
:show-inheritance:

fabricius.generator.renderer module
-----------------------------------

.. automodule:: fabricius.generator.renderer
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: fabricius.generator
:members:
:undoc-members:
:show-inheritance:
21 changes: 21 additions & 0 deletions docs/source/api/fabricius.plugins.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
fabricius.plugins package
=========================

Submodules
----------

fabricius.plugins.generator module
----------------------------------

.. automodule:: fabricius.plugins.generator
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: fabricius.plugins
:members:
:undoc-members:
:show-inheritance:
38 changes: 38 additions & 0 deletions docs/source/api/fabricius.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
fabricius package
=================

Subpackages
-----------

.. toctree::
:maxdepth: 4

fabricius.generator
fabricius.plugins

Submodules
----------

fabricius.const module
----------------------

.. automodule:: fabricius.const
:members:
:undoc-members:
:show-inheritance:

fabricius.utils module
----------------------

.. automodule:: fabricius.utils
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: fabricius
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/api/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fabricius
=========

.. toctree::
:maxdepth: 4

fabricius
26 changes: 0 additions & 26 deletions docs/source/api/objects.rst

This file was deleted.

7 changes: 4 additions & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ Links
:maxdepth: 2
:caption: Fabricius API

api/objects
api/constants
api/contracts
api/fabricius
api/fabricius.generator
api/fabricius.plugins
api/modules


Indices and tables
Expand Down
18 changes: 0 additions & 18 deletions fabricius/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
from importlib.metadata import version as __package_version

from .const import FILE_STATE as FILE_STATE
from .const import Data as Data
from .errors import AlreadyCommittedError as AlreadyCommittedError
from .errors import FabriciusError as FabriciusError
from .errors import NoContentError as NoContentError
from .errors import NoDestinationError as NoDestinationError
from .file import FileGenerator as FileGenerator
from .generator import Generator as Generator
from .renderer import ChevronRenderer as ChevronRenderer
from .renderer import PythonFormatRenderer as PythonFormatRenderer
from .renderer import StringTemplateRenderer as StringTemplateRenderer
from .utils import camel_case as camel_case
from .utils import capital_case as capital_case
from .utils import dash_case as dash_case
from .utils import pascal_case as pascal_case
from .utils import sentence_case as sentence_case
from .utils import snake_case as snake_case

__version__ = __package_version("fabricius")
10 changes: 9 additions & 1 deletion fabricius/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import Any, Dict, Literal, TypeAlias
import os
import pathlib
from typing import Any, Dict, Literal, TypeAlias, Union

Data: TypeAlias = Dict[str, Any]
"""
Expand All @@ -15,3 +17,9 @@
* persisted
* deleted
"""

PathStrOrPath = Union[str, os.PathLike[str], pathlib.Path]
"""
Represent a path as a :py:class:`str` or a :py:class:`pathlib.Path` object.
Typically what's used to treat path in Fabricius.
"""
5 changes: 0 additions & 5 deletions fabricius/contracts/__init__.py

This file was deleted.

24 changes: 0 additions & 24 deletions fabricius/contracts/file_base.py

This file was deleted.

0 comments on commit 8ba0343

Please sign in to comment.