Skip to content

Commit

Permalink
Merge pull request #43 from numbworks/v4.5.0
Browse files Browse the repository at this point in the history
v4.5.0
  • Loading branch information
numbworks authored Dec 18, 2024
2 parents e997343 + e6d2bce commit 768f8a3
Show file tree
Hide file tree
Showing 11 changed files with 1,958 additions and 1,344 deletions.
6 changes: 5 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ RUN wget https://github.com/jgm/pandoc/releases/download/3.4/pandoc-3.4-1-amd64.
RUN pip install mypy==1.13.0
RUN pip install pandas-stubs==2.2.3.241009
RUN pip install types-openpyxl==3.1.5.20241126
RUN pip install types-requests==2.32.0.20241016
RUN pip install types-requests==2.32.0.20241016
RUN pip install radon==6.0.1

# OTHERS
RUN pip install --upgrade pip==24.3.1
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v4.5.0
- Library:
- Feature: added support for splitting the "by month" Markdown table in clusters, so that it looks better on Github (BYMDFManager).
- Maintenance: makefile updated and expanded (compile-*, unittest-*, codemetrics-*, ..).
- Documentation:
- Feature: updated to v4.5.0.

v4.0.0 - BREAKING CHANGES
- Application:
- Feature: re-structured the whole architecture to simplify usage and future expansions.
Expand Down
Binary file modified data/Time Tracking.xlsx
Binary file not shown.
Binary file added docs/Diagrams/Diagram-BYMDFManager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Diagrams/Diagram-BYMDFManager.pptx
Binary file not shown.
17 changes: 16 additions & 1 deletion docs/docs-nwtimetracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Contact: [email protected]
| 2024-10-28 | numbworks | Updated to v3.8.0. |
| 2024-12-01 | numbworks | Updated to v3.9.0. |
| 2024-12-05 | numbworks | Updated to v4.0.0. |
| 2024-12-17 | numbworks | Updated to v4.5.0. |

## Introduction

