Skip to content

Commit f26e4cf

Browse files
authored
Merge pull request #11 from lpm0073/next
fix: move __version__.py to the root
2 parents 642f069 + 1da5f32 commit f26e4cf

File tree

13 files changed

+56
-75
lines changed

13 files changed

+56
-75
lines changed

.github/workflows/tests.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,24 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/[email protected]
13+
uses: actions/checkout@v4
14+
1415
- name: Set up Python 3.x
1516
uses: actions/setup-python@v4
1617
with:
17-
python-version: "3.8"
18+
python-version: "3.11"
19+
1820
- name: Install requirements
19-
run: python -m pip install -r requirements/local.txt
20-
- name: Lint
21-
run: pre-commit run --all-files
22-
- name: Unit tests
23-
run: python -m tests
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r ./requirements/local.txt
24+
25+
- name: secure_logger Unit tests
26+
run: |
27+
export PYTHONPATH=$PYTHONPATH:$(pwd)
28+
python -m unittest discover -s secure_logger/tests/
29+
30+
- name: setup.py tests
31+
run: |
32+
export PYTHONPATH=$PYTHONPATH:$(pwd)
33+
python -m unittest setup_test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.env
2+
venv
23
# .gitignore for edx-platform.
34
# There's a lot here, please try to keep it organized.
45

@@ -12,6 +13,7 @@ requirements/private.txt
1213

1314
### Python artifacts
1415
*.pyc
16+
__pycache__/
1517

1618
### Editor and IDE artifacts
1719
*~

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
default_language_version:
22
# default language version for each language
3-
python: python3.8
3+
python: python3.11
44
repos:
55
- repo: https://github.com/ambv/black
66
rev: 23.3.0

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -------------------------------------------------------------------------
22
# build a package for PyPi
33
# -------------------------------------------------------------------------
4-
.PHONY: build requirements deps-update deps-init
4+
.PHONY: build requirements deps-update init
55

66
pre-commit:
77
pre-commit run --all-files
@@ -12,10 +12,12 @@ requirements:
1212
python -m piptools compile --extra local --upgrade --resolver backtracking -o ./requirements/local.txt pyproject.toml
1313
pip install -r requirements/local.txt
1414

15-
deps-init:
16-
rm -rf .tox
17-
python -m pip install --upgrade pip wheel
18-
python -m pip install --upgrade -r requirements/local.txt -e .
15+
init:
16+
python3.11 -m venv venv && \
17+
source venv/bin/activate && \
18+
rm -rf .tox && \
19+
python -m pip install --upgrade pip wheel && \
20+
python -m pip install --upgrade -r requirements/local.txt -e . && \
1921
python -m pip check
2022

