diff --git a/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE.md similarity index 99% rename from ISSUE_TEMPLATE rename to .github/ISSUE_TEMPLATE.md index ac4e32d4..856248df 100644 --- a/ISSUE_TEMPLATE +++ b/.github/ISSUE_TEMPLATE.md @@ -12,4 +12,3 @@ If applicable, code to reproduce the issue and/or the stacktrace of the issue - Python distribution/environment: CPython/Anaconda/IPython/IDLE - Operating System: Windows 10, Ubuntu Linux, etc. - Package version: `import progressbar; print(progressbar.__version__)` - diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 44ccfb21..b634a35f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -20,23 +20,23 @@ jobs: strategy: fail-fast: false matrix: - language: [ python, javascript ] + language: [ python ] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@v2 - if: ${{ matrix.language == 'python' || matrix.language == 'javascript' }} + uses: github/codeql-action/autobuild@v3 + if: ${{ matrix.language == 'python' }} - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2ac27164..baa93cfe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,9 +2,17 @@ name: tox on: push: + branches: [develop] pull_request: workflow_dispatch: +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +permissions: + contents: read + jobs: perf-budget: name: Performance budget @@ -53,10 +61,10 @@ jobs: experimental: true - python-version: '3.14' tox-env: docs - - python-version: '3.14' - tox-env: black - python-version: '3.14' tox-env: ruff + - python-version: '3.14' + tox-env: codespell steps: - uses: actions/checkout@v6 @@ -74,3 +82,27 @@ jobs: # showing the failing step in the logs continue-on-error: ${{ matrix.experimental || false }} run: tox -e ${{ matrix.tox-env }} + + windows: + name: tox (windows / py312) + runs-on: windows-latest + timeout-minutes: 10 + env: + # Force UTF-8 I/O so unicode-marker tests (e.g. test_unicode) don't + # hit UnicodeEncodeError against the legacy Windows code page under + # pytest's fd-level capture. + PYTHONUTF8: '1' + steps: + - uses: actions/checkout@v6 + - name: Set up Python 3.12 + uses: actions/setup-python@v6 + with: + python-version: '3.12' + - name: Install dependencies + run: | + python -m pip install --upgrade pip tox + - name: Test with tox + # The 100% coverage gate cannot be met on Windows: POSIX-only + # branches never execute there, so run without the coverage gate + # (`--no-cov` posarg). Linux jobs still enforce full coverage. + run: tox -e py312 -- --no-cov diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 5c47a9d7..eb76940c 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -8,10 +8,12 @@ on: jobs: stale: runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write steps: - uses: actions/stale@v8 with: days-before-issue-stale: 30 exempt-issue-labels: in-progress,help-wanted,pinned,security,enhancement exempt-all-assignees: true - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e226ea93..1d38c796 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,13 +2,15 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + rev: v6.0.0 hooks: + - id: end-of-file-fixer - id: trailing-whitespace - id: check-yaml - id: check-added-large-files -- repo: https://gitlab.com/pycqa/flake8 - rev: 3.7.9 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.15.20 hooks: - - id: flake8 + - id: ruff-check + - id: ruff-format diff --git a/AGENTS.md b/AGENTS.md index 66808cd5..36b8633b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,4 +13,4 @@ Stats: 1 obs (414t read) | 19,980t work | 98% savings 2388 12:04a ✅ CI/tox config updated to test Python 3.10–3.15 Access 20k tokens of past work via get_observations([IDs]) or mem-search skill. - \ No newline at end of file + diff --git a/LICENSE b/LICENSE index 38887b7c..06ba3899 100644 --- a/LICENSE +++ b/LICENSE @@ -25,4 +25,3 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/MANIFEST.in b/MANIFEST.in index f387924e..e44ef18a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,12 +1,8 @@ recursive-exclude *.pyc recursive-exclude *.pyo -recursive-exclude *.html -include AUTHORS.rst include CHANGES.rst include CONTRIBUTING.rst include LICENSE include README.rst include examples.py -include requirements.txt -include Makefile include pytest.ini diff --git a/README.rst b/README.rst index f0d7b1fb..c42b5c1a 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ Text progress bar library for Python. Build status: .. image:: https://github.com/WoLpH/python-progressbar/actions/workflows/main.yml/badge.svg - :alt: python-progressbar test status + :alt: python-progressbar test status :target: https://github.com/WoLpH/python-progressbar/actions Coverage: diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 91ffa33e..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,26 +0,0 @@ -image: Visual Studio 2022 -environment: - matrix: - - PYTHON: "C:\\Python310-x64" - TOX_ENV: "py310" - - PYTHON: "C:\\Python311-x64" - TOX_ENV: "py311" - - PYTHON: "C:\\Python312-x64" - TOX_ENV: "py312" - - PYTHON: "C:\\Python313-x64" - TOX_ENV: "py313" - - PYTHON: "C:\\Python314-x64" - TOX_ENV: "py314" - - -init: - - "%PYTHON%\\python -V" - - "%PYTHON%\\python -c \"import struct;print(8 * struct.calcsize('P'))\"" - -install: - - "%PYTHON%\\python -m pip install --upgrade pip tox" - -build: false # Not a C# project, build stuff at the test step instead. - -test_script: - - "%PYTHON%\\python -m tox -e %TOX_ENV%" diff --git a/benchmarks/results.json b/benchmarks/results.json index 8c402aae..b8a8141f 100644 --- a/benchmarks/results.json +++ b/benchmarks/results.json @@ -104,4 +104,4 @@ } } } -} \ No newline at end of file +} diff --git a/circle.yml b/circle.yml deleted file mode 100644 index cd50d56f..00000000 --- a/circle.yml +++ /dev/null @@ -1,8 +0,0 @@ -dependencies: - pre: - - pip install -r tests/requirements.txt - -test: - override: - - py.test - diff --git a/docs/examples.rst b/docs/examples.rst index 769c4d47..39b974e2 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -2,4 +2,3 @@ Examples =================== .. literalinclude:: ../examples.py - diff --git a/docs/index.rst b/docs/index.rst index 58b16d58..c8ff0e92 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -25,4 +25,3 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` - diff --git a/docs/usage.rst b/docs/usage.rst index 6aa03303..6bbebe2c 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -67,4 +67,3 @@ Bar with custom widgets ]) for i in bar(range(20)): time.sleep(0.1) - diff --git a/pyproject.toml b/pyproject.toml index 230ee53f..54f1aaa3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,11 @@ [build-system] build-backend = 'setuptools.build_meta' +# setuptools-scm is required at build time: its setuptools file-finder +# entry point is what populates the sdist with the full set of +# git-tracked files (docs/, tests/ data, tox.ini, .github/, ...). +# Dropping it silently shrinks the sdist and omits the test harness, so +# it must stay even though the version itself is static (see +# tool.setuptools.dynamic below). requires = ['setuptools', 'setuptools-scm'] [project] @@ -124,22 +130,15 @@ docs = [ ] tests = [ 'dill>=0.3.6', - 'flake8>=3.7.7', 'freezegun>=0.3.11', 'pytest-cov>=2.6.1', - 'pytest-mypy', 'pytest>=4.6.9', - 'sphinx>=1.8.5', 'pywin32; sys_platform == "win32"', ] [dependency-groups] dev = ['progressbar2[docs,tests]'] -[tool.black] -line-length = 79 -skip-string-normalization = true - [tool.codespell] skip = '*/htmlcov,./docs/_build,*.asc' ignore-words-list = 'datas,numbert' diff --git a/pytest.ini b/pytest.ini index 1f00ecbd..6cec5595 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,15 +1,12 @@ [pytest] python_files = - progressbar/*.py tests/*.py +# Coverage flags intentionally live in the tox [testenv] commands, not +# here, so a bare `pytest -k foo` stays fast. CI enforces the 100% gate +# via tox. `--doctest-modules` still collects progressbar/*.py doctests +# regardless of `python_files` (which only scopes test-module collection). addopts = - --cov progressbar - --cov-report=html - --cov-report=term-missing - --cov-report=xml - --cov-config=./pyproject.toml - --no-cov-on-fail --doctest-modules norecursedirs = diff --git a/ruff.toml b/ruff.toml index a1056975..eb467554 100644 --- a/ruff.toml +++ b/ruff.toml @@ -113,4 +113,3 @@ max-line-length = 79 [lint.flake8-pytest-style] mark-parentheses = true - diff --git a/tests/api_surface_snapshot.json b/tests/api_surface_snapshot.json index e0b19d31..05405e2c 100644 --- a/tests/api_surface_snapshot.json +++ b/tests/api_surface_snapshot.json @@ -456,8 +456,6 @@ "annotations": "_Feature" }, "progressbar.utils": { - "@py_assert1": "NoneType", - "@py_assert2": "NoneType", "AttributeDict": "classsignature-unavailable", "Iterable": "re-export", "Iterator": "re-export", diff --git a/tox.ini b/tox.ini index 3f485a1d..12c7e62d 100644 --- a/tox.ini +++ b/tox.ini @@ -7,10 +7,10 @@ envlist = py314 py315 docs - black ruff -; mypy -; codespell + codespell +; mypy is intentionally excluded: 11 non-gating precision errors are +; documented (see PR 4); it stays a local-only convenience env. skip_missing_interpreters = True [testenv] @@ -19,7 +19,7 @@ deps = pyright commands = pyright - py.test --basetemp="{envtmpdir}" --confcutdir=.. {posargs} + py.test --cov progressbar --cov-report=html --cov-report=term-missing --cov-report=xml --cov-config=./pyproject.toml --no-cov-on-fail --basetemp="{envtmpdir}" --confcutdir=.. {posargs} skip_install = true [testenv:mypy] @@ -28,11 +28,6 @@ basepython = python3 deps = mypy commands = mypy {toxinidir}/progressbar -[testenv:black] -basepython = python3 -deps = black -commands = black --skip-string-normalization --line-length 79 {toxinidir}/progressbar - [testenv:docs] changedir = basepython = python3 @@ -40,10 +35,6 @@ deps = -r{toxinidir}/docs/requirements.txt allowlist_externals = rm mkdir -whitelist_externals = - rm - cd - mkdir commands = rm -f docs/modules.rst mkdir -p docs/_static @@ -54,7 +45,7 @@ commands = [testenv:ruff] commands = ruff check - ruff format + ruff format --check deps = ruff skip_install = true @@ -63,4 +54,3 @@ changedir = {toxinidir} commands = codespell . deps = codespell skip_install = true -command = codespell