Expand Down Expand Up @@ -140,18 +141,24 @@ The avalaible target names are:
| type-verbose | Runs a type verification task and logs everything. |
| coverage-verbose | Runs a unit test coverage calculation task and logs the % per class. |
| tryinstall-verbose | Simulates a "pip install" and logs everything. |
| compile-verbose | Runs "python" command against the module file. |
| unittest-verbose | Runs "python" command against the test files. |
| codemetrics-verbose | Runs a cyclomatic complexity analysis against all the nw*.py files in /src. |
| all-concise | Runs a batch of verification tasks and logs one summary line for each of them. |
The expected outcome for `all-concise` is:
```
MODULE_NAME: nwtimetracking
MODULE_VERSION: 4.0.0
MODULE_VERSION: 4.5.0
COVERAGE_THRESHOLD: 70%
[OK] type-concise: passed!
[OK] changelog-concise: 'CHANGELOG' updated to current version!
[OK] setup-concise: 'setup.py' updated to current version!
[OK] coverage-concise: unit test coverage >= 70%.
[OK] compile-concise: compiling the library throws no issues.
[OK] unittest-concise: '268' tests found and run.
[OK] codemetrics-concise: the cyclomatic complexity is excellent ('A').
[OK] tryinstall-concise: installation process works.
```
Expand All @@ -166,6 +173,14 @@ Considering the old-fashioned syntax adopted by both `make` and `bash`, here a s
| `$@` | Variable that stores the target name. |
| `if [[ ... ]]` | Double square brackets to enable pattern matching. |
## BYMDFManager
The scope of this class is to partition a “by month” table in smaller tables, following a custom logic.
Here a visual example of how its algorithm works:
![Diagram-BYMDFManager.png](Diagrams/Diagram-BYMDFManager.png)
## Known Issues - nwshared
If `nwshared` creates some issues for you, please refer to [its documentation on Github](https://github.com/numbworks/nwshared/blob/master/docs/docs-nwshared.md).
Expand Down
35 changes: 28 additions & 7 deletions scripts/makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# SETTINGS
.PHONY: clear makefile-info type-concise changelog-concise setup-concise coverage-concise tryinstall-concise all-concise
.PHONY: clear makefile-info type-concise changelog-concise setup-concise coverage-concise tryinstall-concise compile-concise unittest-concise codemetrics-concise all-concise
SHELL := /bin/bash
ROOT_DIR := $(shell cd .. && pwd)
MODULE_NAME = "nwtimetracking"
MODULE_VERSION = "4.0.0"
MODULE_VERSION = "4.5.0"
COVERAGE_THRESHOLD = 70

# TARGETS
# TARGETS (VERBOSE)
clear:
@clear
makefile-info:
Expand All @@ -23,7 +23,7 @@ coverage-verbose:
cd $(ROOT_DIR)/tests/; \
coverage run -m unittest $(MODULE_NAME)tests.py > /dev/null 2>&1; \
rm -rf htmlcov; \
coverage html --omit=$(MODULE_NAME)tests.py && sed -n '/<table class="index" data-sortable>/,/<\/table>/p' htmlcov/class_index.html | pandoc --from html --to plain; \
coverage html --include=$(MODULE_NAME).py && sed -n '/<table class="index" data-sortable>/,/<\/table>/p' htmlcov/class_index.html | pandoc --from html --to plain; \
sleep 3; \
rm -rf htmlcov;
tryinstall-verbose:
Expand All @@ -43,7 +43,17 @@ tryinstall-verbose:
rm -rf dist; \
rm -rf $(MODULE_NAME).egg-info; \
rm -rf venv;
compile-verbose:
@clear; \
python -m py_compile $(ROOT_DIR)/src/$(MODULE_NAME).py;
unittest-verbose:
@clear; \
python $(ROOT_DIR)/tests/$(MODULE_NAME)tests.py;
codemetrics-verbose:
@clear; \
radon cc -a -s $(ROOT_DIR)/src/$(MODULE_NAME)*.py | grep -e '^[ ]*[CFM].*' | grep -v ' - A';

# TARGETS (CONCISE)
type-concise:
@value=$$(mypy $(ROOT_DIR)/src/$(MODULE_NAME).py --disable-error-code=import-untyped | grep -c "error:"); \
value+=$$(mypy $(ROOT_DIR)/tests/$(MODULE_NAME)tests.py --disable-error-code=import-untyped --disable-error-code=import-not-found | grep -c "error:"); \
Expand All @@ -57,12 +67,23 @@ setup-concise:
coverage-concise:
@cd $(ROOT_DIR)/tests/; \
coverage run -m unittest $(MODULE_NAME)tests.py > /dev/null 2>&1; \
value=$$(coverage report --omit=$(MODULE_NAME)tests.py | grep -oP 'TOTAL\s+\d+\s+\d+\s+\K\d+(?=%)'); \
value=$$(coverage report --include=$(MODULE_NAME).py | grep -oP 'TOTAL\s+\d+\s+\d+\s+\K\d+(?=%)'); \
if [ $$value -ge $(COVERAGE_THRESHOLD) ]; then echo "[OK] $@: unit test coverage >= $(COVERAGE_THRESHOLD)%."; else echo "[WARNING] $@: unit test coverage < $(COVERAGE_THRESHOLD)%."; fi;
tryinstall-concise:
@value=$$(make tryinstall-verbose 2>&1); \
last_chars=$$(echo "$$value" | tail -c 100); \
if [[ "$$last_chars" == *"Version: $(MODULE_VERSION)"* ]]; then echo "[OK] $@: installation process works."; else echo "[WARNING] $@: installation process fails!"; fi;
compile-concise:
@value=$$(python -m py_compile $(ROOT_DIR)/src/$(MODULE_NAME).py 2>&1); \
if [ -z "$${value}" ]; then value=0; else value=1; fi; \
if [ $$value -eq 0 ]; then echo "[OK] $@: compiling the library throws no issues."; else echo "[WARNING] $@: compiling the library throws some issues."; fi;
unittest-concise:
@value=$$(python $(ROOT_DIR)/tests/$(MODULE_NAME)tests.py 2>&1 | grep -oP '(?<=Ran )\d+(?= tests)'); \
if [ -z "$${value}" ]; then value=0; fi; \
if [ $$value -gt 0 ]; then echo "[OK] $@: '$$value' tests found and run."; else echo "[WARNING] $@: '$$value' tests found and run."; fi;
codemetrics-concise:
@value=$$(radon cc -a -s $(ROOT_DIR)/src/$(MODULE_NAME)*.py | grep -oP "Average complexity: \K[A-F]"); \
if [[ "$$value" == *"A"* ]]; then echo "[OK] $@: the cyclomatic complexity is excellent ('$$value')."; else echo "[WARNING] $@: the cyclomatic complexity is not excellent ('$$value')"; fi;

# AGGREGATE TARGETS
all-concise: clear makefile-info type-concise changelog-concise setup-concise coverage-concise tryinstall-concise
# TARGETS (AGGREGATE)
all-concise: clear makefile-info type-concise changelog-concise setup-concise coverage-concise compile-concise unittest-concise codemetrics-concise tryinstall-concise
Loading

0 comments on commit 768f8a3

Please sign in to comment.