Skip to content

Instantly share code, notes, and snippets.

View ssbarnea's full-sized avatar
Sticking packages under the pypi tree.....

Sorin Sbarnea ssbarnea

Sticking packages under the pypi tree.....
View GitHub Profile
View tox.txt
ssbarnea@m1: ~/c/a/ansible-dev-environment fix/de
$ tox -e docs
.pkg: _optional_hooks> python /Users/ssbarnea/.asdf/installs/python/3.12.1/lib/python3.12/site-packages/pyproject_api/ True setuptools.build_meta
.pkg: get_requires_for_build_editable> python /Users/ssbarnea/.asdf/installs/python/3.12.1/lib/python3.12/site-packages/pyproject_api/ True setuptools.build_meta
.pkg: build_editable> python /Users/ssbarnea/.asdf/installs/python/3.12.1/lib/python3.12/site-packages/pyproject_api/ True setuptools.build_meta
docs: install_package> python -I -m pip install --force-reinstall --no-deps .tox/.tmp/package/35/ansible_dev_environment-1.dev11-0.editable-py3-none-any.whl
docs: commands_pre[0]> sh -c 'rm -f .coverage* coverage.xml 2>/dev/null || true'
docs: commands[0]> mkdocs build
docs: exit 2 (0.00 seconds) /Users/ssbarnea/c/a/ansible-dev-environment> mkdocs build
.pkg: _exit> python /Users/ssbarnea/.asdf/installs/python/3.12.1/lib/python3.12/site-packages/pyproject_api/_backend.p
View pending-releases.txt
$ mk pending
Found molecule draft release v7.0.0 created 36 days ago:
## Major Changes
- Set Python 3.10 as minimum version (#4099) @cristianonicolai
## Bugfixes
ssbarnea /
Created October 10, 2023 09:40
Script to report broken packages and uninstall and reinstall them.
#!/usr/bin/env python
from os.path import isfile
import subprocess
from email.parser import Parser
from pip._internal.metadata import get_default_environment
from pip._internal.utils.compatibility_tags import get_supported
from pip._vendor.packaging.tags import parse_tag
supported = get_supported()
packages = get_default_environment().iter_installed_distributions()
View playbook.yml
- name: cleanup
hosts: localhost
gather_facts: false
- name: Cleanup
msg: "Doing cleanup"
- name: Foo
View ruff-settings.txt
Resolved settings for: "/Users/ssbarnea/c/a/ansible-lint/.projects/ansible-compat/src/ansible_compat/"
Settings path: "/Users/ssbarnea/c/a/ansible-lint/.projects/ansible-compat/pyproject.toml"
Settings {
rules: RuleTable {
enabled: {
ssbarnea /
Last active March 30, 2023 11:18
Script that captures both stdout and stderr in a way that works for subprocesses, while still being able to use rich own console to use original streams.
from rich.console import Console
from subprocess import run
import tempfile
import sys
from contextlib import redirect_stdout, redirect_stderr
# If we do not pass file=sys.stdout explicitly, rich output will also be
# captured by the context manager.
console = Console(file=sys.stdout)
console_err = Console(file=sys.stderr, stderr=True)
View gist:6c2db6451cd0ec20d12356391b8d9dbf
cd ~/.pyenv/versions
find . -name __pycache__
View pre-commit.log
### version information
pre-commit version: 3.0.1
git --version: git version 2.39.1
3.11.1 (main, Dec 23 2022, 09:28:24) [Clang 14.0.0 (clang-1400.0.29.202)]
sys.executable: /Users/ssbarnea/.local/pipx/venvs/pre-commit/bin/python posix
sys.platform: darwin
View tox-lock.log
$ tox -vvv --exit-and-dump-after 40 -e py
ROOT: 53 D setup logging to NOTSET on pid 67224 [tox/]
ROOT: 99 W will run in automatically provisioned tox, host /Users/ssbarnea/.pyenv/versions/3.11-dev/bin/python3.11 is missing [requires (has)]: tox>=4.2.6 (4.2.2) [tox/]
.pkg: 111 I find interpreter for spec PythonSpec(path=/Users/ssbarnea/.pyenv/versions/3.11-dev/bin/python3.11) [virtualenv/discovery/]
.pkg: 111 I proposed PythonInfo(, exe=/Users/ssbarnea/.pyenv/versions/3.11-dev/bin/python3.11, platform=darwin, version='3.11.0+ (heads/3.11:4cd5ea62ac, Oct 25 2022, 18:19:49) [Clang 14.0.0 (clang-1400.0.29.102)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/]
.pkg: 111 D accepted PythonInfo(, exe=/Users/ssbarnea/.pyenv/versions/3.11-dev/bin/python3.11, platform=darwin, version='3.11.0+ (heads/3.11:4cd5ea62ac, Oct 25 2022, 18:19:49) [Clang 14.0.0 (clang-1400.0.29.102)]', encoding_fs_io=utf-8-utf-8
View setuptools-scm.log
ssbarnea@m1: ~/c/a/ansible-lint fix/schema-cache ⚡
pkg: commands[0]> .tox/pkg/bin/python -c 'import os.path, shutil, sys; dist_dir = os.path.join("/Users/ssbarnea/c/a/ansible-lint", "dist"); os.path.isdir(dist_dir) or sys.exit(0); print("Removing {!s} contents...".format(dist_dir), file=sys.stderr); shutil.rmtree(dist_dir)'
Removing /Users/ssbarnea/c/a/ansible-lint/dist contents...
pkg: commands[1]> .tox/pkg/bin/python -m build --outdir /Users/ssbarnea/c/a/ansible-lint/dist/ /Users/ssbarnea/c/a/ansible-lint
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools >= 63.0.0, setuptools_scm[toml] >= 7.0.5, wheel)
* Getting build dependencies for sdist...
finalize hook {'name': None, 'version': None, 'author': None, 'author_email': None, 'maintainer': None, 'maintainer_email': None, 'url': None, 'license': None, 'description': None, 'long_description': None, 'keywords': None, 'platforms': None, 'classifiers': None, 'download_url': No