pax_global_header00006660000000000000000000000064146610074100014511gustar00rootroot0000000000000052 comment=088151eb92eaf8801d027e126d4f7a262e422424 jaraco.context-6.0.1/000077500000000000000000000000001466100741000144375ustar00rootroot00000000000000jaraco.context-6.0.1/.coveragerc000066400000000000000000000003101466100741000165520ustar00rootroot00000000000000[run] omit = # leading `*/` for pytest-dev/pytest-cov#456 */.tox/* disable_warnings = couldnt-parse [report] show_missing = True exclude_also = # jaraco/skeleton#97 @overload if TYPE_CHECKING: jaraco.context-6.0.1/.editorconfig000066400000000000000000000003661466100741000171210ustar00rootroot00000000000000root = true [*] charset = utf-8 indent_style = tab indent_size = 4 insert_final_newline = true end_of_line = lf [*.py] indent_style = space max_line_length = 88 [*.{yml,yaml}] indent_style = space indent_size = 2 [*.rst] indent_style = space jaraco.context-6.0.1/.github/000077500000000000000000000000001466100741000157775ustar00rootroot00000000000000jaraco.context-6.0.1/.github/FUNDING.yml000066400000000000000000000000361466100741000176130ustar00rootroot00000000000000tidelift: pypi/jaraco.context jaraco.context-6.0.1/.github/dependabot.yml000066400000000000000000000002241466100741000206250ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "pip" directory: "/" schedule: interval: "daily" allow: - dependency-type: "all" jaraco.context-6.0.1/.github/workflows/000077500000000000000000000000001466100741000200345ustar00rootroot00000000000000jaraco.context-6.0.1/.github/workflows/main.yml000066400000000000000000000055461466100741000215150ustar00rootroot00000000000000name: tests on: merge_group: push: branches-ignore: # temporary GH branches relating to merge queues (jaraco/skeleton#93) - gh-readonly-queue/** tags: # required if branches-ignore is supplied (jaraco/skeleton#103) - '**' pull_request: permissions: contents: read env: # Environment variable to support color support (jaraco/skeleton#66) FORCE_COLOR: 1 # Suppress noisy pip warnings PIP_DISABLE_PIP_VERSION_CHECK: 'true' PIP_NO_PYTHON_VERSION_WARNING: 'true' PIP_NO_WARN_SCRIPT_LOCATION: 'true' # Ensure tests can sense settings about the environment TOX_OVERRIDE: >- testenv.pass_env+=GITHUB_*,FORCE_COLOR jobs: test: strategy: # https://blog.jaraco.com/efficient-use-of-ci-resources/ matrix: python: - "3.8" - "3.12" platform: - ubuntu-latest - macos-latest - windows-latest include: - python: "3.9" platform: ubuntu-latest - python: "3.10" platform: ubuntu-latest - python: "3.11" platform: ubuntu-latest - python: pypy3.10 platform: ubuntu-latest runs-on: ${{ matrix.platform }} continue-on-error: ${{ matrix.python == '3.13' }} steps: - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} allow-prereleases: true - name: Install tox run: python -m pip install tox - name: Run run: tox collateral: strategy: fail-fast: false matrix: job: - diffcov - docs runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Python uses: actions/setup-python@v4 with: python-version: 3.x - name: Install tox run: python -m pip install tox - name: Eval ${{ matrix.job }} run: tox -e ${{ matrix.job }} check: # This job does nothing and is only used for the branch protection if: always() needs: - test - collateral runs-on: ubuntu-latest steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: jobs: ${{ toJSON(needs) }} release: permissions: contents: write needs: - check if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v4 with: python-version: 3.x - name: Install tox run: python -m pip install tox - name: Run run: tox -e release env: TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jaraco.context-6.0.1/.pre-commit-config.yaml000066400000000000000000000001641466100741000207210ustar00rootroot00000000000000repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.1.8 hooks: - id: ruff - id: ruff-format jaraco.context-6.0.1/.readthedocs.yaml000066400000000000000000000005161466100741000176700ustar00rootroot00000000000000version: 2 python: install: - path: . extra_requirements: - doc # required boilerplate readthedocs/readthedocs.org#10401 build: os: ubuntu-lts-latest tools: python: latest # post-checkout job to ensure the clone isn't shallow jaraco/skeleton#114 jobs: post_checkout: - git fetch --unshallow || true jaraco.context-6.0.1/LICENSE000066400000000000000000000017771466100741000154600ustar00rootroot00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jaraco.context-6.0.1/NEWS.rst000066400000000000000000000051111466100741000157430ustar00rootroot00000000000000v6.0.1 ====== Bugfixes -------- - Removed type declarations as suggested by Gemini. (#13) v6.0.0 ====== Bugfixes -------- - Fixed bug in repo_context where standard output from git would not be hidden (because git emits standard output on the stderr stream). Deprecations and Removals ------------------------- - Removed deprecated 'tarball_context', 'infer_compression', and 'null' contexts. v5.3.0 ====== Features -------- - Deprecate infer_compression, as it was used primarily for deferring to the tar command. Bugfixes -------- - Enable 'transparent' compression in the tarfile context. v5.2.0 ====== Features -------- - Implemented tarfile using native functionality and avoiding subprocessing, making it portable. (#5) v5.1.0 ====== Features -------- - Implement experimental _compose for composing context managers. If you wish to use this function, please comment in the issue regarding your thoughts on the ordering. (#6) - Deprecate null context. (#7) v5.0.0 ====== Features -------- - Renamed tarball_context to tarball and deprecated tarball_context compatibility shim. (#3) - Disentangle pushd from tarball. (#4) Deprecations and Removals ------------------------- - Removed deprecated 'runner' parameter to tarball_context. v4.3.0 ====== Deprecated ``runner`` parameter to ``tarball_context``. v4.2.1 ====== Added test for ``pushd``. v4.2.0 ====== Added ``on_interrupt`` decorator. v4.1.2 ====== Packaging refresh. Enrolled with Tidelift. v4.1.1 ====== Fixed some docs rendering issues. v4.1.0 ====== To the ``ExceptionTrap``, added ``.raises()`` and ``.passes`` decorators. v4.0.0 ====== Moved ``dependency_context`` and ``run`` to `jaraco.apt `_. v3.0.0 ====== Refreshed package metadata. Require Python 3.6 or later. 2.0 === Switch to `pkgutil namespace technique `_ for the ``jaraco`` namespace. 1.8 === * Dropped support for Python 3.3. * Refreshed project metadata using declarative config. * ``ExceptionTrap`` now presents ``type``, ``value``, and ``tb`` attributes. 1.7 === * Added ``suppress`` context manager as `found in Python 3.4 `_ but with decorator support. 1.6 === * Refresh project skeleton. Moved hosting to Github. 1.5 === * Also allow the ``dest_ctx`` to be overridden in ``repo_context``. 1.4 === * Added ``remover`` parameter to ``context.temp_dir``. 1.2 === * Adopted functionality from jaraco.util.context (10.8). jaraco.context-6.0.1/README.rst000066400000000000000000000052711466100741000161330ustar00rootroot00000000000000.. image:: https://img.shields.io/pypi/v/jaraco.context.svg :target: https://pypi.org/project/jaraco.context .. image:: https://img.shields.io/pypi/pyversions/jaraco.context.svg .. image:: https://github.com/jaraco/jaraco.context/actions/workflows/main.yml/badge.svg :target: https://github.com/jaraco/jaraco.context/actions?query=workflow%3A%22tests%22 :alt: tests .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json :target: https://github.com/astral-sh/ruff :alt: Ruff .. image:: https://readthedocs.org/projects/jaracocontext/badge/?version=latest :target: https://jaracocontext.readthedocs.io/en/latest/?badge=latest .. image:: https://img.shields.io/badge/skeleton-2024-informational :target: https://blog.jaraco.com/skeleton .. image:: https://tidelift.com/badges/package/pypi/jaraco.context :target: https://tidelift.com/subscription/pkg/pypi-jaraco.context?utm_source=pypi-jaraco.context&utm_medium=readme Highlights ========== See the docs linked from the badge above for the full details, but here are some features that may be of interest. - ``ExceptionTrap`` provides a general-purpose wrapper for trapping exceptions and then acting on the outcome. Includes ``passes`` and ``raises`` decorators to replace the result of a wrapped function by a boolean indicating the outcome of the exception trap. See `this keyring commit `_ for an example of it in production. - ``suppress`` simply enables ``contextlib.suppress`` as a decorator. - ``on_interrupt`` is a decorator used by CLI entry points to affect the handling of a ``KeyboardInterrupt``. Inspired by `Lucretiel/autocommand#18 `_. - ``pushd`` is similar to pytest's ``monkeypatch.chdir`` or path's `default context `_, changes the current working directory for the duration of the context. - ``tarball`` will download a tarball, extract it, change directory, yield, then clean up after. Convenient when working with web assets. - ``null`` is there for those times when one code branch needs a context and the other doesn't; this null context provides symmetry across those branches. For Enterprise ============== Available as part of the Tidelift Subscription. This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use. `Learn more `_. jaraco.context-6.0.1/SECURITY.md000066400000000000000000000002641466100741000162320ustar00rootroot00000000000000# Security Contact To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. jaraco.context-6.0.1/conftest.py000066400000000000000000000017671466100741000166510ustar00rootroot00000000000000import http.server import io import functools import tarfile import threading import portend import pytest class QuietHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): def log_message(self, format, *args): pass @pytest.fixture def tarfile_served(tmp_path_factory): """ Start an HTTP server serving a tarfile. """ tmp_path = tmp_path_factory.mktemp('www') fn = tmp_path / 'served.tgz' tf = tarfile.open(fn, mode='w:gz') info = tarfile.TarInfo('served/contents.txt') tf.addfile(info, io.BytesIO('hello, contents'.encode())) tf.close() httpd, url = start_server(tmp_path) with httpd: yield url + '/served.tgz' def start_server(path): _host, port = addr = ('', portend.find_available_local_port()) Handler = functools.partial(QuietHTTPRequestHandler, directory=path) httpd = http.server.HTTPServer(addr, Handler) threading.Thread(target=httpd.serve_forever, daemon=True).start() return httpd, f'http://localhost:{port}' jaraco.context-6.0.1/docs/000077500000000000000000000000001466100741000153675ustar00rootroot00000000000000jaraco.context-6.0.1/docs/conf.py000066400000000000000000000024761466100741000166770ustar00rootroot00000000000000extensions = [ 'sphinx.ext.autodoc', 'jaraco.packaging.sphinx', ] master_doc = "index" html_theme = "furo" # Link dates and other references in the changelog extensions += ['rst.linker'] link_files = { '../NEWS.rst': dict( using=dict(GH='https://github.com'), replace=[ dict( pattern=r'(Issue #|\B#)(?P\d+)', url='{package_url}/issues/{issue}', ), dict( pattern=r'(?m:^((?Pv?\d+(\.\d+){1,2}))\n[-=]+\n)', with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n', ), dict( pattern=r'PEP[- ](?P\d+)', url='https://peps.python.org/pep-{pep_number:0>4}/', ), ], ) } # Be strict about any broken references nitpicky = True nitpick_ignore = [ ('py:class', 'contextlib.suppress'), ('py:class', 'jaraco.context.T'), ] # Include Python intersphinx mapping to prevent failures # jaraco/skeleton#51 extensions += ['sphinx.ext.intersphinx'] intersphinx_mapping = { 'python': ('https://docs.python.org/3', None), 'jaraco.functools': ('https://jaracofunctools.readthedocs.io/en/latest', None), } # Preserve authored syntax for defaults autodoc_preserve_defaults = True extensions += ['jaraco.tidelift'] jaraco.context-6.0.1/docs/history.rst000066400000000000000000000001161466100741000176200ustar00rootroot00000000000000:tocdepth: 2 .. _changes: History ******* .. include:: ../NEWS (links).rst jaraco.context-6.0.1/docs/index.rst000066400000000000000000000005601466100741000172310ustar00rootroot00000000000000Welcome to |project| documentation! =================================== .. sidebar-links:: :home: :pypi: .. toctree:: :maxdepth: 1 history .. tidelift-referral-banner:: .. automodule:: jaraco.context :members: :undoc-members: :show-inheritance: Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` jaraco.context-6.0.1/jaraco/000077500000000000000000000000001466100741000156765ustar00rootroot00000000000000jaraco.context-6.0.1/jaraco/context/000077500000000000000000000000001466100741000173625ustar00rootroot00000000000000jaraco.context-6.0.1/jaraco/context/__init__.py000066400000000000000000000223321466100741000214750ustar00rootroot00000000000000from __future__ import annotations import contextlib import errno import functools import operator import os import platform import shutil import stat import subprocess import sys import tempfile import urllib.request from typing import Iterator if sys.version_info < (3, 12): from backports import tarfile else: import tarfile @contextlib.contextmanager def pushd(dir: str | os.PathLike) -> Iterator[str | os.PathLike]: """ >>> tmp_path = getfixture('tmp_path') >>> with pushd(tmp_path): ... assert os.getcwd() == os.fspath(tmp_path) >>> assert os.getcwd() != os.fspath(tmp_path) """ orig = os.getcwd() os.chdir(dir) try: yield dir finally: os.chdir(orig) @contextlib.contextmanager def tarball( url, target_dir: str | os.PathLike | None = None ) -> Iterator[str | os.PathLike]: """ Get a URL to a tarball, download, extract, yield, then clean up. Assumes everything in the tarball is prefixed with a common directory. That common path is stripped and the contents are extracted to ``target_dir``, similar to passing ``-C {target} --strip-components 1`` to the ``tar`` command. Uses the streaming protocol to extract the contents from a stream in a single pass without loading the whole file into memory. >>> import urllib.request >>> url = getfixture('tarfile_served') >>> target = getfixture('tmp_path') / 'out' >>> tb = tarball(url, target_dir=target) >>> import pathlib >>> with tb as extracted: ... contents = pathlib.Path(extracted, 'contents.txt').read_text(encoding='utf-8') >>> assert not os.path.exists(extracted) If the target is not specified, contents are extracted to a directory relative to the current working directory named after the name of the file as extracted from the URL. >>> target = getfixture('tmp_path') >>> with pushd(target), tarball(url): ... target.joinpath('served').is_dir() True """ if target_dir is None: target_dir = os.path.basename(url).replace('.tar.gz', '').replace('.tgz', '') os.mkdir(target_dir) try: req = urllib.request.urlopen(url) with tarfile.open(fileobj=req, mode='r|*') as tf: tf.extractall(path=target_dir, filter=strip_first_component) yield target_dir finally: shutil.rmtree(target_dir) def strip_first_component( member: tarfile.TarInfo, path, ) -> tarfile.TarInfo: _, member.name = member.name.split('/', 1) return member def _compose(*cmgrs): """ Compose any number of dependent context managers into a single one. The last, innermost context manager may take arbitrary arguments, but each successive context manager should accept the result from the previous as a single parameter. Like :func:`jaraco.functools.compose`, behavior works from right to left, so the context manager should be indicated from outermost to innermost. Example, to create a context manager to change to a temporary directory: >>> temp_dir_as_cwd = _compose(pushd, temp_dir) >>> with temp_dir_as_cwd() as dir: ... assert os.path.samefile(os.getcwd(), dir) """ def compose_two(inner, outer): def composed(*args, **kwargs): with inner(*args, **kwargs) as saved, outer(saved) as res: yield res return contextlib.contextmanager(composed) return functools.reduce(compose_two, reversed(cmgrs)) tarball_cwd = _compose(pushd, tarball) """ A tarball context with the current working directory pointing to the contents. """ def remove_readonly(func, path, exc_info): """ Add support for removing read-only files on Windows. """ _, exc, _ = exc_info if func in (os.rmdir, os.remove, os.unlink) and exc.errno == errno.EACCES: # change the file to be readable,writable,executable: 0777 os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # retry func(path) else: raise def robust_remover(): return ( functools.partial(shutil.rmtree, onerror=remove_readonly) if platform.system() == 'Windows' else shutil.rmtree ) @contextlib.contextmanager def temp_dir(remover=shutil.rmtree): """ Create a temporary directory context. Pass a custom remover to override the removal behavior. >>> import pathlib >>> with temp_dir() as the_dir: ... assert os.path.isdir(the_dir) >>> assert not os.path.exists(the_dir) """ temp_dir = tempfile.mkdtemp() try: yield temp_dir finally: remover(temp_dir) robust_temp_dir = functools.partial(temp_dir, remover=robust_remover()) @contextlib.contextmanager def repo_context( url, branch: str | None = None, quiet: bool = True, dest_ctx=robust_temp_dir ): """ Check out the repo indicated by url. If dest_ctx is supplied, it should be a context manager to yield the target directory for the check out. >>> repo = repo_context('https://github.com/jaraco/jaraco.context') >>> with repo as dest: ... listing = os.listdir(dest) >>> 'README.rst' in listing True """ exe = 'git' if 'git' in url else 'hg' with dest_ctx() as repo_dir: cmd = [exe, 'clone', url, repo_dir] cmd.extend(['--branch', branch] * bool(branch)) stream = subprocess.DEVNULL if quiet else None subprocess.check_call(cmd, stdout=stream, stderr=stream) yield repo_dir class ExceptionTrap: """ A context manager that will catch certain exceptions and provide an indication they occurred. >>> with ExceptionTrap() as trap: ... raise Exception() >>> bool(trap) True >>> with ExceptionTrap() as trap: ... pass >>> bool(trap) False >>> with ExceptionTrap(ValueError) as trap: ... raise ValueError("1 + 1 is not 3") >>> bool(trap) True >>> trap.value ValueError('1 + 1 is not 3') >>> trap.tb >>> with ExceptionTrap(ValueError) as trap: ... raise Exception() Traceback (most recent call last): ... Exception >>> bool(trap) False """ exc_info = None, None, None def __init__(self, exceptions=(Exception,)): self.exceptions = exceptions def __enter__(self): return self @property def type(self): return self.exc_info[0] @property def value(self): return self.exc_info[1] @property def tb(self): return self.exc_info[2] def __exit__(self, *exc_info): type = exc_info[0] matches = type and issubclass(type, self.exceptions) if matches: self.exc_info = exc_info return matches def __bool__(self): return bool(self.type) def raises(self, func, *, _test=bool): """ Wrap func and replace the result with the truth value of the trap (True if an exception occurred). First, give the decorator an alias to support Python 3.8 Syntax. >>> raises = ExceptionTrap(ValueError).raises Now decorate a function that always fails. >>> @raises ... def fail(): ... raise ValueError('failed') >>> fail() True """ @functools.wraps(func) def wrapper(*args, **kwargs): with ExceptionTrap(self.exceptions) as trap: func(*args, **kwargs) return _test(trap) return wrapper def passes(self, func): """ Wrap func and replace the result with the truth value of the trap (True if no exception). First, give the decorator an alias to support Python 3.8 Syntax. >>> passes = ExceptionTrap(ValueError).passes Now decorate a function that always fails. >>> @passes ... def fail(): ... raise ValueError('failed') >>> fail() False """ return self.raises(func, _test=operator.not_) class suppress(contextlib.suppress, contextlib.ContextDecorator): """ A version of contextlib.suppress with decorator support. >>> @suppress(KeyError) ... def key_error(): ... {}[''] >>> key_error() """ class on_interrupt(contextlib.ContextDecorator): """ Replace a KeyboardInterrupt with SystemExit(1). Useful in conjunction with console entry point functions. >>> def do_interrupt(): ... raise KeyboardInterrupt() >>> on_interrupt('error')(do_interrupt)() Traceback (most recent call last): ... SystemExit: 1 >>> on_interrupt('error', code=255)(do_interrupt)() Traceback (most recent call last): ... SystemExit: 255 >>> on_interrupt('suppress')(do_interrupt)() >>> with __import__('pytest').raises(KeyboardInterrupt): ... on_interrupt('ignore')(do_interrupt)() """ def __init__(self, action='error', /, code=1): self.action = action self.code = code def __enter__(self): return self def __exit__(self, exctype, excinst, exctb): if exctype is not KeyboardInterrupt or self.action == 'ignore': return elif self.action == 'error': raise SystemExit(self.code) from excinst return self.action == 'suppress' jaraco.context-6.0.1/jaraco/context/py.typed000066400000000000000000000000001466100741000210470ustar00rootroot00000000000000jaraco.context-6.0.1/mypy.ini000066400000000000000000000002321466100741000161330ustar00rootroot00000000000000[mypy] ignore_missing_imports = True # required to support namespace packages # https://github.com/python/mypy/issues/14057 explicit_package_bases = True jaraco.context-6.0.1/pyproject.toml000066400000000000000000000021731466100741000173560ustar00rootroot00000000000000[build-system] requires = ["setuptools>=61.2", "setuptools_scm[toml]>=3.4.1"] build-backend = "setuptools.build_meta" [project] name = "jaraco.context" authors = [ { name = "Jason R. Coombs", email = "jaraco@jaraco.com" }, ] description = "Useful decorators and context managers" readme = "README.rst" classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", ] requires-python = ">=3.8" dependencies = [ 'backports.tarfile; python_version < "3.12"', ] dynamic = ["version"] [project.urls] Source = "https://github.com/jaraco/jaraco.context" [project.optional-dependencies] test = [ # upstream "pytest >= 6, != 8.1.*", "pytest-checkdocs >= 2.4", "pytest-cov", "pytest-mypy", "pytest-enabler >= 2.2", "pytest-ruff >= 0.2.1; sys_platform != 'cygwin'", # local "portend", ] doc = [ # upstream "sphinx >= 3.5", "jaraco.packaging >= 9.3", "rst.linker >= 1.9", "furo", "sphinx-lint", # tidelift "jaraco.tidelift >= 1.4", # local ] [tool.setuptools_scm] jaraco.context-6.0.1/pytest.ini000066400000000000000000000012231466100741000164660ustar00rootroot00000000000000[pytest] norecursedirs=dist build .tox .eggs addopts= --doctest-modules --import-mode importlib consider_namespace_packages=true filterwarnings= ## upstream # Ensure ResourceWarnings are emitted default::ResourceWarning # realpython/pytest-mypy#152 ignore:'encoding' argument not specified::pytest_mypy # python/cpython#100750 ignore:'encoding' argument not specified::platform # pypa/build#615 ignore:'encoding' argument not specified::build.env # dateutil/dateutil#1284 ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning:dateutil.tz.tz ## end upstream # ignore known deprecation ignore:null is deprecated:DeprecationWarning jaraco.context-6.0.1/ruff.toml000066400000000000000000000010201466100741000162670ustar00rootroot00000000000000[lint] extend-select = [ "C901", "PERF401", "W", ] ignore = [ # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules "W191", "E111", "E114", "E117", "D206", "D300", "Q000", "Q001", "Q002", "Q003", "COM812", "COM819", "ISC001", "ISC002", ] [format] # Enable preview to get hugged parenthesis unwrapping and other nice surprises # See https://github.com/jaraco/skeleton/pull/133#issuecomment-2239538373 preview = true # https://docs.astral.sh/ruff/settings/#format_quote-style quote-style = "preserve" jaraco.context-6.0.1/towncrier.toml000066400000000000000000000000541466100741000173470ustar00rootroot00000000000000[tool.towncrier] title_format = "{version}" jaraco.context-6.0.1/tox.ini000066400000000000000000000025151466100741000157550ustar00rootroot00000000000000[testenv] description = perform primary checks (tests, style, types, coverage) deps = setenv = PYTHONWARNDEFAULTENCODING = 1 commands = pytest {posargs} usedevelop = True extras = test [testenv:diffcov] description = run tests and check that diff from main is covered deps = {[testenv]deps} diff-cover commands = pytest {posargs} --cov-report xml diff-cover coverage.xml --compare-branch=origin/main --html-report diffcov.html diff-cover coverage.xml --compare-branch=origin/main --fail-under=100 [testenv:docs] description = build the documentation extras = doc test changedir = docs commands = python -m sphinx -W --keep-going . {toxinidir}/build/html python -m sphinxlint \ # workaround for sphinx-contrib/sphinx-lint#83 --jobs 1 [testenv:finalize] description = assemble changelog and tag a release skip_install = True deps = towncrier jaraco.develop >= 7.23 pass_env = * commands = python -m jaraco.develop.finalize [testenv:release] description = publish the package to PyPI and GitHub skip_install = True deps = build twine>=3 jaraco.develop>=7.1 pass_env = TWINE_PASSWORD GITHUB_TOKEN setenv = TWINE_USERNAME = {env:TWINE_USERNAME:__token__} commands = python -c "import shutil; shutil.rmtree('dist', ignore_errors=True)" python -m build python -m twine upload dist/* python -m jaraco.develop.create-github-release