2123
report:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Pull requests are welcome, and you can also contact [Lawrence McDaniel](https://
123123
### Getting Started With Local development
124124

125125
- Use the same virtual environment that you use for edx-platform
126-
- Ensure that your Python interpreter to 3.8x
126+
- Ensure that your Python interpreter to 3.11
127127
- install black: <https://pypi.org/project/black/>
128128
- install flake8: <https://flake8.pycqa.org/en/latest/>
129129
- install flake8-coding: <https://pypi.org/project/flake8-coding/>
File renamed without changes.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ build-backend = "setuptools.build_meta:__legacy__"
2525
[project]
2626
name = "secure-logger"
2727
version = "0.1.6"
28+
license = { file = "LICENSE.txt" }
2829
authors = [
2930
{ name="Lawrence McDaniel", email="[email protected]" }
3031
]
3132
description = "A decorator to generate secure, well-formatted log entries"
33+
dynamic = ["maintainers"]
3234
readme = "README.md"
3335
requires-python = ">=3.6"
3436
classifiers = [

requirements/local.txt

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,3 @@
1-
#
2-
# This file is autogenerated by pip-compile with Python 3.8
3-
# by the following command:
4-
#
5-
# pip-compile --extra=local --output-file=./requirements/local.txt --resolver=backtracking pyproject.toml
6-
#
7-
8-
# dev dependencies
91
black==23.3.0
10-
# via secure-logger (pyproject.toml)
11-
cfgv==3.3.1
12-
# via pre-commit
13-
click==8.1.3
14-
# via black
15-
distlib==0.3.6
16-
# via virtualenv
17-
filelock==3.12.0
18-
# via virtualenv
192
flake8==6.0.0
20-
# via secure-logger (pyproject.toml)
21-
identify==2.5.23
22-
# via pre-commit
23-
mccabe==0.7.0
24-
# via flake8
25-
mypy-extensions==1.0.0
26-
# via black
27-
nodeenv==1.7.0
28-
# via pre-commit
29-
packaging==23.1
30-
# via black
31-
pathspec==0.11.1
32-
# via black
33-
platformdirs==3.4.0
34-
# via
35-
# black
36-
# virtualenv
373
pre-commit==3.2.2
38-
# via secure-logger (pyproject.toml)
39-
pycodestyle==2.10.0
40-
# via flake8
41-
pyflakes==3.0.1
42-
# via flake8
43-
pyyaml==6.0
44-
# via pre-commit
45-
tomli==2.0.1
46-
# via black
47-
typing-extensions==4.5.0
48-
# via black
49-
virtualenv==20.22.0
50-
# via pre-commit
51-
52-
# The following packages are considered to be unsafe in a requirements file:
53-
# setuptools

secure_logger/tests/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# -*- coding: utf-8 -*-
2+
"""This is the initialization file for the Python package tests."""

tests.py renamed to secure_logger/tests/tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_decorator_output(self):
9696
hello_world = "'hello world'"
9797

9898
expected_output = (
99-
"INFO:secure_logger.decorators:secure_logger: __main__.mock_decorated_def() ['<__main__.TestModuleDefDecorator testMethod=test_decorator_output>', "
99+
"INFO:secure_logger.decorators:secure_logger: tests.mock_decorated_def() ['<tests.TestModuleDefDecorator testMethod=test_decorator_output>', "
100100
+ hello_world
101101
)
102102
with self.assertLogs(level=logging.DEBUG) as cm:
@@ -128,7 +128,7 @@ def decorator_with_custom_params(self, test_dict, test_list):
128128
mock_class = MockClass()
129129

130130
def test_class_method_with_default_params(self):
131-
expected_output = "INFO:secure_logger.decorators:secure_logger: __main__.decorator_with_defaults() ['<__main__.TestClassMethodDecorator.MockClass"
131+
expected_output = "INFO:secure_logger.decorators:secure_logger: tests.decorator_with_defaults() ['<tests.TestClassMethodDecorator.MockClass"
132132

133133
with self.assertLogs(level=logging.DEBUG) as cm:
134134
self.mock_class.decorator_with_defaults(self.test_dict, self.test_list)
@@ -144,7 +144,7 @@ class MockDecoratedClass(object):
144144

145145
pass
146146

147-
expected_output = "INFO:secure_logger.decorators:secure_logger: __main__.MockDecoratedClass. "
147+
expected_output = "INFO:secure_logger.decorators:secure_logger: tests.MockDecoratedClass. "
148148

149149
with self.assertLogs(level=logging.DEBUG) as cm:
150150
mock_decoratorated_class = MockDecoratedClass()

setup.cfg

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
[flake8]
22
ignore = E128,E731,W503,W504
3-
max-line-length = 512
3+
max-line-length = 120
44
exclude=venv/
55

66
[tool:pytest]
7-
norecursedirs=venv* .tox .eggs build dist secure_logger.egg-info secure_logger/mongodb
8-
addopts = --doctest-modules --doctest-ignore-import-errors --nomigrations --cov=secure_logger --cov-report html --cov-report term
7+
norecursedirs=venv* .tox .eggs build dist secure_logger.egg-info
98

109
[isort]
1110
combine_as_imports = true
@@ -17,6 +16,6 @@ line_length=128
1716

1817
[pycodestyle]
1918
count = False
20-
max-line-length = 512
19+
max-line-length = 120
2120
statistics = True
2221
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D202,D203,D205,D210,D212,D400,D406,D407,D412,D413

setup_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- coding: utf-8 -*-
2+
import subprocess
3+
import unittest
4+
5+
6+
class TestSetup(unittest.TestCase):
7+
"""Test setup.py."""
8+
9+
def test_setup_syntax(self):
10+
"""Test setup.py syntax."""
11+
result = subprocess.run(["python", "setup.py", "check"], capture_output=True, text=True)
12+
assert result.returncode == 0, f"setup.py failed with output:\n{result.stdout}\n{result.stderr}"
13+
assert not result.stderr, "Expected no error output"
14+
15+
16+
if __name__ == "__main__":
17+
unittest.main()

tox.ini

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ skip_missing_interpreters = true
66

77
[gh-actions]
88
python =
9-
3.8: gitlint,py38,flake8
10-
3.9: gitlint,py39,flake8
11-
3.10: gitlint,py310,flake8
129
3.11: gitlint,py311,flake8
1310

1411
[testenv]
15-
deps = -rrequirements.txt
12+
deps = -rrequirements/local.txt
1613
commands = pytest
1714

1815
[flake8]

0 commit comments

Comments
 (0)