Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Aug 29, 2024
2 parents f5b7e93 + e6aaf13 commit b611747
Show file tree
Hide file tree
Showing 71 changed files with 395 additions and 388 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/cache-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Cleanup caches after merge
on:
pull_request:
types:
- closed
workflow_dispatch:

jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
# `actions:write` permission is required to delete caches
# See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id
actions: write
contents: read

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Cleanup cache
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH --limit 100 --sort size | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
- name: Create Github release
id: create_release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ jobs:
run: |
mkdir reports/ || echo "Directory exists"
pip install -e . --no-build-isolation
./run_tests.sh
# run both tests ad doctests
./run_tests.sh etl_entities/hwm tests
- name: Upload coverage results
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -105,10 +106,9 @@ jobs:
- name: Download all coverage reports
uses: actions/download-artifact@v4
with:
path: reports

- name: Move coverage data to the root folder
run: find reports -type f -exec mv '{}' reports \;
path: reports/
pattern: coverage-*
merge-multiple: true

- name: Generate coverate reports
run: ./combine_coverage.sh
Expand All @@ -119,8 +119,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./reports/coverage.xml
fail_ci_if_error: true
# TODO: remove after fixing https://github.com/codecov/codecov-cli/issues/367
plugin: gcov
plugin: noop

- name: All done
run: echo 1
32 changes: 20 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-ast
- id: check-case-conflict
Expand Down Expand Up @@ -48,13 +48,13 @@ repos:
- --no-extra-eol

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: [-w]

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
rev: v2.14.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2', --offset, '2']
Expand All @@ -78,30 +78,38 @@ repos:
- id: text-unicode-replacement-char

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py37-plus, --keep-runtime-typing]

- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0
rev: 24.8.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
rev: 1.18.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==24.2.0
- black==24.4.2

- repo: https://github.com/Lucas-C/pre-commit-hooks-bandit
rev: v1.0.6
- repo: https://github.com/pycqa/bandit
rev: 1.7.9
hooks:
- id: python-bandit-vulnerability-check
# TODO: remove line below after https://github.com/PyCQA/bandit/issues/488
args: [-lll, --recursive, -x, './venv/*,./tests/*,./.pytest_cache/*', .]
- id: bandit
args:
- --aggregate=file
- -iii
- -ll
require_serial: true

- repo: meta
hooks:
Expand Down
3 changes: 3 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ build:
os: ubuntu-22.04
tools:
python: '3.12'
jobs:
post_checkout:
- git fetch --unshallow || true

python:
install:
Expand Down
2 changes: 1 addition & 1 deletion .spdx-license-header.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
SPDX-FileCopyrightText: 2021-2024 MTS PJSC
SPDX-License-Identifier: Apache-2.0
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021-2024 MTS (Mobile Telesystems). All rights reserved.
Copyright 2021-2024 MTS PJSC. All rights reserved.

Apache License
Version 2.0, January 2004
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ coverage:
status:
project:
default:
target: 96%
target: 94%
threshold: 1%
7 changes: 7 additions & 0 deletions docs/changelog/2.3.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
2.3.1 (2024-08-29)
==================

Improvements
------------

- Replace all ``assert`` in documentation with doctest syntax. This should make documentation more readable. (:github:pull:`91`)
1 change: 1 addition & 0 deletions docs/changelog/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:caption: Changelog

DRAFT
2.3.1
2.3.0
2.2.0
2.1.2
Expand Down
27 changes: 18 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# -- Project information -----------------------------------------------------

project = "etl-entities"
copyright = "2021-2024 MTS (Mobile Telesystems)"
copyright = "2021-2024 MTS PJSC"
author = "DataOps.ETL"

# The version info for the project you're documenting, acts as replacement for
Expand All @@ -51,9 +51,25 @@
"sphinx.ext.autosummary",
"sphinx_toolbox.github",
"sphinxcontrib.towncrier", # provides `towncrier-draft-entries` directive
"sphinx_last_updated_by_git",
]

numpydoc_show_class_members = False

# prevent >>>, ... and doctest outputs from copying
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
copybutton_prompt_is_regexp = True
copybutton_copy_empty_lines = False
copybutton_only_copy_prompt_lines = True

towncrier_draft_autoversion_mode = "draft"
towncrier_draft_include_empty = False
towncrier_draft_working_directory = PROJECT_ROOT_DIR

github_username = "MobileTeleSystems"
github_repository = "etl-entities"


# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand All @@ -67,13 +83,13 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "furo"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_extra_path = ["robots.txt"]

# The master toctree document.
master_doc = "index"
Expand All @@ -95,10 +111,3 @@

# Output file base name for HTML help builder.
htmlhelp_basename = "etl-entities-doc"

