Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Update Python Development Release
on:
- push


jobs:
publish_release:
if: github.repository_owner == 'Synodic-Software'
uses: synodic-software/.github/.github/workflows/python-merge.yml@stable
with:
repository_url: https://upload.pypi.org/legacy/
secrets:
token: ${{ secrets.PYPI_API_TOKEN }}
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:

jobs:
publish_release:
if: github.event_name == 'release' && github.event.action == 'published'
if: github.repository_owner == 'Synodic-Software'
uses: synodic-software/.github/.github/workflows/python-publish.yml@stable
with:
repository_url: https://upload.pypi.org/legacy/
secrets:
token: ${{ secrets.PYPI_API_TOKEN }}
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
20 changes: 12 additions & 8 deletions cppython/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import click
import tomlkit
from cppython_core.schema import GeneratorDataType, Interface
from cppython_core.schema import GeneratorDataT, Interface, InterfaceConfiguration

from cppython.project import Project, ProjectConfiguration

Expand Down Expand Up @@ -40,7 +40,9 @@ class Config:

def __init__(self):
self.pyproject_data = _create_pyproject()
self.interface = ConsoleInterface()

configuration = InterfaceConfiguration()
self.interface = ConsoleInterface(configuration)
self.configuration = ProjectConfiguration()

def create_project(self) -> Project:
Expand Down Expand Up @@ -107,7 +109,14 @@ class ConsoleInterface(Interface):
Interface implementation to pass to the project
"""

def read_generator_data(self, generator_data_type: Type[GeneratorDataType]) -> GeneratorDataType:
def __init__(self, configuration: InterfaceConfiguration) -> None:
super().__init__(configuration)

@staticmethod
def name() -> str:
return "console"

def read_generator_data(self, generator_data_type: Type[GeneratorDataT]) -> GeneratorDataT:
"""
Requests generator information
"""
Expand All @@ -117,8 +126,3 @@ def write_pyproject(self) -> None:
"""
Write output
"""

def register_logger(self, logger: Logger) -> None:
"""
TODO
"""
8 changes: 5 additions & 3 deletions cppython/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ def __init__(
levels = [logging.WARNING, logging.INFO, logging.DEBUG]

self._logger = logging.getLogger("cppython")
self._logger.setLevel(levels[configuration.verbosity])

interface.register_logger(self._logger)
# Add default output stream
console_handler = logging.StreamHandler()
self._logger.addHandler(console_handler)
self._logger.setLevel(levels[configuration.verbosity])

self._logger.info("Initializing project")

Expand Down Expand Up @@ -154,7 +156,7 @@ def __init__(

self._interface = interface

generator_configuration = GeneratorConfiguration(self._logger)
generator_configuration = GeneratorConfiguration()
self._generators = builder.create_generators(plugins, generator_configuration, self.pyproject)

self._logger.info("Initialized project")
Expand Down
166 changes: 83 additions & 83 deletions pdm.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ version = {use_scm = true}
[tool.pdm.dev-dependencies]
lint = [
"black>=22.3.0",
"pylint>=2.13.7",
"pylint>=2.13.8",
"isort>=5.10.1",
]
test = [
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import pytest
from cppython_core.schema import InterfaceConfiguration
from pytest_cppython.plugin import InterfaceIntegrationTests

from cppython.console import ConsoleInterface
Expand All @@ -21,4 +22,5 @@ def fixture_interface(self):
Returns:
ConsoleInterface -- The Interface object to use for the CPPython defined tests
"""
return ConsoleInterface()
configuration = InterfaceConfiguration()
return ConsoleInterface(configuration)
4 changes: 3 additions & 1 deletion tests/unit/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
API,
PEP621,
CPPythonData,
InterfaceConfiguration,
PyProject,
TargetEnum,
ToolData,
Expand Down Expand Up @@ -36,7 +37,8 @@ def fixture_interface(self) -> ConsoleInterface:
Returns:
ConsoleInterface -- The Interface object to use for the CPPython defined tests
"""
return ConsoleInterface()
configuration = InterfaceConfiguration()
return ConsoleInterface(configuration)

# Grab the API methods and parameterize them for automatic testing of the entry_points
method_list = [func for func in dir(API) if callable(getattr(API, func)) and not func.startswith("__")]
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_generator_creation(self, mocker: MockerFixture):
configuration = ProjectConfiguration()
builder = ProjectBuilder(configuration)

generator_configuration = GeneratorConfiguration(logging.getLogger(__name__))
generator_configuration = GeneratorConfiguration()
generators = builder.create_generators([], generator_configuration, default_pyproject)

assert not generators
Expand Down