diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 425aeb50..36e09186 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -7,14 +7,16 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -e .[dev] + python -m pip install tox - name: Build documentation run: | - sphinx-build -a -b html -W --keep-going docs/ docs/_build + tox -e docs diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4cf0a465..54fc1e8e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,8 +7,16 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 with: python-version: '3.10' - - uses: pre-commit/action@v3.0.0 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox + - name: Run linters + run: | + tox -e lint diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6fb188df..a4a2d1d6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,8 +28,9 @@ jobs: python-version: '3.10' runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -37,9 +38,9 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install tox - - name: Run tox + - name: Run tests run: | - tox -e py + tox -e tests - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 with: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 762b154d..5d43e5e3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,7 +14,7 @@ `0.6.0`_ (2022-01-29) ===================== -- Remove internal use of ``pickle.loads()`` considered as a security vulnerability referenced as `CVE-2022-0329 `_ (`#563 `_). +- Remove internal use of ``pickle.loads()`` to fix the (finally rejected) security vulnerability referenced as `CVE-2022-0329 `_ (`#563 `_). - Modify coroutine sink to make it discard log messages when ``loop=None`` and no event loop is running (due to internally using ``asyncio.get_running_loop()`` in place of ``asyncio.get_event_loop()``). - Remove the possibility to add a coroutine sink with ``enqueue=True`` if ``loop=None`` and no event loop is running. - Change default encoding of file sink to be ``utf8`` instead of ``locale.getpreferredencoding()`` (`#339 `_). diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 9436a7ca..4f91b529 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -41,7 +41,7 @@ Prefer using a relatively recent Python version as some dependencies required fo 3. Activate your virtual environment:: - $ python -m virtualenv env + $ python -m venv env $ source env/bin/activate 4. Install `Loguru` in development mode:: @@ -61,7 +61,7 @@ Prefer using a relatively recent Python version as some dependencies required fo 7. Implement the modifications wished. During the process of development, honor `PEP 8`_ as much as possible. 8. Add unit tests (don't hesitate to be exhaustive!) and ensure none are failing using:: - $ tox + $ tox -e tests 9. Remember to update documentation if required. 10. If your development modifies `Loguru` behavior, update the ``CHANGELOG.rst`` file with what you improved. diff --git a/tox.ini b/tox.ini index c298c833..def22811 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,28 @@ [tox] -skip_missing_interpreters = True -envlist = py{35,36,37,38,39,310,py3} +envlist = lint, tests, docs [testenv] setenv = PYTHONPATH = {toxinidir} extras = dev + +[testenv:lint] +description = Run linting checks on all project files. +commands = + pre-commit run --show-diff-on-failure --all-files + +[testenv:tests] +description = Run the tests and generate code coverage. commands = + coverage erase pytest --cov loguru/ --cov-report= coverage report -m coverage xml +[testenv:docs] +description = Build the HTML documentation. +commands = + sphinx-build -a -b html -W --keep-going docs/ docs/build + [isort] line_length = 100 profile = black @@ -23,12 +36,10 @@ ignore = exclude = tests/exceptions/source - [pytest] addopts = -l testpaths = tests - [mypy] mypy_path = $MYPY_CONFIG_FILE_DIR/loguru