towncrier_draft_autoversion_mode = "draft"
towncrier_draft_include_empty = False
towncrier_draft_working_directory = PROJECT_ROOT_DIR

github_username = "MobileTeleSystems"
github_repository = "etl-entities"
5 changes: 5 additions & 0 deletions docs/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
User-agent: *
Allow: /*/stable/
Allow: /en/stable/ # Fallback for bots that don't understand wildcards
Disallow: /
Sitemap: https://etl-entities.readthedocs.io/sitemap.xml
2 changes: 1 addition & 1 deletion etl_entities/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.3.1
2 changes: 1 addition & 1 deletion etl_entities/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
# SPDX-FileCopyrightText: 2021-2024 MTS PJSC
# SPDX-License-Identifier: Apache-2.0
import os

Expand Down
2 changes: 1 addition & 1 deletion etl_entities/entity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
# SPDX-FileCopyrightText: 2021-2024 MTS PJSC
# SPDX-License-Identifier: Apache-2.0
# isort: skip_file

Expand Down
2 changes: 1 addition & 1 deletion etl_entities/hwm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
# SPDX-FileCopyrightText: 2021-2024 MTS PJSC
# SPDX-License-Identifier: Apache-2.0
from etl_entities.hwm.column.column_hwm import ColumnHWM
from etl_entities.hwm.column.date_hwm import ColumnDateHWM
Expand Down
2 changes: 1 addition & 1 deletion etl_entities/hwm/column/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
# SPDX-FileCopyrightText: 2021-2024 MTS PJSC
# SPDX-License-Identifier: Apache-2.0
47 changes: 17 additions & 30 deletions etl_entities/hwm/column/column_hwm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
# SPDX-FileCopyrightText: 2021-2024 MTS PJSC
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations

Expand Down Expand Up @@ -69,15 +69,10 @@ def __add__(self: ColumnHWMType, value: ColumnValueType) -> ColumnHWMType:
Examples
--------
.. code:: python
# assume val2 == val1 + inc
hwm1 = ColumnHWM(value=val1, ...)
hwm2 = ColumnHWM(value=val2, ...)
# same as ColumnHWM(value=hwm1.value + inc, ...)
assert hwm1 + inc == hwm2
>>> hwm = ColumnHWM(value=100, name="my_hwm")
>>> hwm = hwm + 2
>>> hwm.value
102
"""

new_value = self.value + value # type: ignore[operator]
Expand Down Expand Up @@ -106,15 +101,10 @@ def __sub__(self: ColumnHWMType, value: ColumnValueType) -> ColumnHWMType:
Examples
--------
.. code:: python
# assume val2 == val1 - dec
hwm1 = ColumnHWM(value=val1, ...)
hwm2 = ColumnHWM(value=val2, ...)
# same as ColumnHWM(value=hwm1.value - dec, ...)
assert hwm1 - dec == hwm2
>>> hwm = ColumnHWM(value=100, name="my_hwm")
>>> hwm = hwm - 2
>>> hwm.value
98
"""

new_value = self.value - value # type: ignore[operator]
Expand Down Expand Up @@ -164,17 +154,14 @@ def update(self: ColumnHWMType, value: ColumnValueType) -> ColumnHWMType:
Examples
--------
.. code:: python
from etl_entities.hwm import ColumnIntHWM
hwm = ColumnIntHWM(value=1, ...)
hwm.update(2)
assert hwm.value == 2
hwm.update(1)
assert hwm.value == 2 # value cannot decrease
>>> from etl_entities.hwm import ColumnIntHWM
>>> hwm = ColumnIntHWM(value=1, name="my_hwm")
>>> hwm = hwm.update(2)
>>> hwm.value
2
>>> hwm = hwm.update(1)
>>> hwm.value # value cannot decrease
2
"""

if self.value is None:
Expand Down
2 changes: 1 addition & 1 deletion etl_entities/hwm/column/date_hwm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
# SPDX-FileCopyrightText: 2021-2024 MTS PJSC
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion etl_entities/hwm/column/datetime_hwm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
# SPDX-FileCopyrightText: 2021-2024 MTS PJSC
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion etl_entities/hwm/column/int_hwm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
# SPDX-FileCopyrightText: 2021-2024 MTS PJSC
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion etl_entities/hwm/file/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
# SPDX-FileCopyrightText: 2021-2024 MTS PJSC
# SPDX-License-Identifier: Apache-2.0
2 changes: 1 addition & 1 deletion etl_entities/hwm/file/file_hwm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2021-2024 MTS (Mobile Telesystems)
# SPDX-FileCopyrightText: 2021-2024 MTS PJSC
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations

Expand Down
Loading

0 comments on commit b611747

Please sign in to comment.