Skip to content
Snippets Groups Projects
Commit 3be5ddd5 authored by Samuel Twum's avatar Samuel Twum Committed by Anton Joubert
Browse files

SAR-189 Fixes for single namespace

Some minor fixes to documentation and setup.py.
Linting can now be run on the whole folder instead
of just a single file, since we are no longer using
a namespace.
parent 1a2724d3
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,13 @@ Change Log ...@@ -5,6 +5,13 @@ Change Log
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to `Semantic Versioning <http://semver.org/>`_. This project adheres to `Semantic Versioning <http://semver.org/>`_.
v0.4.0
******
Change packaging to use single namespace.
Usage like `from ska.logging import configure_logging` changes
to `from ska_ser_logging import configure_logging`.
v0.3.0 v0.3.0
****** ******
......
...@@ -20,13 +20,10 @@ test: ...@@ -20,13 +20,10 @@ test:
lint: lint:
# FIXME pylint needs to run twice since there is no way go gather the text and junit xml output at the same time # FIXME pylint needs to run twice since there is no way go gather the text and junit xml output at the same time
# Also note that we are linting just the single configuration.py module, since pylint has import issues
# if we call it with the src/ska/logging path - it can't find the standard library "logging". Probably since
# it is running in an importable folder with the same name.
python3 -m pip install pylint_junit pylint2junit; \ python3 -m pip install pylint_junit pylint2junit; \
cd src; \ cd src; \
pylint --output-format=parseable ska.logging.configuration | tee ../build/code_analysis.stdout; \ pylint --output-format=parseable ska_ser_logging | tee ../build/code_analysis.stdout; \
pylint --output-format=pylint2junit.JunitReporter ska.logging.configuration > ../build/reports/linting.xml; pylint --output-format=pylint2junit.JunitReporter ska_ser_logging > ../build/reports/linting.xml;
.PHONY: all test lint .PHONY: all test lint
SKA Logging Configuration Library SKA Logging Configuration Library
================================= =================================
[![Documentation Status](https://readthedocs.org/projects/ska-logging/badge/?version=latest)](https://developer.skatelescope.org/projects/ska-logging/en/latest/?badge=latest) [![Documentation Status](https://readthedocs.org/projects/ska-ser-logging/badge/?version=latest)](https://developer.skatelescope.org/projects/ska-ser-logging/en/latest/?badge=latest)
This project allows standard logging configuration across all SKA projects. The format used is described in detail This project allows standard logging configuration across all SKA projects. The format used is described in detail
on the [developer portal](https://developer.skatelescope.org/en/latest/development/logging-format.html). on the [developer portal](https://developer.skatelescope.org/en/latest/development/logging-format.html).
...@@ -17,7 +17,7 @@ For Python applications, this is as simple as: ...@@ -17,7 +17,7 @@ For Python applications, this is as simple as:
```python ```python
import logging import logging
from ska.logging import configure_logging from ska_ser_logging import configure_logging
def main(): def main():
configure_logging() configure_logging()
...@@ -29,7 +29,7 @@ be specified. It may be useful to link that to a command line option or environ ...@@ -29,7 +29,7 @@ be specified. It may be useful to link that to a command line option or environ
```python ```python
import logging import logging
from ska.logging import configure_logging from ska_ser_logging import configure_logging
def main(): def main():
configure_logging(logging.DEBUG) configure_logging(logging.DEBUG)
...@@ -45,7 +45,7 @@ No validation is done by this library. If the filter is `None` (the default), t ...@@ -45,7 +45,7 @@ No validation is done by this library. If the filter is `None` (the default), t
```python ```python
import logging import logging
from ska.logging import configure_logging from ska_ser_logging import configure_logging
class TangoDeviceTagsFilter(logging.Filter): class TangoDeviceTagsFilter(logging.Filter):
...@@ -67,7 +67,7 @@ by the default configuration. ...@@ -67,7 +67,7 @@ by the default configuration.
```python ```python
import logging.handlers import logging.handlers
from ska.logging import configure_logging from ska_ser_logging import configure_logging
ADDITIONAL_LOGGING_CONFIG = { ADDITIONAL_LOGGING_CONFIG = {
...@@ -96,7 +96,7 @@ A more practical use case is adding and removing handlers at runtime. ...@@ -96,7 +96,7 @@ A more practical use case is adding and removing handlers at runtime.
```python ```python
import logging import logging
import logging.handlers import logging.handlers
from ska.logging import configure_logging, get_default_formatter from ska_ser_logging import configure_logging, get_default_formatter
def main(): def main():
...@@ -155,7 +155,7 @@ Testing ...@@ -155,7 +155,7 @@ Testing
* Put tests into the `tests` folder * Put tests into the `tests` folder
* Use [PyTest](https://pytest.org) as the testing framework * Use [PyTest](https://pytest.org) as the testing framework
- Reference: [PyTest introduction](http://pythontesting.net/framework/pytest/pytest-introduction/) - Reference: [PyTest introduction](http://pythontesting.net/framework/pytest/pytest-introduction/)
* Run tests with `python setup.py test` * Run tests with `python3 setup.py test` or just `make test`
- Configure PyTest in `setup.py` and `setup.cfg` - Configure PyTest in `setup.py` and `setup.cfg`
* Running the test creates the `htmlcov` folder * Running the test creates the `htmlcov` folder
- Inside this folder a rundown of the issues found will be accessible using the `index.html` file - Inside this folder a rundown of the issues found will be accessible using the `index.html` file
...@@ -165,8 +165,7 @@ Code analysis ...@@ -165,8 +165,7 @@ Code analysis
------------- -------------
* Use [Pylint](https://www.pylint.org) as the code analysis framework * Use [Pylint](https://www.pylint.org) as the code analysis framework
* By default it uses the [PEP8 style guide](https://www.python.org/dev/peps/pep-0008/) * By default it uses the [PEP8 style guide](https://www.python.org/dev/peps/pep-0008/)
* Use the provided `code-analysis.sh` script in order to run the code analysis in the `module` and `tests` * Code analysis should be run by calling `make lint`. All pertaining options reside under the `.pylintrc` file.
* Code analysis should be run by calling `pylint ska.logging`. All pertaining options reside under the `.pylintrc` file.
* Code analysis should only raise document related warnings (i.e. `#FIXME` comments) before merging the code * Code analysis should only raise document related warnings (i.e. `#FIXME` comments) before merging the code
Writing documentation Writing documentation
......
...@@ -22,5 +22,5 @@ Public API Documentation ...@@ -22,5 +22,5 @@ Public API Documentation
Functions Functions
--------- ---------
.. automodule:: ska.logging .. automodule:: ska_ser_logging
:members: :members:
...@@ -2,19 +2,20 @@ ...@@ -2,19 +2,20 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import setuptools import setuptools
from setuptools import setup from setuptools import setup, find_packages
with open("README.md") as readme_file: with open("README.md") as readme_file:
readme = readme_file.read() readme = readme_file.read()
setup( setup(
name="ska_logging", name="ska_ser_logging",
description="Square Kilometre Array logging configuration library", description="Square Kilometre Array logging configuration library",
long_description=readme + "\n\n", long_description=readme + "\n\n",
long_description_content_type="text/markdown",
author="Anton Joubert", author="Anton Joubert",
author_email="ajoubert+ska@ska.ac.za", author_email="ajoubert+ska@ska.ac.za",
url="https://gitlab.com/ska-telescope/ska-logging", url="https://gitlab.com/ska-telescope/ska-ser-logging",
packages=setuptools.find_namespace_packages(where="src", include=["ska.*"]), packages=find_packages("src"),
package_dir={"": "src"}, package_dir={"": "src"},
include_package_data=True, include_package_data=True,
license="BSD license", license="BSD license",
......
File moved
...@@ -7,9 +7,9 @@ import logging.handlers ...@@ -7,9 +7,9 @@ import logging.handlers
import time import time
import pytest import pytest
import ska.logging.configuration as configuration import ska_ser_logging.configuration as configuration
from ska.logging import configure_logging, get_default_formatter from ska_ser_logging import configure_logging, get_default_formatter
@pytest.fixture @pytest.fixture
...@@ -104,7 +104,7 @@ def recording_tags_logger(): ...@@ -104,7 +104,7 @@ def recording_tags_logger():
@pytest.mark.usefixtures("reset_logging") @pytest.mark.usefixtures("reset_logging")
class TestConfigureLogging: class TestConfigureLogging:
"""Tests for :func:`~ska.logging.configuration.configure_logging`.""" """Tests for :func:`~ska_ser_logging.configuration.configure_logging`."""
def test_includes_console_handler(self, default_logger): def test_includes_console_handler(self, default_logger):
assert get_named_handler(default_logger, "console") assert get_named_handler(default_logger, "console")
...@@ -170,7 +170,7 @@ class TestConfigureLogging: ...@@ -170,7 +170,7 @@ class TestConfigureLogging:
@pytest.mark.usefixtures("reset_logging") @pytest.mark.usefixtures("reset_logging")
class TestGetDefaultFormatter: class TestGetDefaultFormatter:
"""Tests for :func:`~ska.logging.configuration.get_default_formatter`.""" """Tests for :func:`~ska_ser_logging.configuration.get_default_formatter`."""
def get_recorded_message(self, logger): def get_recorded_message(self, logger):
logger.info("test message") logger.info("test message")
...@@ -199,7 +199,7 @@ class TestGetDefaultFormatter: ...@@ -199,7 +199,7 @@ class TestGetDefaultFormatter:
class TestOverride: class TestOverride:
"""Tests for :func:`~ska.logging.configuration._override`. """Tests for :func:`~ska_ser_logging.configuration._override`.
Code based on: Code based on:
https://github.com/ska-sa/katsdpcontroller/blob/ https://github.com/ska-sa/katsdpcontroller/blob/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment