diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..68e52332 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,196 @@ +Dockerfile +Dockerfile.* + +# Ignore private folder and any file with private in the name: +**/**/private/ +*private* +# Except for zetch files: +!*private*.zetch.* +!*private*.*.zetch + +**/**/process_data/ +**/**/logs/ + +# Tempate files +.cop.*.yml + +scratch_space.ipynb + +**/**/node_modules/ + +# These are backup files generated by rustfmt +**/*.rs.bk + +# Files flagged for ignore: which have .gitignore. inside them: +*.gitignore.* +*_gitignore.* + +# Celery: +celerybeat-schedule.db + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Pdm: +.pdm-python + +# Distribution / packaging +.Python +sds/sworker/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +# leptos build files: +**/**/static/rsite/ +# Compiled css: +**/**/static/css/ + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +**/**/htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +**/**/coverage/ +nosetests.xml +coverage.xml +*.cover +*.py,cover +**/**/.hypothesis/ +**/**/.pytest_cache/ +**/**/.ruff_cache/ +**/**/cover/ +**/**/.nox/ +*.prof +prof/ +**/**/perf_profiles/ +**/**/test-results/ +**/**/playwright-report/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +**/**/instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# PyBuilder +**/**/.pybuilder/ +**/**/target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +**/**/profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +**/**/__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +**/**/.env +**/**/.venv +**/**/env/ +**/**/venv/ +**/**/ENV/ +**/**/env.bak/ +**/**/venv.bak/ + +# mkdocs local build directory: +**/**/site/ +**/**/docs/js_ref/ +**/**/docs/rust_ref/ +.staticrypt.json + +# Vscode internals +**/**/.vscode/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mypy +**/**/.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +**/**/.pyre/ + +# pytype static type analyzer +**/**/.pytype/ + +# Cython debug symbols +**/**/cython_debug/ + +# Pycharm +**/**/.idea/ + +# Mac stuff +.DS_Store + +**/**/template_test_build/ + +# User diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml new file mode 100644 index 00000000..4929c732 --- /dev/null +++ b/.github/actions/install-rust/action.yml @@ -0,0 +1,37 @@ +name: Setup Rust +description: "Installs latest stable rust, and sets up sscache for caching." +inputs: + qa: + description: "Whether things like cargo-hack need installing." + required: false + default: "false" + test: + description: "Whether things like nextest need installing." + required: false + default: "false" +runs: + using: composite + steps: + - name: Install rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.4 + - name: Set Rust caching env vars + shell: bash + run: | + echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + # Really this would need to be run as a post task to be of any use (to actually see hits), + # but post in composite action not currently supported: + # https://github.com/actions/runner/issues/1478 + # - name: Run sccache stat for check + # shell: bash + # run: ${SCCACHE_PATH} --show-stats + - name: "Install cargo-hack, used for feature checking in pre-commit." + if: ${{ inputs.qa == 'true' }} + uses: taiki-e/install-action@cargo-hack + - name: Install nextest + if: ${{ inputs.test == 'true' }} + uses: taiki-e/install-action@nextest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4d7c835..d0f44e58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,7 +54,6 @@ jobs: with: token: ${{ secrets.VERSION_BOT_PAT }} - uses: actions/setup-python@v4 - - uses: ./.github/actions/install-pre-commit - name: Install zetch run: pip install zetch @@ -69,9 +68,9 @@ jobs: - name: Update Python version if: ${{ inputs.py_release }} run: | - zetch put zetch.config.toml context.static.PY_VERSION.value ${{ inputs.py_version }} + zetch put zetch.config.toml context.static.PY_VERSION ${{ inputs.py_version }} - # Js project + # Js project - name: Install Bun, no npm should be needed if: ${{ inputs.js_release }} uses: oven-sh/setup-bun@v1 @@ -85,28 +84,22 @@ jobs: - name: Update JS version if: ${{ inputs.js_release }} run: | - zetch put zetch.config.toml context.static.JS_VERSION.value ${{ inputs.js_version }} - - - uses: dtolnay/rust-toolchain@stable - if: ${{ inputs.py_rust_release }} || ${{ inputs.rust_release }} - with: - components: rustfmt, clippy + zetch put zetch.config.toml context.static.JS_VERSION ${{ inputs.js_version }} - - name: Install cargo-hack, used for feature checking in pre-commit. + - uses: ./.github/actions/install-rust if: ${{ inputs.py_rust_release }} || ${{ inputs.rust_release }} - uses: taiki-e/install-action@cargo-hack - - name: Update Rust-backed Python version if: ${{ inputs.py_rust_release }} run: | - zetch put zetch.config.toml context.static.PY_RUST_VERSION.value ${{ inputs.py_rust_version }} + zetch put zetch.config.toml context.static.PY_RUST_VERSION ${{ inputs.py_rust_version }} - name: Update Rust version if: ${{ inputs.rust_release }} run: | - zetch put zetch.config.toml context.static.RUST_VERSION.value ${{ inputs.rust_version }} + zetch put zetch.config.toml context.static.RUST_VERSION ${{ inputs.rust_version }} + - uses: ./.github/actions/install-pre-commit - name: add and format added files with pre-commit # Running on staged change only as that's all that's needed, || true as don't want it to fail, just modify run: | @@ -160,13 +153,7 @@ jobs: with: node-version: '20' - - name: Install rust toolchain - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - with: - workspaces: ./rust -> target - cache-on-failure: 'true' - cache-all-crates: 'true' + - uses: ./.github/actions/install-rust - name: Build docs run: | @@ -334,9 +321,7 @@ jobs: ref: ${{ needs.commit_versions.outputs.new-sha }} - - name: Install rust toolchain - uses: dtolnay/rust-toolchain@stable - + - uses: ./.github/actions/install-rust - name: upload to Crates.io run: | cd rust diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4fbba383..1c697e63 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,7 +38,6 @@ jobs: with: python-version: "3.12" cache: pip - - uses: ./.github/actions/install-pre-commit # Python project - name: Set up PDM @@ -62,12 +61,11 @@ jobs: cd ./js bun install - - uses: dtolnay/rust-toolchain@stable + - uses: ./.github/actions/install-rust with: - components: rustfmt, clippy - - name: "Install cargo-hack, used for feature checking in pre-commit." - uses: taiki-e/install-action@cargo-hack + qa: true + - uses: ./.github/actions/install-pre-commit - name: Run QA run: | ./dev_scripts/test.sh qa @@ -96,13 +94,9 @@ jobs: with: node-version: "20" - - name: Install rust toolchain - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/install-rust with: - workspaces: "./rust -> target" - cache-on-failure: "true" - cache-all-crates: "true" + qa: true - name: Install dependencies run: | @@ -198,15 +192,9 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install rust toolchain - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/install-rust with: - workspaces: "./py_rust -> target" - cache-on-failure: "true" - cache-all-crates: "true" - - name: Install nextest - uses: taiki-e/install-action@nextest + test: true - uses: actions/setup-python@v4 with: @@ -243,15 +231,9 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install rust toolchain - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/install-rust with: - workspaces: "./rust -> target" - cache-on-failure: "true" - cache-all-crates: "true" - - name: Install nextest - uses: taiki-e/install-action@nextest + test: true - name: Run tests (linux) if: matrix.os == 'ubuntu-latest' diff --git a/.gitignore b/.gitignore index f8f250cb..0d204723 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,22 @@ # Ignore private folder and any file with private in the name: -private/ +**/**/private/ *private* # Except for zetch files: !*private*.zetch.* !*private*.*.zetch -process_data/ -logs/ +**/**/process_data/ +**/**/logs/ # Tempate files .cop.*.yml scratch_space.ipynb -node_modules/ +**/**/node_modules/ + +# These are backup files generated by rustfmt +**/*.rs.bk # Files flagged for ignore: which have .gitignore. inside them: *.gitignore.* @@ -52,6 +55,10 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST +# leptos build files: +**/**/static/rsite/ +# Compiled css: +**/**/static/css/ # PyInstaller # Usually these files are written by a python script from a template @@ -64,25 +71,27 @@ pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports -htmlcov/ +**/**/htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache -coverage/ +**/**/coverage/ nosetests.xml coverage.xml *.cover *.py,cover -.hypothesis/ -.pytest_cache/ -.ruff_cache/ -cover/ -.nox/ +**/**/.hypothesis/ +**/**/.pytest_cache/ +**/**/.ruff_cache/ +**/**/cover/ +**/**/.nox/ *.prof prof/ -perf_profiles/ +**/**/perf_profiles/ +**/**/test-results/ +**/**/playwright-report/ # Translations *.mo @@ -95,21 +104,21 @@ db.sqlite3 db.sqlite3-journal # Flask stuff: -instance/ +**/**/instance/ .webassets-cache # Scrapy stuff: .scrapy # PyBuilder -.pybuilder/ -target/ +**/**/.pybuilder/ +**/**/target/ # Jupyter Notebook .ipynb_checkpoints # IPython -profile_default/ +**/**/profile_default/ ipython_config.py # pyenv @@ -125,7 +134,7 @@ ipython_config.py #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ +**/**/__pypackages__/ # Celery stuff celerybeat-schedule @@ -135,22 +144,22 @@ celerybeat.pid *.sage.py # Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ +**/**/.env +**/**/.venv +**/**/env/ +**/**/venv/ +**/**/ENV/ +**/**/env.bak/ +**/**/venv.bak/ # mkdocs local build directory: -site/ -docs/js_ref/ -docs/rust_ref/ +**/**/site/ +**/**/docs/js_ref/ +**/**/docs/rust_ref/ .staticrypt.json # Vscode internals -.vscode/ +**/**/.vscode/ # Spyder project settings .spyderproject @@ -160,25 +169,25 @@ docs/rust_ref/ .ropeproject # mypy -.mypy_cache/ +**/**/.mypy_cache/ .dmypy.json dmypy.json # Pyre type checker -.pyre/ +**/**/.pyre/ # pytype static type analyzer -.pytype/ +**/**/.pytype/ # Cython debug symbols -cython_debug/ +**/**/cython_debug/ # Pycharm -.idea/ +**/**/.idea/ # Mac stuff .DS_Store -template_test_build/ +**/**/template_test_build/ # User diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7145c20b..731e54f9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/zakstucke/zetch - rev: v0.0.10 + rev: v0.0.16 hooks: - id: zetch @@ -48,6 +48,8 @@ repos: args: # Ignore don't error on specific words that always fail: (foo,bar,baz...) - -L=crate + - -L=numer + - -L=anull # Ruff: linting and formatting for python code: - repo: https://github.com/astral-sh/ruff-pre-commit @@ -76,23 +78,22 @@ repos: - id: cargo-fmt name: cargo-fmt description: "Format files with cargo fmt." - entry: cargo fmt - language: rust + language: system types: [rust] + entry: cargo fmt args: [--manifest-path=./rust/Cargo.toml, --] - - id: cargo-hack-check - name: cargo-check-each-feature - description: Check the package for errors. - entry: cargo hack check - language: rust + - id: cargo-rust-check + name: cargo-rust-check + description: Check the rust package for errors using cargo check on needed targets and features. + entry: ./dev_scripts/test.sh cargo_rust_check + language: system types: [rust] - args: [--manifest-path=./rust/Cargo.toml, --each-feature, --no-dev-deps] pass_filenames: false - id: cargo-clippy name: cargo-clippy description: Lint rust sources entry: cargo clippy - language: rust + language: system args: ["--manifest-path", "./rust/Cargo.toml", "--all-features", "--", "-D", "warnings"] types: [rust] pass_filenames: false @@ -104,22 +105,22 @@ repos: name: cargo-fmt description: "Format files with cargo fmt." entry: cargo fmt - language: rust + language: system types: [rust] args: [--manifest-path=./py_rust/Cargo.toml, --] - - id: cargo-hack-check - name: cargo-check-each-feature - description: Check the package for errors. - entry: cargo hack check - language: rust + - id: cargo-py-rust-check + name: cargo-py-rust-check + description: Check the rust-backed python package for errors using cargo check on needed targets + and features. + entry: ./dev_scripts/test.sh cargo_py_rust_check + language: system types: [rust] - args: [--manifest-path=./py_rust/Cargo.toml, --each-feature, --no-dev-deps] pass_filenames: false - id: cargo-clippy name: cargo-clippy description: Lint rust sources entry: cargo clippy - language: rust + language: system args: ["--manifest-path", "./py_rust/Cargo.toml", "--all-features", "--", "-D", "warnings"] types: [rust] pass_filenames: false diff --git a/.zetch.lock b/.zetch.lock index 08a6f165..d46d3c47 100644 --- a/.zetch.lock +++ b/.zetch.lock @@ -1,23 +1,24 @@ { - "version": "0.0.10", + "version": "0.0.16", "files": { - "docs/CODE_OF_CONDUCT.zetch.md": "bf106326ffc75f5167cfde27c997c77c6b97c843a9e392b564355d0e70e50b97", - "js/tsconfig.zetch.json": "fb5d57b825bb3c2f6dd4254bf939f2444e52946622a7f93b91e3acb75876ebbc", - "docs/index.zetch.md": "0dd2c30854a3e110c37b08c068c09e80f6e459017f123930a9be5ed08b34fece", "CODE_OF_CONDUCT.zetch.md": "bf106326ffc75f5167cfde27c997c77c6b97c843a9e392b564355d0e70e50b97", - "py/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", "CONTRIBUTING.zetch.md": "bace46dc064746b54cf472eba960d934d705c2f83120b865a4b47032ff1552c5", - "docs/CONTRIBUTING.zetch.md": "bace46dc064746b54cf472eba960d934d705c2f83120b865a4b47032ff1552c5", - "rust/README.zetch.md": "0dd2c30854a3e110c37b08c068c09e80f6e459017f123930a9be5ed08b34fece", + "LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", "README.zetch.md": "5e44429bf29ed38799d08bbf375435dd58516002c8dcf7f6f5cf47628cc29182", + "docs/CODE_OF_CONDUCT.zetch.md": "bf106326ffc75f5167cfde27c997c77c6b97c843a9e392b564355d0e70e50b97", + "docs/CONTRIBUTING.zetch.md": "bace46dc064746b54cf472eba960d934d705c2f83120b865a4b47032ff1552c5", + "docs/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", + "docs/index.zetch.md": "0dd2c30854a3e110c37b08c068c09e80f6e459017f123930a9be5ed08b34fece", + "js/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", "js/README.zetch.md": "0dd2c30854a3e110c37b08c068c09e80f6e459017f123930a9be5ed08b34fece", + "js/tsconfig.zetch.json": "20974867286079e9cff0945f28efa3d77b49a7d75ab4f7106969c44239df97c6", + "opencollector.yaml.zetch": "7bc57cf34798098de165251bee40b14905e46189e781f38597ed5debb1dfd4f7", + "py/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", "py/README.zetch.md": "0dd2c30854a3e110c37b08c068c09e80f6e459017f123930a9be5ed08b34fece", "py_rust/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", - "LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", - "docs/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", "py_rust/README.zetch.md": "0dd2c30854a3e110c37b08c068c09e80f6e459017f123930a9be5ed08b34fece", "rust/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", - "js/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b", - "opencollector.yaml.zetch": "678a691ae64d7f9893e8799ea657842fe051b3fcce4da568969d8de070a29393" + "rust/README.zetch.md": "0dd2c30854a3e110c37b08c068c09e80f6e459017f123930a9be5ed08b34fece", + "rust/pkg/LICENSE.zetch.md": "d2c12e539d357957b950a54a5477c3a9f87bd2b3ee707be7a4db7adaf5aacc2b" } } \ No newline at end of file diff --git a/bitbazaar.code-workspace b/bitbazaar.code-workspace index bbf8db99..9fb521a6 100644 --- a/bitbazaar.code-workspace +++ b/bitbazaar.code-workspace @@ -15,6 +15,14 @@ ], "rust-analyzer.rustfmt.extraArgs": [], "rust-analyzer.cargo.features": "all", // Enable all features in cargo.toml for type hinting + // Use a separate target dir to prevent it messing with other processes (used to cause locks etc): + // https://github.com/rust-lang/rust-analyzer/issues/6007 + "rust-analyzer.server.extraEnv": { + "CARGO_TARGET_DIR": "target/analyzer" + }, + "rust-analyzer.check.extraArgs": [ + "--target-dir=target/analyzer" + ], "biome.lspBin": "/usr/local/bin/biome", // Path to the biome binary installed in initial_setup.sh "editor.codeActionsOnSave": { @@ -99,29 +107,6 @@ "tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji", "tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format" ], - // For the tailwind extension if using: - // Note: biome class sorting should be possible soon: https://github.com/biomejs/biome/issues/1274 - "tailwindCSS.experimental.classRegex": [ - // Allows tailwind autocomplete to work in "classnames" function and "cx" shorthand for it. - // https://github.com/tailwindlabs/tailwindcss/issues/7553 - ["(?:classnames|cx)\\(([^)]*)\\)", "\"([^\"]*)\""], - ["(?:classnames|cx)\\(([^)]*)\\)", "'([^']*')"], - ["(?:classnames|cx)\\(([^)]*)\\)", "`([^`]*`)"], - - // Also allow it to work in any variable starting with Classes: - "Classes=\"([^\"]*)", //
- "Classes = \"([^\"]*)", // *.Classes = "..." - "Classes={\"([^\"}]*)", // - "Classes={`([^`}]*)", // - "Classes: \"([^\"]*)", // - "Classes: `([^`]*)" // - ], - "tailwindCSS.files.exclude": [ - "**/.git/**", - "**/node_modules/**", - "**/venv/**", - "**/.venv/**" - ], "scss.lint.unknownAtRules": "ignore", "search.useIgnoreFiles": false, // Otherwise, things in .gitignore will not be searchable, its better to exclude them manually: "notebook.output.textLineLimit": 100, @@ -141,7 +126,8 @@ "**/.git/**": true, "**/ipynb_checkpoints/**": true, "**/.ipynb": true, - "**/target/**": true + "**/target/**": true, + "**/prof/**": true }, "files.watcherExclude": { "**/.venv/**": true, diff --git a/dev_scripts/_scr_setup/setup.sh b/dev_scripts/_scr_setup/setup.sh index ee7f2032..629484a3 100755 --- a/dev_scripts/_scr_setup/setup.sh +++ b/dev_scripts/_scr_setup/setup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # If no function name provided, print a list of all the functions: if [ $# -eq 0 ]; then diff --git a/dev_scripts/docs.sh b/dev_scripts/docs.sh index 404f2d25..a373ac78 100755 --- a/dev_scripts/docs.sh +++ b/dev_scripts/docs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Exit on error # Builds the nested js site: diff --git a/dev_scripts/initial_setup.sh b/dev_scripts/initial_setup.sh index 4fc49932..5fb98b3a 100755 --- a/dev_scripts/initial_setup.sh +++ b/dev_scripts/initial_setup.sh @@ -1,8 +1,50 @@ -#!/bin/bash +#!/usr/bin/env bash # Stop on error: set -e +# Useful for platform matching, can use like: +# if is_arm; then +# echo "arm" +# else +# echo "not arm" +# fi +is_arm() { + if [ "$(uname -m)" == "arm64" ] || [ "$(uname -m)" == "aarch64" ]; then + return 0 # Return true + else + return 1 # Return false + fi +} + + +_ensure_zellij () { + target_version="0.40.1" + old_version=$(./dev_scripts/utils.sh match_substring 'zellij (.*)' "$(zellij --version 2>&1)" || echo "") + if [ "$old_version" != "$target_version" ]; then + echo "Installing zelliji version $target_version..." + + if [ "$(uname)" == "Darwin" ]; then + plat="apple-darwin" + elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + plat="unknown-linux-musl" + fi + + if is_arm; then + arch="aarch64" + else + arch="x86_64" + fi + + curl -L https://github.com/zellij-org/zellij/releases/download/v$target_version/zellij-$arch-$plat.tar.gz -o zellij.tar.gz -f + tar -xzf zellij.tar.gz + rm zellij.tar.gz + chmod +x zellij + sudo mv zellij /usr/local/bin + echo "zellij version $target_version installed!" + fi +} + # Pass in the version number _install_yaml_fmt () { echo "Installing yamlfmt version $1..." @@ -21,99 +63,120 @@ _install_yaml_fmt () { } -_install_openobserve() { - echo "Installing openobserve version $1..." - - # os lowercase: - OS=$(uname -s | tr '[:upper:]' '[:lower:]') - ARCH=$(uname -m) +_ensure_go () { + if ! command -v go > /dev/null 2>&1; then + echo "go toolchain not found, installing..." + go_version="1.22.3" + if is_arm; then + arch="arm64" + else + arch="amd64" + fi + if [ "$(uname)" == "Darwin" ]; then + plat="darwin" + elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + plat="linux" + fi - echo "Downloading openobserve version $1 for ${OS}-${ARCH}..." - curl -L https://github.com/openobserve/openobserve/releases/download/v$1/openobserve-v$1-${OS}-${ARCH}.tar.gz -o openobserve.tar.gz -f - tar -xzf openobserve.tar.gz - rm openobserve.tar.gz - chmod +x openobserve - sudo mv openobserve /usr/local/bin + curl -L https://go.dev/dl/go${go_version}.${plat}-${arch}.tar.gz -o go_src -f + sudo tar -C /usr/local -xzf go_src + rm go_src + echo "export GOPATH=~/go" >> ~/.profile && source ~/.profile + echo "Setting PATH to include golang binaries" + echo "export PATH='$PATH':/usr/local/go/bin:$GOPATH/bin" >> ~/.profile && source ~/.profile + fi } _ensure_openobserve() { - req_ver="$1" - - if [[ -z "$req_ver" ]]; then - echo "openobserve version not provided!" - exit 1 - fi + target_version="0.10.5" + old_version=$(./dev_scripts/utils.sh match_substring 'openobserve v(.*)' "$(openobserve --version 2>/dev/null)" || echo "") - if version=$(openobserve --version 2>/dev/null); then - # Will be "openobserve v$ver", make sure starts with "openobserve v" and remove that: - if [[ ! "$version" =~ ^openobserve\ v ]]; then - echo "openobserve version not found in expected format, expected 'openobserve vx.x.x', got '$version'!" - exit 1 - fi + if [ "$old_version" != "$target_version" ]; then + echo "Installing openobserve version $target_version..." - # Strip prefix: - version=${version#openobserve v} - - if [[ "$version" == "$req_ver" ]]; then - echo "openobserve already installed with correct version $version!" + OS=$(uname -s | tr '[:upper:]' '[:lower:]') + if is_arm; then + ARCH="arm64" else - echo "openobserve incorrect version, upgrading to $version..." - _install_openobserve $req_ver + ARCH="amd64" fi - else - _install_openobserve $req_ver - fi -} - -_install_otlp_collector () { - echo "Installing otlp_collector version $1..." - # os lowercase: - OS=$(uname -s | tr '[:upper:]' '[:lower:]') - ARCH=$(uname -m) - - # If ARCH == aarch64, replace with arm64: - if [ "${ARCH}" == "aarch64" ]; then - ARCH="arm64" + curl -L https://github.com/openobserve/openobserve/releases/download/v$target_version/openobserve-v$target_version-${OS}-${ARCH}.tar.gz -o openobserve.tar.gz -f + tar -xzf openobserve.tar.gz + rm openobserve.tar.gz + chmod +x openobserve + sudo mv openobserve /usr/local/bin fi - - echo "Downloading otlp_collector version $1 for ${OS}-${ARCH}..." - curl -L https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v$1/otelcol-contrib_$1_${OS}_${ARCH}.tar.gz \ - -o otlp_collector.tar.gz -f - tar -xzf otlp_collector.tar.gz - rm otlp_collector.tar.gz - # Comes out as otelcol-contrib: - mv otelcol-contrib otlp_collector - chmod +x otlp_collector - sudo mv otlp_collector /usr/local/bin } -_ensure_otlp_collector() { - req_ver="$1" - - if [[ -z "$req_ver" ]]; then - echo "otlp_collector version not provided!" - exit 1 - fi - - if version=$(otlp_collector --version 2>/dev/null); then - # Will be "otelcol-contrib version $ver", make sure starts with "otelcol-contrib version " and remove that: - if [[ ! "$version" =~ ^otelcol-contrib\ version\ ]]; then - echo "otlp_collector version not found in expected format, expected 'otelcol-contrib version x.x.x', got '$version'!" - exit 1 - fi - - # Strip prefix: - version=${version#otelcol-contrib version } - - if [[ "$version" == "$req_ver" ]]; then - echo "otlp_collector already installed with correct version $version!" +# We don't use the default released binary as it's 250MB! +# Instead, we compile a custom one that's only 22MB. +# We manage this by removing a bunch of features we don't need. +# For custom compilation docs, see https://opentelemetry.io/docs/collector/custom-collector/ +# For a full list of components to add, see https://github.com/open-telemetry/opentelemetry-collector/blob/main/cmd/otelcorecol/builder-config.yaml +_ensure_otlp_collector () { + target_version="0.100.0" + install_path="$HOME/compiled_otlp_collector" + build_path="$install_path/build" + active_version_path="$install_path/active_version.txt" + + # If active_version_path file doesn't exist, or doesn't contain target version, need to install/reinstall: + if [ ! -f $active_version_path ] || [ "$(cat $active_version_path)" != "$target_version" ]; then + echo "otlp_collector version $target_version needs installing..." + + # We're compiling the otlp go project from src, hence need go: + _ensure_go + + # Remove old artifacts: + rm -rf $install_path + mkdir -p $install_path + cd $install_path + + if is_arm; then + arch="arm64" else - echo "otlp_collector incorrect version, upgrading to $version..." - _install_otlp_collector $req_ver + arch="amd64" fi - else - _install_otlp_collector $req_ver + if [ "$(uname)" == "Darwin" ]; then + plat="darwin" + elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + plat="linux" + fi + + # Install the builder: + curl --proto '=https' --tlsv1.2 -fL -o ocb \ + https://github.com/open-telemetry/opentelemetry-collector/releases/download/cmd%2Fbuilder%2Fv${target_version}/ocb_${target_version}_${plat}_${arch} + chmod +x ocb + + # Write the builder config yaml file the builder needs, this specifies which components we're actually going to build: + printf "%s\n" "dist:" \ + " name: otelcol-dev" \ + " description: Basic OTel Collector distribution for Developers" \ + " output_path: ./otelcol-dev" \ + " otelcol_version: ${target_version}" \ + "" \ + "exporters:" \ + " - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v${target_version}" \ + "" \ + "processors:" \ + " - gomod: go.opentelemetry.io/collector/processor/batchprocessor v${target_version}" \ + " - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v${target_version}" \ + "" \ + "receivers:" \ + " - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v${target_version}" \ + "" > builder-config.yaml + + # Run the builder: + go env + ./ocb --config builder-config.yaml --verbose + + # Make the binary executable: + chmod +x otelcol-dev/otelcol-dev + # Move the outputted binary to /usr/local/bin and rename to "otlp_collector" + sudo mv otelcol-dev/otelcol-dev /usr/local/bin/otlp_collector + + # Update the active version so won't re-install next time unless version changes: + echo $target_version > $active_version_path fi } @@ -159,6 +222,35 @@ _ensure_biome() { fi } +_install_cargo_hack () { + # Get host target + host=$(rustc -Vv | grep host | sed 's/host: //') + # Download binary and install to $HOME/.cargo/bin + curl --proto '=https' --tlsv1.2 -fsSL https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-$host.tar.gz | tar xzf - -C "$HOME/.cargo/bin" +} + +_ensure_cargo_hack () { + if version=$(./dev_scripts/utils.sh match_substring 'cargo-hack (.*)' "$(cargo hack --version)"); then + echo "cargo-hack already installed with version $version" + else + echo "cargo-hack not installed, installing..." + _install_cargo_hack + fi +} + +_ensure_gnuplot () { + if command -v gnuplot > /dev/null 2>&1; then + echo "gnuplot already installed" + else + echo "gnuplot could not be found, installing..." + if [ "$(uname)" == "Darwin" ]; then + brew install gnuplot + elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + sudo apt-get install -y gnuplot + fi + fi +} + initial_setup () { # Install useful local directories (might be unused): mkdir -p ./process_data @@ -172,9 +264,14 @@ initial_setup () { pipx install zetch fi + # Make sure zellij installed and correct version: + _ensure_zellij + # Make sure openobserve is installed for dev open telemetry logging: - _ensure_openobserve "0.8.0" - _ensure_otlp_collector "0.94.0" + _ensure_openobserve + + # Make sure otlp collector is installed as the interface between our processes and openobserve: + _ensure_otlp_collector # Make sure biome is installed for linting and formatting various files: _ensure_biome "1.5.3" @@ -200,13 +297,21 @@ initial_setup () { _install_yaml_fmt $yamlfmt_req_ver fi + # Make sure nextest is installed: cargo install cargo-nextest --locked + # Make sure cargo-hack is installed: + _ensure_cargo_hack + # Make sure gnuplot installed for criterion benchmarks: + _ensure_gnuplot # Install pre-commit if not already: pipx install pre-commit || true pre-commit install + # Make sure pdm global cache being used to speed up installs: + pdm config install.cache on + echo "Setting up docs..." cd docs # Effectively simulating pdm init but won't modify upstream pyproject.toml or use existing active venv: @@ -223,13 +328,6 @@ initial_setup () { pdm install -G:all cd .. - echo "Setting up js..." - cd js - npm i - cd .. - - - echo "Setting up rust backed python project..." ./dev_scripts/py_rust.sh ensure_venv diff --git a/dev_scripts/pkg.sh b/dev_scripts/pkg.sh index e9404ff4..eeaddc2c 100755 --- a/dev_scripts/pkg.sh +++ b/dev_scripts/pkg.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Stop on error: set -e diff --git a/dev_scripts/process.sh b/dev_scripts/process.sh index 60e5aac3..75169031 100755 --- a/dev_scripts/process.sh +++ b/dev_scripts/process.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Stop on error: set -e @@ -104,25 +104,23 @@ list() { # Terminate a process and all of its child processes terminate() { local parent_pid="$1" - local IS_CHILD=$2 # Terminate the child processes of the parent PID local child_pids=$(pgrep -P "$parent_pid") for pid in $child_pids; do - terminate "$pid" "true" + terminate "$pid" done # Terminate the parent PID if ps -p "$parent_pid" > /dev/null; then - if [ "$IS_CHILD" = "true" ]; then - echo "Terminating child: $parent_pid" - else - echo "Terminating root: $parent_pid" - fi - # Or true to not error if the process is already dead: - kill -9 "$parent_pid" > /dev/null 2>&1 || true + # The || true to ignore when the pid is already dead: + # Send SIGTERM and SIGHUP, then if it's still alive after 15 seconds, send SIGKILL + kill -15 "$parent_pid" 2>/dev/null || true + kill -1 "$parent_pid" 2>/dev/null || true + { sleep 15; kill -9 "$parent_pid" 2>/dev/null || true; } & fi } + # Has to come at the end of these files: source ./dev_scripts/_scr_setup/setup.sh "$@" \ No newline at end of file diff --git a/dev_scripts/py_rust.sh b/dev_scripts/py_rust.sh index bd4d8af8..77b2a57e 100755 --- a/dev_scripts/py_rust.sh +++ b/dev_scripts/py_rust.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Stop on error: set -e @@ -21,10 +21,8 @@ ensure_venv () { source ./py_rust/.venv/bin/activate fi - ./dev_scripts/utils.sh py_install_if_missing typing-extensions - ./dev_scripts/utils.sh py_install_if_missing maturin - ./dev_scripts/utils.sh py_install_if_missing pyright - ./dev_scripts/utils.sh py_install_if_missing pytest + # Install any dev requirements that aren't managed by maturin: + pip install -r ./py_rust/dev_requirements.txt } diff --git a/dev_scripts/run.sh b/dev_scripts/run.sh index 2b8743bd..4aee27da 100755 --- a/dev_scripts/run.sh +++ b/dev_scripts/run.sh @@ -1,49 +1,26 @@ -#!/bin/bash +#!/usr/bin/env bash # Stop on error: set -e -# Prep for running top-level services -_prep () { - # A custom env version may have been used before, reset zetch to make sure not the case. - zetch - - # Start open telemetry collector and openobserve in the background: - ./dev_scripts/run.sh collector - ./dev_scripts/run.sh oo +# Debug+prod prep for running top-level services +_shared_run_prep () { } -# Starts the open telemetry collector in the background to collect open telemetry data -collector () { - if [ "$(./dev_scripts/utils.sh in_ci)" = "true" ]; then - echo "In CI, not starting open telemetry collector." - else - prefix="otlp_col_" - - # Stop any current open observer processes: - ./dev_scripts/process.sh stop $prefix - - # Run the process: - ./dev_scripts/process.sh start "${prefix}bitbazaar" "otlp_collector --config $(pwd)/opencollector.yaml" - fi -} - -# Starts the openobserve server in the background to look at dev logs/traces/metrics +# Starts the openobserve server: oo () { - if [ "$(./dev_scripts/utils.sh in_ci)" = "true" ]; then - echo "In CI, not starting openobserver." - else - prefix="oo_" - - # Stop any current open observer processes: - ./dev_scripts/process.sh stop $prefix + ZO_ROOT_USER_EMAIL="dev@dev.com" ZO_ROOT_USER_PASSWORD="pass" \ + ZO_DATA_DIR="$(pwd)/process_data/openobserve" \ + openobserve +} - ZO_ROOT_USER_EMAIL="dev@dev.com" ZO_ROOT_USER_PASSWORD="pass" \ - ZO_DATA_DIR="$(pwd)/process_data/openobserve" \ - ./dev_scripts/process.sh start "${prefix}bitbazaar" "openobserve" - fi +# Open telemetry collector: +collector () { + # Make sure stopped before starting again (zj SIGHUP doesn't seem to be respected by otlp_collector) + pkill -9 otlp_collector &> /dev/null || true + otlp_collector --config $(pwd)/opencollector.yaml } # Has to come at the end of these files: diff --git a/dev_scripts/test.sh b/dev_scripts/test.sh index 0861e2c0..612f5e70 100755 --- a/dev_scripts/test.sh +++ b/dev_scripts/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Stop on error: set -e @@ -8,13 +8,13 @@ all () { ./dev_scripts/test.sh qa echo "Python..." - ./dev_scripts/test.sh py + ./dev_scripts/test.sh py -n auto echo "Javascript..." ./dev_scripts/test.sh js echo "Python Rust..." - ./dev_scripts/test.sh py_rust + ./dev_scripts/test.sh py_rust -n auto echo "Rust..." ./dev_scripts/test.sh rust @@ -60,17 +60,13 @@ qa () { } py () { - ./dev_scripts/run.sh collector # Needed for open telemetry tests in bitbazaar - cd ./py/ # Check for COVERAGE=False/false, which is set in some workflow runs to make faster: if [[ "$COVERAGE" == "False" ]] || [[ "$COVERAGE" == "false" ]]; then echo "COVERAGE=False/false, not running coverage" pdm run pytest $@ else - pdm run coverage run --parallel -m pytest $@ - pdm run coverage combine - pdm run coverage report + pdm run pytest --cov=./bitbazaar/ $@ fi cd .. } @@ -103,17 +99,35 @@ py_rust () { fi # Have to specify to compile in debug mode (meaning it will use the install_debug call above) - cargo nextest run --cargo-profile dev --all-features + cargo nextest run --all-features python -m pytest $@ deactivate cd .. } +# Used internally by pre-commit: +cargo_py_rust_check () { + # This will go through and check with no features, each feature on it's own, and all features respectively. + # Note: won't do unnecessary checks, e.g. if no features will only run cargo check once. + cargo hack check --manifest-path=./py_rust/Cargo.toml --each-feature +} + rust () { - ./dev_scripts/run.sh collector # Needed for open telemetry tests in bitbazaar - cargo nextest run --cargo-profile dev --manifest-path ./rust/Cargo.toml --all-features $@ + cargo nextest run --manifest-path ./rust/Cargo.toml --all-features $@ +} + +rust_bench () { + + cargo bench --manifest-path ./rust/Cargo.toml --all-features $@ +} + +# Used internally by pre-commit: +cargo_rust_check () { + # This will go through and check with no features, each feature on it's own, and all features respectively using cargo hack. + # Note: won't do unnecessary checks, e.g. if no features in this project will only run cargo check once. + cargo hack check --manifest-path=./rust/Cargo.toml --each-feature } docs () { diff --git a/dev_scripts/utils.sh b/dev_scripts/utils.sh index 858cf762..37601610 100755 --- a/dev_scripts/utils.sh +++ b/dev_scripts/utils.sh @@ -1,12 +1,79 @@ -#!/bin/bash +#!/usr/bin/env bash # Stop on error: set -e -# Run commands in parallel. E.g. run_parallel "sleep 1" "sleep 1" "sleep 1" -run_parallel () { - # --halt now,fail=1 stops all processes if any of the error - parallel --ungroup -j 0 --halt now,fail=1 ::: "$@" +pre_till_commit () { + ./dev_scripts/test.sh pre_till_success + git commit "$@" +} + +# Run commands in parallel. E.g. run_endless_parallel "sleep 1" "sleep 1" "sleep 1" +# - if any exit, exit all. Because this is for endless parallelism, if something goes down, the whole thing should. +# Originally used gnu-parallel line below, but caused problems in prod and with child processes: +# parallel --ungroup -j 0 --halt now,done=1 ::: "$@" +run_endless_parallel () { + # 4.3 needed for wait -n: + ensure_bash_version + + # Store each pid, so can kill all and their children if one fails: + local pids=() + local succeeded_pids=() + + # Called after error and on ctrl-c to kill any remaining processes: + kill_unfinished() { + # Terminate any that didn't succeed. + # That script will send sigterm/hup first, + # then 15 seconds later kill if still active. + for pid in "${pids[@]}"; do + if [[ ! ${succeeded_pids[@]} =~ $pide ]]; then + ./dev_scripts/process.sh terminate "$pid" + fi + done + } + + # Make sure to still kill background processes if e.g. ctrl-c is pressed: + on_external_kill() { + kill_unfinished + exit 1 + } + trap 'on_external_kill' INT + + # Fire off each command in the background: + for cmd in "$@"; do + eval "$cmd" & pid=$! + pids+=($pid) + done + + for cmd in "$@"; do + # Disable exit on error temporarily, would break the inside block: + set +e + # Wait for ANY PID to finish + # The || true is needed because we call "set -e" on all our scripts. + wait -n + exit_status=$? + finished_pid=$! + # Re-enable exit on error: + set -e + + if [ $exit_status -eq 0 ]; then + succeeded_pids+=($finished_pid) + fi + + # In both cases of successful exit and not, + # kill all remaining PID's and return with the code of the original. + # Find the command so we can print its exit code: + finished_cmd="" + for i in "${!pids[@]}"; do + if [ "${pids[i]}" -eq "$finished_pid" ]; then + finished_cmd="${@:i:i+1}" + break + fi + done + echo "Cmd exited with code=$exit_status: \"$finished_cmd\". Forcefully exiting remaining commands..." + kill_unfinished + return $exit_status + done } py_install_if_missing () { @@ -63,5 +130,34 @@ match_substring () { anypython ./dev_scripts/_internal/match_substring.py "$1" "$2" } +# Return a random id to use +rand_id () { + echo $(openssl rand -hex 3) +} + +run_in_new_terminal () { + if [ "$(uname)" == "Darwin" ]; then + osascript -e "tell application \"Terminal\" to do script \"cd $(pwd); $1\"" + else + x-terminal-emulator -e "$1" + fi +} + +docker_stop_all_containers () { + sudo docker stop $(sudo docker ps -a -q) 2>/dev/null || true +} + +docker_delete_all_containers () { + sudo docker rm -vf $(sudo docker ps -a -q) 2>/dev/null || true +} + +docker_prune_volumes () { + sudo docker volume prune +} + +docker_delete_all_images () { + sudo docker rmi -f $(sudo docker images -a -q) 2>/dev/null || true +} + # Has to come at the end of these files: source ./dev_scripts/_scr_setup/setup.sh "$@" diff --git a/dev_scripts/zj.sh b/dev_scripts/zj.sh new file mode 100755 index 00000000..b87d3e98 --- /dev/null +++ b/dev_scripts/zj.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# Stop on error: +set -e + +wait_for_session () { + # Wait for session to be available, checking every 0.01 seconds, after 2 seconds break with error: + found=false + for i in {1..200}; do + if zellij list-sessions | grep -q $1; then + found=true + # If i isn't 1, meaning literally just been created, + # wait an extra 0.05 seconds to make sure everything is ready: + if [ "$i" != 1 ]; then + sleep 0.05 + fi + break + fi + sleep 0.01 + done + if [ "$found" = false ]; then + echo "Session $1 not found after 2 seconds" + exit 1 + fi +} + +# Has to come at the end of these files: +source ./dev_scripts/_scr_setup/setup.sh "$@" diff --git a/js/bun.lockb b/js/bun.lockb index be720c30..53710a20 100755 Binary files a/js/bun.lockb and b/js/bun.lockb differ diff --git a/js/package-lock.json b/js/package-lock.json index 7ffb72fb..199c80ce 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -1,12 +1,12 @@ { "name": "bitbazaar", - "version": "0.0.28", + "version": "0.0.29", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "bitbazaar", - "version": "0.0.28", + "version": "0.0.29", "license": "MIT", "dependencies": { "@opentelemetry/api": "^1.8.0", @@ -44,7 +44,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "vite": "^5.0.11", - "wouter": "^3.0.0-rc.1" + "wouter": "<=3.1.3" } }, "node_modules/@ampproject/remapping": { @@ -2759,9 +2759,9 @@ } }, "node_modules/@testing-library/react": { - "version": "14.2.1", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-14.2.1.tgz", - "integrity": "sha512-sGdjws32ai5TLerhvzThYFbpnF9XtL65Cjf+gB0Dhr29BGqK+mAeN7SURSdu+eqgET4ANcWoC7FQpkaiGvBr+A==", + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-14.1.2.tgz", + "integrity": "sha512-z4p7DVBTPjKM5qDZ0t5ZjzkpSNb+fZy1u6bzO7kk8oeGagpPCAtgh4cx1syrfp7a+QWkM021jGqjJaxJJnXAZg==", "dev": true, "dependencies": { "@babel/runtime": "^7.12.5", @@ -6658,13 +6658,13 @@ } }, "node_modules/vite": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.0.tgz", - "integrity": "sha512-STmSFzhY4ljuhz14bg9LkMTk3d98IO6DIArnTY6MeBwiD1Za2StcQtz7fzOUnRCqrHSD5+OS2reg4HOz1eoLnw==", + "version": "5.0.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz", + "integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==", "peer": true, "dependencies": { "esbuild": "^0.19.3", - "postcss": "^8.4.35", + "postcss": "^8.4.32", "rollup": "^4.2.0" }, "bin": { @@ -7460,9 +7460,9 @@ } }, "node_modules/wouter": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/wouter/-/wouter-3.0.0.tgz", - "integrity": "sha512-mI7KL45peK6D15f5fdE9xpzn/ShbCTnBO5BPUX/XpZm+lwxs7h2t2Nh++Kcr7nozdCzKnomrFxDIObuIEZB1sg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/wouter/-/wouter-3.1.3.tgz", + "integrity": "sha512-peIjHLma9MWDb9PAxVV+h+yYxpx9y5V6O1jF49ru8NEvLaDhwZR4y4FMYN5C3FM7CSXFn3ZmBeTq3g+V8b+hRQ==", "peer": true, "dependencies": { "mitt": "^3.0.1", diff --git a/js/package.json b/js/package.json index 3cb46bc7..9d1db013 100644 --- a/js/package.json +++ b/js/package.json @@ -2,24 +2,29 @@ "name": "bitbazaar", "version": "0.0.29", "description": "An assortment of publicly available cross-language utilities useful to my projects.", - "scripts": { "build": "tsup && node ./build_standalone_cdn_log.js" }, + "scripts": { + "prep": "bun i ", + "build": "bun run prep && bun run --bun tsup" + }, "repository": { "type": "git", "url": "git+https://github.com/zakstucke/bitbazaar.git" }, "author": "zakstucke@gmail.com", "license": "MIT", + "type": "module", "main": "index.cjs", "module": "index.js", "types": "index.d.ts", "sideEffects": false, "devDependencies": { - "@happy-dom/global-registrator": "13.3.8", - "bun-types": ">=1.0.15", "tsup": ">=7.2.0", + "bun-types": ">=1.0.15", "typescript": ">=5.2.2", + "@happy-dom/global-registrator": "13.3.8", "@testing-library/react": "^14.1.2", + "wouter": "<3.2.0", "@types/chroma-js": "^2.4.2", "@types/html-minifier-terser": "7.0.1", "@types/react": "^18.2.31", @@ -30,7 +35,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "vite": "^5.0.11", - "wouter": "^3.0.0-rc.1" + "wouter": "^3.2.0" }, "dependencies": { "install": "^0.13.0", diff --git a/js/tsconfig.json b/js/tsconfig.json index 4dc0775a..ec7a37a1 100644 --- a/js/tsconfig.json +++ b/js/tsconfig.json @@ -32,8 +32,7 @@ "forceConsistentCasingInFileNames": true, "skipLibCheck": true, "downlevelIteration": true, - "allowSyntheticDefaultImports": true - }, + "allowSyntheticDefaultImports": true }, "exclude": [ "**/*.spec.(cjs|mjs|js|jsx|ts|tsx)", "**/*.test.(cjs|mjs|js|jsx|ts|tsx)", diff --git a/js/tsconfig.zetch.json b/js/tsconfig.zetch.json index efb5a08a..ffcbaa53 100644 --- a/js/tsconfig.zetch.json +++ b/js/tsconfig.zetch.json @@ -32,8 +32,7 @@ "forceConsistentCasingInFileNames": true, "skipLibCheck": true, "downlevelIteration": true, - "allowSyntheticDefaultImports": true - }, + "allowSyntheticDefaultImports": true }, "exclude": [ "**/*.spec.(cjs|mjs|js|jsx|ts|tsx)", "**/*.test.(cjs|mjs|js|jsx|ts|tsx)", diff --git a/opencollector.yaml b/opencollector.yaml index 2024bff1..3126f215 100644 --- a/opencollector.yaml +++ b/opencollector.yaml @@ -30,15 +30,6 @@ exporters: headers: Authorization: Basic ZGV2QGRldi5jb206cGFzcw== stream-name: default - # Writes all opentelemetry logs, traces, metrics to a file, useful for testing: - file/debug_file_writing: - path: /home/runner/work/bitbazaar/bitbazaar/logs/otlp_telemetry_out.log - rotation: - max_megabytes: 10 - max_days: 3 - max_backups: 3 - localtime: true - flush_interval: 1 # Write every 1 seconds service: telemetry: @@ -51,16 +42,13 @@ service: processors: [memory_limiter, batch] exporters: - otlphttp - - file/debug_file_writing traces: receivers: [otlp] processors: [memory_limiter, batch] exporters: - otlphttp - - file/debug_file_writing metrics: # Don't bother with memory limiting for metrics, traces and logs will be the largest consumers of memory receivers: [otlp] processors: [batch] exporters: - otlphttp - - file/debug_file_writing diff --git a/opencollector.yaml.zetch b/opencollector.yaml.zetch index 9357b37a..38d7cadb 100644 --- a/opencollector.yaml.zetch +++ b/opencollector.yaml.zetch @@ -31,18 +31,6 @@ exporters: Authorization: {{ OTLP_OO_AUTH }} stream-name: default -{%- if DEBUG %} - # Writes all opentelemetry logs, traces, metrics to a file, useful for testing: - file/debug_file_writing: - path: {{ ROOT_DIR }}/logs/otlp_telemetry_out.log - rotation: - max_megabytes: 10 - max_days: 3 - max_backups: 3 - localtime: true - flush_interval: 1 # Write every 1 seconds -{%- endif %} - service: telemetry: logs: @@ -54,22 +42,13 @@ service: processors: [memory_limiter, batch] exporters: - otlphttp - {%- if DEBUG %} - - file/debug_file_writing - {%- endif %} traces: receivers: [otlp] processors: [memory_limiter, batch] exporters: - otlphttp - {%- if DEBUG %} - - file/debug_file_writing - {%- endif %} metrics: # Don't bother with memory limiting for metrics, traces and logs will be the largest consumers of memory receivers: [otlp] processors: [batch] exporters: - - otlphttp - {%- if DEBUG %} - - file/debug_file_writing - {%- endif %} \ No newline at end of file + - otlphttp \ No newline at end of file diff --git a/py/bitbazaar/__init__.py b/py/bitbazaar/__init__.py index 01fa1c71..18aacfd6 100644 --- a/py/bitbazaar/__init__.py +++ b/py/bitbazaar/__init__.py @@ -3,4 +3,5 @@ from importlib.metadata import version __version__ = version("bitbazaar") + __all__ = ["__version__"] diff --git a/py/bitbazaar/log/_formatting.py b/py/bitbazaar/log/_formatting.py index c2949712..5b6d63b9 100644 --- a/py/bitbazaar/log/_formatting.py +++ b/py/bitbazaar/log/_formatting.py @@ -258,7 +258,7 @@ def _fmt_where_parts(log: LogRecord, is_file: bool, show_sids: bool) -> str: else: return f"[dim italic] where {parts_str}[/]\n" else: - return "" + return "" # pragma: no cover def _format_duration(nanoseconds: int) -> str: # pragma: no cover diff --git a/py/pdm.lock b/py/pdm.lock index 11d19416..027b39e6 100644 --- a/py/pdm.lock +++ b/py/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev", "test"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:746c185679af35306f95dd2390c7c455677e9a0d8308a5d526f64b3a935d3bdc" +content_hash = "sha256:6dc882a8f2b7d773efed1cb36f92c2762bfc0b03d2a98791a1a62db70f5ce1e8" [[package]] name = "appnope" @@ -32,27 +32,15 @@ files = [ {file = "asttokens-2.4.1.tar.gz", hash = "sha256:b03869718ba9a6eb027e134bfdf69f38a236d681c83c160d510768af11254ba0"}, ] -[[package]] -name = "backoff" -version = "2.2.1" -requires_python = ">=3.7,<4.0" -summary = "Function decoration for backoff and retry" -groups = ["default"] -marker = "python_version >= \"3.7\"" -files = [ - {file = "backoff-2.2.1-py3-none-any.whl", hash = "sha256:63579f9a0628e06278f7e47b7d7d5b6ce20dc65c5e96a6f3ca99a6adca0396e8"}, - {file = "backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba"}, -] - [[package]] name = "certifi" -version = "2024.2.2" +version = "2024.6.2" requires_python = ">=3.6" summary = "Python package for providing Mozilla's CA Bundle." groups = ["default"] files = [ - {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, - {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, + {file = "certifi-2024.6.2-py3-none-any.whl", hash = "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56"}, + {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516"}, ] [[package]] @@ -267,6 +255,17 @@ files = [ {file = "Deprecated-1.2.14.tar.gz", hash = "sha256:e5323eb936458dccc2582dc6f9c322c852a775a27065ff2b0c4970b9d53d01b3"}, ] +[[package]] +name = "execnet" +version = "2.1.1" +requires_python = ">=3.8" +summary = "execnet: rapid multi-Python deployment" +groups = ["test"] +files = [ + {file = "execnet-2.1.1-py3-none-any.whl", hash = "sha256:26dee51f1b80cebd6d0ca8e74dd8745419761d3bef34163928cbebbdc4749fdc"}, + {file = "execnet-2.1.1.tar.gz", hash = "sha256:5189b52c6121c24feae288166ab41b32549c7e2348652736540b9e6e7d4e72e3"}, +] + [[package]] name = "executing" version = "2.0.1" @@ -280,60 +279,60 @@ files = [ [[package]] name = "googleapis-common-protos" -version = "1.62.0" +version = "1.63.1" requires_python = ">=3.7" summary = "Common protobufs used in Google APIs" groups = ["default"] dependencies = [ - "protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0.dev0,>=3.19.5", + "protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0.dev0,>=3.19.5", ] files = [ - {file = "googleapis-common-protos-1.62.0.tar.gz", hash = "sha256:83f0ece9f94e5672cced82f592d2a5edf527a96ed1794f0bab36d5735c996277"}, - {file = "googleapis_common_protos-1.62.0-py2.py3-none-any.whl", hash = "sha256:4750113612205514f9f6aa4cb00d523a94f3e8c06c5ad2fee466387dc4875f07"}, + {file = "googleapis-common-protos-1.63.1.tar.gz", hash = "sha256:c6442f7a0a6b2a80369457d79e6672bb7dcbaab88e0848302497e3ec80780a6a"}, + {file = "googleapis_common_protos-1.63.1-py2.py3-none-any.whl", hash = "sha256:0e1c2cdfcbc354b76e4a211a35ea35d6926a835cba1377073c4861db904a1877"}, ] [[package]] name = "grpcio" -version = "1.60.1" -requires_python = ">=3.7" +version = "1.64.1" +requires_python = ">=3.8" summary = "HTTP/2-based RPC framework" groups = ["default"] files = [ - {file = "grpcio-1.60.1-cp311-cp311-linux_armv7l.whl", hash = "sha256:79ae0dc785504cb1e1788758c588c711f4e4a0195d70dff53db203c95a0bd303"}, - {file = "grpcio-1.60.1-cp311-cp311-macosx_10_10_universal2.whl", hash = "sha256:4eec8b8c1c2c9b7125508ff7c89d5701bf933c99d3910e446ed531cd16ad5d87"}, - {file = "grpcio-1.60.1-cp311-cp311-manylinux_2_17_aarch64.whl", hash = "sha256:8c9554ca8e26241dabe7951aa1fa03a1ba0856688ecd7e7bdbdd286ebc272e4c"}, - {file = "grpcio-1.60.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:91422ba785a8e7a18725b1dc40fbd88f08a5bb4c7f1b3e8739cab24b04fa8a03"}, - {file = "grpcio-1.60.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cba6209c96828711cb7c8fcb45ecef8c8859238baf15119daa1bef0f6c84bfe7"}, - {file = "grpcio-1.60.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:c71be3f86d67d8d1311c6076a4ba3b75ba5703c0b856b4e691c9097f9b1e8bd2"}, - {file = "grpcio-1.60.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:af5ef6cfaf0d023c00002ba25d0751e5995fa0e4c9eec6cd263c30352662cbce"}, - {file = "grpcio-1.60.1-cp311-cp311-win32.whl", hash = "sha256:a09506eb48fa5493c58f946c46754ef22f3ec0df64f2b5149373ff31fb67f3dd"}, - {file = "grpcio-1.60.1-cp311-cp311-win_amd64.whl", hash = "sha256:49c9b6a510e3ed8df5f6f4f3c34d7fbf2d2cae048ee90a45cd7415abab72912c"}, - {file = "grpcio-1.60.1-cp312-cp312-linux_armv7l.whl", hash = "sha256:b58b855d0071575ea9c7bc0d84a06d2edfbfccec52e9657864386381a7ce1ae9"}, - {file = "grpcio-1.60.1-cp312-cp312-macosx_10_10_universal2.whl", hash = "sha256:a731ac5cffc34dac62053e0da90f0c0b8560396a19f69d9703e88240c8f05858"}, - {file = "grpcio-1.60.1-cp312-cp312-manylinux_2_17_aarch64.whl", hash = "sha256:cf77f8cf2a651fbd869fbdcb4a1931464189cd210abc4cfad357f1cacc8642a6"}, - {file = "grpcio-1.60.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c557e94e91a983e5b1e9c60076a8fd79fea1e7e06848eb2e48d0ccfb30f6e073"}, - {file = "grpcio-1.60.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:069fe2aeee02dfd2135d562d0663fe70fbb69d5eed6eb3389042a7e963b54de8"}, - {file = "grpcio-1.60.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:cb0af13433dbbd1c806e671d81ec75bd324af6ef75171fd7815ca3074fe32bfe"}, - {file = "grpcio-1.60.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:2f44c32aef186bbba254129cea1df08a20be414144ac3bdf0e84b24e3f3b2e05"}, - {file = "grpcio-1.60.1-cp312-cp312-win32.whl", hash = "sha256:a212e5dea1a4182e40cd3e4067ee46be9d10418092ce3627475e995cca95de21"}, - {file = "grpcio-1.60.1-cp312-cp312-win_amd64.whl", hash = "sha256:6e490fa5f7f5326222cb9f0b78f207a2b218a14edf39602e083d5f617354306f"}, - {file = "grpcio-1.60.1.tar.gz", hash = "sha256:dd1d3a8d1d2e50ad9b59e10aa7f07c7d1be2b367f3f2d33c5fade96ed5460962"}, + {file = "grpcio-1.64.1-cp311-cp311-linux_armv7l.whl", hash = "sha256:58b1041e7c870bb30ee41d3090cbd6f0851f30ae4eb68228955d973d3efa2e61"}, + {file = "grpcio-1.64.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:bbc5b1d78a7822b0a84c6f8917faa986c1a744e65d762ef6d8be9d75677af2ca"}, + {file = "grpcio-1.64.1-cp311-cp311-manylinux_2_17_aarch64.whl", hash = "sha256:5841dd1f284bd1b3d8a6eca3a7f062b06f1eec09b184397e1d1d43447e89a7ae"}, + {file = "grpcio-1.64.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8caee47e970b92b3dd948371230fcceb80d3f2277b3bf7fbd7c0564e7d39068e"}, + {file = "grpcio-1.64.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:73819689c169417a4f978e562d24f2def2be75739c4bed1992435d007819da1b"}, + {file = "grpcio-1.64.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:6503b64c8b2dfad299749cad1b595c650c91e5b2c8a1b775380fcf8d2cbba1e9"}, + {file = "grpcio-1.64.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1de403fc1305fd96cfa75e83be3dee8538f2413a6b1685b8452301c7ba33c294"}, + {file = "grpcio-1.64.1-cp311-cp311-win32.whl", hash = "sha256:d4d29cc612e1332237877dfa7fe687157973aab1d63bd0f84cf06692f04c0367"}, + {file = "grpcio-1.64.1-cp311-cp311-win_amd64.whl", hash = "sha256:5e56462b05a6f860b72f0fa50dca06d5b26543a4e88d0396259a07dc30f4e5aa"}, + {file = "grpcio-1.64.1-cp312-cp312-linux_armv7l.whl", hash = "sha256:4657d24c8063e6095f850b68f2d1ba3b39f2b287a38242dcabc166453e950c59"}, + {file = "grpcio-1.64.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:62b4e6eb7bf901719fce0ca83e3ed474ae5022bb3827b0a501e056458c51c0a1"}, + {file = "grpcio-1.64.1-cp312-cp312-manylinux_2_17_aarch64.whl", hash = "sha256:ee73a2f5ca4ba44fa33b4d7d2c71e2c8a9e9f78d53f6507ad68e7d2ad5f64a22"}, + {file = "grpcio-1.64.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:198908f9b22e2672a998870355e226a725aeab327ac4e6ff3a1399792ece4762"}, + {file = "grpcio-1.64.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:39b9d0acaa8d835a6566c640f48b50054f422d03e77e49716d4c4e8e279665a1"}, + {file = "grpcio-1.64.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:5e42634a989c3aa6049f132266faf6b949ec2a6f7d302dbb5c15395b77d757eb"}, + {file = "grpcio-1.64.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:b1a82e0b9b3022799c336e1fc0f6210adc019ae84efb7321d668129d28ee1efb"}, + {file = "grpcio-1.64.1-cp312-cp312-win32.whl", hash = "sha256:55260032b95c49bee69a423c2f5365baa9369d2f7d233e933564d8a47b893027"}, + {file = "grpcio-1.64.1-cp312-cp312-win_amd64.whl", hash = "sha256:c1a786ac592b47573a5bb7e35665c08064a5d77ab88a076eec11f8ae86b3e3f6"}, + {file = "grpcio-1.64.1.tar.gz", hash = "sha256:8d51dd1c59d5fa0f34266b80a3805ec29a1f26425c2a54736133f6d87fc4968a"}, ] [[package]] name = "idna" -version = "3.6" +version = "3.7" requires_python = ">=3.5" summary = "Internationalized Domain Names in Applications (IDNA)" groups = ["default"] files = [ - {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"}, - {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, + {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, + {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, ] [[package]] name = "importlib-metadata" -version = "6.11.0" +version = "7.1.0" requires_python = ">=3.8" summary = "Read metadata from Python packages" groups = ["default"] @@ -341,8 +340,8 @@ dependencies = [ "zipp>=0.5", ] files = [ - {file = "importlib_metadata-6.11.0-py3-none-any.whl", hash = "sha256:f0afba6205ad8f8947c7d338b5342d5db2afbfd82f9cbef7879a9539cc12eb9b"}, - {file = "importlib_metadata-6.11.0.tar.gz", hash = "sha256:1231cf92d825c9e03cfc4da076a16de6422c863558229ea0b22b675657463443"}, + {file = "importlib_metadata-7.1.0-py3-none-any.whl", hash = "sha256:30962b96c0c223483ed6cc7280e7f0199feb01a0e40cfae4d4450fc6fab1f570"}, + {file = "importlib_metadata-7.1.0.tar.gz", hash = "sha256:b78938b926ee8d5f020fc4772d487045805a55ddbad2ecf21c6d60938dc7fcd2"}, ] [[package]] @@ -543,130 +542,130 @@ files = [ [[package]] name = "opentelemetry-api" -version = "1.22.0" -requires_python = ">=3.7" +version = "1.25.0" +requires_python = ">=3.8" summary = "OpenTelemetry Python API" groups = ["default"] dependencies = [ "deprecated>=1.2.6", - "importlib-metadata<7.0,>=6.0", + "importlib-metadata<=7.1,>=6.0", ] files = [ - {file = "opentelemetry_api-1.22.0-py3-none-any.whl", hash = "sha256:43621514301a7e9f5d06dd8013a1b450f30c2e9372b8e30aaeb4562abf2ce034"}, - {file = "opentelemetry_api-1.22.0.tar.gz", hash = "sha256:15ae4ca925ecf9cfdfb7a709250846fbb08072260fca08ade78056c502b86bed"}, + {file = "opentelemetry_api-1.25.0-py3-none-any.whl", hash = "sha256:757fa1aa020a0f8fa139f8959e53dec2051cc26b832e76fa839a6d76ecefd737"}, + {file = "opentelemetry_api-1.25.0.tar.gz", hash = "sha256:77c4985f62f2614e42ce77ee4c9da5fa5f0bc1e1821085e9a47533a9323ae869"}, ] [[package]] name = "opentelemetry-exporter-otlp" -version = "1.22.0" -requires_python = ">=3.7" +version = "1.25.0" +requires_python = ">=3.8" summary = "OpenTelemetry Collector Exporters" groups = ["default"] dependencies = [ - "opentelemetry-exporter-otlp-proto-grpc==1.22.0", - "opentelemetry-exporter-otlp-proto-http==1.22.0", + "opentelemetry-exporter-otlp-proto-grpc==1.25.0", + "opentelemetry-exporter-otlp-proto-http==1.25.0", ] files = [ - {file = "opentelemetry_exporter_otlp-1.22.0-py3-none-any.whl", hash = "sha256:cb03a1cbf300e12b47690858be13dd26fe2f60b2610204959f3497cd6645e3a1"}, - {file = "opentelemetry_exporter_otlp-1.22.0.tar.gz", hash = "sha256:309a7d4dc67602801f15818e110ce452e78989886aaab5d37e7cf7f55f1d3d27"}, + {file = "opentelemetry_exporter_otlp-1.25.0-py3-none-any.whl", hash = "sha256:d67a831757014a3bc3174e4cd629ae1493b7ba8d189e8a007003cacb9f1a6b60"}, + {file = "opentelemetry_exporter_otlp-1.25.0.tar.gz", hash = "sha256:ce03199c1680a845f82e12c0a6a8f61036048c07ec7a0bd943142aca8fa6ced0"}, ] [[package]] name = "opentelemetry-exporter-otlp-proto-common" -version = "1.22.0" -requires_python = ">=3.7" +version = "1.25.0" +requires_python = ">=3.8" summary = "OpenTelemetry Protobuf encoding" groups = ["default"] dependencies = [ - "backoff<3.0.0,>=1.10.0; python_version >= \"3.7\"", - "opentelemetry-proto==1.22.0", + "opentelemetry-proto==1.25.0", ] files = [ - {file = "opentelemetry_exporter_otlp_proto_common-1.22.0-py3-none-any.whl", hash = "sha256:3f2538bec5312587f8676c332b3747f54c89fe6364803a807e217af4603201fa"}, - {file = "opentelemetry_exporter_otlp_proto_common-1.22.0.tar.gz", hash = "sha256:71ae2f81bc6d6fe408d06388826edc8933759b2ca3a97d24054507dc7cfce52d"}, + {file = "opentelemetry_exporter_otlp_proto_common-1.25.0-py3-none-any.whl", hash = "sha256:15637b7d580c2675f70246563363775b4e6de947871e01d0f4e3881d1848d693"}, + {file = "opentelemetry_exporter_otlp_proto_common-1.25.0.tar.gz", hash = "sha256:c93f4e30da4eee02bacd1e004eb82ce4da143a2f8e15b987a9f603e0a85407d3"}, ] [[package]] name = "opentelemetry-exporter-otlp-proto-grpc" -version = "1.22.0" -requires_python = ">=3.7" +version = "1.25.0" +requires_python = ">=3.8" summary = "OpenTelemetry Collector Protobuf over gRPC Exporter" groups = ["default"] dependencies = [ - "backoff<3.0.0,>=1.10.0; python_version >= \"3.7\"", "deprecated>=1.2.6", "googleapis-common-protos~=1.52", "grpcio<2.0.0,>=1.0.0", "opentelemetry-api~=1.15", - "opentelemetry-exporter-otlp-proto-common==1.22.0", - "opentelemetry-proto==1.22.0", - "opentelemetry-sdk~=1.22.0", + "opentelemetry-exporter-otlp-proto-common==1.25.0", + "opentelemetry-proto==1.25.0", + "opentelemetry-sdk~=1.25.0", ] files = [ - {file = "opentelemetry_exporter_otlp_proto_grpc-1.22.0-py3-none-any.whl", hash = "sha256:b5bcadc129272004316a455e9081216d3380c1fc2231a928ea6a70aa90e173fb"}, - {file = "opentelemetry_exporter_otlp_proto_grpc-1.22.0.tar.gz", hash = "sha256:1e0e5aa4bbabc74942f06f268deffd94851d12a8dc30b02527472ef1729fe5b1"}, + {file = "opentelemetry_exporter_otlp_proto_grpc-1.25.0-py3-none-any.whl", hash = "sha256:3131028f0c0a155a64c430ca600fd658e8e37043cb13209f0109db5c1a3e4eb4"}, + {file = "opentelemetry_exporter_otlp_proto_grpc-1.25.0.tar.gz", hash = "sha256:c0b1661415acec5af87625587efa1ccab68b873745ca0ee96b69bb1042087eac"}, ] [[package]] name = "opentelemetry-exporter-otlp-proto-http" -version = "1.22.0" -requires_python = ">=3.7" +version = "1.25.0" +requires_python = ">=3.8" summary = "OpenTelemetry Collector Protobuf over HTTP Exporter" groups = ["default"] dependencies = [ - "backoff<3.0.0,>=1.10.0; python_version >= \"3.7\"", "deprecated>=1.2.6", "googleapis-common-protos~=1.52", "opentelemetry-api~=1.15", - "opentelemetry-exporter-otlp-proto-common==1.22.0", - "opentelemetry-proto==1.22.0", - "opentelemetry-sdk~=1.22.0", + "opentelemetry-exporter-otlp-proto-common==1.25.0", + "opentelemetry-proto==1.25.0", + "opentelemetry-sdk~=1.25.0", "requests~=2.7", ] files = [ - {file = "opentelemetry_exporter_otlp_proto_http-1.22.0-py3-none-any.whl", hash = "sha256:e002e842190af45b91dc55a97789d0b98e4308c88d886b16049ee90e17a4d396"}, - {file = "opentelemetry_exporter_otlp_proto_http-1.22.0.tar.gz", hash = "sha256:79ed108981ec68d5f7985355bca32003c2f3a5be1534a96d62d5861b758a82f4"}, + {file = "opentelemetry_exporter_otlp_proto_http-1.25.0-py3-none-any.whl", hash = "sha256:2eca686ee11b27acd28198b3ea5e5863a53d1266b91cda47c839d95d5e0541a6"}, + {file = "opentelemetry_exporter_otlp_proto_http-1.25.0.tar.gz", hash = "sha256:9f8723859e37c75183ea7afa73a3542f01d0fd274a5b97487ea24cb683d7d684"}, ] [[package]] name = "opentelemetry-proto" -version = "1.22.0" -requires_python = ">=3.7" +version = "1.25.0" +requires_python = ">=3.8" summary = "OpenTelemetry Python Proto" groups = ["default"] dependencies = [ "protobuf<5.0,>=3.19", ] files = [ - {file = "opentelemetry_proto-1.22.0-py3-none-any.whl", hash = "sha256:ce7188d22c75b6d0fe53e7fb58501613d0feade5139538e79dedd9420610fa0c"}, - {file = "opentelemetry_proto-1.22.0.tar.gz", hash = "sha256:9ec29169286029f17ca34ec1f3455802ffb90131642d2f545ece9a63e8f69003"}, + {file = "opentelemetry_proto-1.25.0-py3-none-any.whl", hash = "sha256:f07e3341c78d835d9b86665903b199893befa5e98866f63d22b00d0b7ca4972f"}, + {file = "opentelemetry_proto-1.25.0.tar.gz", hash = "sha256:35b6ef9dc4a9f7853ecc5006738ad40443701e52c26099e197895cbda8b815a3"}, ] [[package]] name = "opentelemetry-sdk" -version = "1.22.0" -requires_python = ">=3.7" +version = "1.25.0" +requires_python = ">=3.8" summary = "OpenTelemetry Python SDK" groups = ["default"] dependencies = [ - "opentelemetry-api==1.22.0", - "opentelemetry-semantic-conventions==0.43b0", + "opentelemetry-api==1.25.0", + "opentelemetry-semantic-conventions==0.46b0", "typing-extensions>=3.7.4", ] files = [ - {file = "opentelemetry_sdk-1.22.0-py3-none-any.whl", hash = "sha256:a730555713d7c8931657612a88a141e3a4fe6eb5523d9e2d5a8b1e673d76efa6"}, - {file = "opentelemetry_sdk-1.22.0.tar.gz", hash = "sha256:45267ac1f38a431fc2eb5d6e0c0d83afc0b78de57ac345488aa58c28c17991d0"}, + {file = "opentelemetry_sdk-1.25.0-py3-none-any.whl", hash = "sha256:d97ff7ec4b351692e9d5a15af570c693b8715ad78b8aafbec5c7100fe966b4c9"}, + {file = "opentelemetry_sdk-1.25.0.tar.gz", hash = "sha256:ce7fc319c57707ef5bf8b74fb9f8ebdb8bfafbe11898410e0d2a761d08a98ec7"}, ] [[package]] name = "opentelemetry-semantic-conventions" -version = "0.43b0" -requires_python = ">=3.7" +version = "0.46b0" +requires_python = ">=3.8" summary = "OpenTelemetry Semantic Conventions" groups = ["default"] +dependencies = [ + "opentelemetry-api==1.25.0", +] files = [ - {file = "opentelemetry_semantic_conventions-0.43b0-py3-none-any.whl", hash = "sha256:291284d7c1bf15fdaddf309b3bd6d3b7ce12a253cec6d27144439819a15d8445"}, - {file = "opentelemetry_semantic_conventions-0.43b0.tar.gz", hash = "sha256:b9576fb890df479626fa624e88dde42d3d60b8b6c8ae1152ad157a8b97358635"}, + {file = "opentelemetry_semantic_conventions-0.46b0-py3-none-any.whl", hash = "sha256:6daef4ef9fa51d51855d9f8e0ccd3a1bd59e0e545abe99ac6203804e36ab3e07"}, + {file = "opentelemetry_semantic_conventions-0.46b0.tar.gz", hash = "sha256:fbc982ecbb6a6e90869b15c1673be90bd18c8a56ff1cffc0864e38e2edffaefa"}, ] [[package]] @@ -743,18 +742,18 @@ files = [ [[package]] name = "protobuf" -version = "4.25.2" +version = "4.25.3" requires_python = ">=3.8" summary = "" groups = ["default"] files = [ - {file = "protobuf-4.25.2-cp310-abi3-win32.whl", hash = "sha256:b50c949608682b12efb0b2717f53256f03636af5f60ac0c1d900df6213910fd6"}, - {file = "protobuf-4.25.2-cp310-abi3-win_amd64.whl", hash = "sha256:8f62574857ee1de9f770baf04dde4165e30b15ad97ba03ceac65f760ff018ac9"}, - {file = "protobuf-4.25.2-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:2db9f8fa64fbdcdc93767d3cf81e0f2aef176284071507e3ede160811502fd3d"}, - {file = "protobuf-4.25.2-cp37-abi3-manylinux2014_aarch64.whl", hash = "sha256:10894a2885b7175d3984f2be8d9850712c57d5e7587a2410720af8be56cdaf62"}, - {file = "protobuf-4.25.2-cp37-abi3-manylinux2014_x86_64.whl", hash = "sha256:fc381d1dd0516343f1440019cedf08a7405f791cd49eef4ae1ea06520bc1c020"}, - {file = "protobuf-4.25.2-py3-none-any.whl", hash = "sha256:a8b7a98d4ce823303145bf3c1a8bdb0f2f4642a414b196f04ad9853ed0c8f830"}, - {file = "protobuf-4.25.2.tar.gz", hash = "sha256:fe599e175cb347efc8ee524bcd4b902d11f7262c0e569ececcb89995c15f0a5e"}, + {file = "protobuf-4.25.3-cp310-abi3-win32.whl", hash = "sha256:d4198877797a83cbfe9bffa3803602bbe1625dc30d8a097365dbc762e5790faa"}, + {file = "protobuf-4.25.3-cp310-abi3-win_amd64.whl", hash = "sha256:209ba4cc916bab46f64e56b85b090607a676f66b473e6b762e6f1d9d591eb2e8"}, + {file = "protobuf-4.25.3-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:f1279ab38ecbfae7e456a108c5c0681e4956d5b1090027c1de0f934dfdb4b35c"}, + {file = "protobuf-4.25.3-cp37-abi3-manylinux2014_aarch64.whl", hash = "sha256:e7cb0ae90dd83727f0c0718634ed56837bfeeee29a5f82a7514c03ee1364c019"}, + {file = "protobuf-4.25.3-cp37-abi3-manylinux2014_x86_64.whl", hash = "sha256:7c8daa26095f82482307bc717364e7c13f4f1c99659be82890dcfc215194554d"}, + {file = "protobuf-4.25.3-py3-none-any.whl", hash = "sha256:f0700d54bcf45424477e46a9f0944155b46fb0639d69728739c0e47bab83f2b9"}, + {file = "protobuf-4.25.3.tar.gz", hash = "sha256:25b5d0b42fd000320bd7830b349e3b696435f3b329810427a6bcce6a5492cc5c"}, ] [[package]] @@ -848,6 +847,36 @@ files = [ {file = "pytest-8.0.0.tar.gz", hash = "sha256:249b1b0864530ba251b7438274c4d251c58d868edaaec8762893ad4a0d71c36c"}, ] +[[package]] +name = "pytest-cov" +version = "5.0.0" +requires_python = ">=3.8" +summary = "Pytest plugin for measuring coverage." +groups = ["test"] +dependencies = [ + "coverage[toml]>=5.2.1", + "pytest>=4.6", +] +files = [ + {file = "pytest-cov-5.0.0.tar.gz", hash = "sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857"}, + {file = "pytest_cov-5.0.0-py3-none-any.whl", hash = "sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652"}, +] + +[[package]] +name = "pytest-xdist" +version = "3.5.0" +requires_python = ">=3.7" +summary = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" +groups = ["test"] +dependencies = [ + "execnet>=1.1", + "pytest>=6.2.0", +] +files = [ + {file = "pytest-xdist-3.5.0.tar.gz", hash = "sha256:cbb36f3d67e0c478baa57fa4edc8843887e0f6cfc42d677530a36d7472b32d8a"}, + {file = "pytest_xdist-3.5.0-py3-none-any.whl", hash = "sha256:d075629c7e00b611df89f490a5063944bee7a4362a5ff11c7cc7824a03dfce24"}, +] + [[package]] name = "python-dateutil" version = "2.8.2" @@ -935,8 +964,8 @@ files = [ [[package]] name = "requests" -version = "2.31.0" -requires_python = ">=3.7" +version = "2.32.3" +requires_python = ">=3.8" summary = "Python HTTP for Humans." groups = ["default"] dependencies = [ @@ -946,13 +975,13 @@ dependencies = [ "urllib3<3,>=1.21.1", ] files = [ - {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, - {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, + {file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"}, + {file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"}, ] [[package]] name = "rich" -version = "13.7.0" +version = "13.7.1" requires_python = ">=3.7.0" summary = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" groups = ["default"] @@ -961,8 +990,8 @@ dependencies = [ "pygments<3.0.0,>=2.13.0", ] files = [ - {file = "rich-13.7.0-py3-none-any.whl", hash = "sha256:6da14c108c4866ee9520bbffa71f6fe3962e193b7da68720583850cd4548e235"}, - {file = "rich-13.7.0.tar.gz", hash = "sha256:5cb5123b5cf9ee70584244246816e9114227e0b98ad9176eede6ad54bf5403fa"}, + {file = "rich-13.7.1-py3-none-any.whl", hash = "sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222"}, + {file = "rich-13.7.1.tar.gz", hash = "sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432"}, ] [[package]] @@ -1035,24 +1064,24 @@ files = [ [[package]] name = "typing-extensions" -version = "4.9.0" +version = "4.12.2" requires_python = ">=3.8" summary = "Backported and Experimental Type Hints for Python 3.8+" groups = ["default"] files = [ - {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, - {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, + {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, + {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, ] [[package]] name = "urllib3" -version = "2.2.0" +version = "2.2.1" requires_python = ">=3.8" summary = "HTTP library with thread-safe connection pooling, file post, and more." groups = ["default"] files = [ - {file = "urllib3-2.2.0-py3-none-any.whl", hash = "sha256:ce3711610ddce217e6d113a2732fafad960a03fd0318c91faa79481e35c11224"}, - {file = "urllib3-2.2.0.tar.gz", hash = "sha256:051d961ad0c62a94e50ecf1af379c3aba230c66c710493493560c0c223c49f20"}, + {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"}, + {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"}, ] [[package]] @@ -1098,11 +1127,11 @@ files = [ [[package]] name = "zipp" -version = "3.17.0" +version = "3.19.2" requires_python = ">=3.8" summary = "Backport of pathlib-compatible object wrapper for zip files" groups = ["default"] files = [ - {file = "zipp-3.17.0-py3-none-any.whl", hash = "sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31"}, - {file = "zipp-3.17.0.tar.gz", hash = "sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0"}, + {file = "zipp-3.19.2-py3-none-any.whl", hash = "sha256:f091755f667055f2d02b32c53771a7a6c8b47e1fdbc4b72a8b9072b3eef8015c"}, + {file = "zipp-3.19.2.tar.gz", hash = "sha256:bf1dcf6450f873a13e952a29504887c89e6de7506209e5b1bcc3460135d4de19"}, ] diff --git a/py/pyproject.toml b/py/pyproject.toml index 68ec4bd4..0c9f83f2 100644 --- a/py/pyproject.toml +++ b/py/pyproject.toml @@ -13,7 +13,7 @@ include = ['/README.md', '/LICENSE.md', '/bitbazaar', '/tests', '/requirements.t [tool.pdm] distribution = true [tool.pdm.dev-dependencies] -test = ["pyright>=1.1.329", "pytest>=7.4.2", "coverage[toml]>=7.3.2"] +test = ["pyright>=1.1.329", "pytest>=7.4.2", "pytest-cov>=4.1.0", "pytest-xdist==3.5.0"] dev = ["ipykernel>=6.25.2"] [project] @@ -68,3 +68,6 @@ source = ["bitbazaar"] [tool.coverage.report] show_missing = true fail_under = 100 +# Cli entrypoint if being used: +[project.scripts] +bitbazaar = 'bitbazaar.cli:cli' diff --git a/py/tests/test_version.py b/py/tests/test_version.py new file mode 100644 index 00000000..06bb2268 --- /dev/null +++ b/py/tests/test_version.py @@ -0,0 +1,8 @@ +import bitbazaar + + +def test_version(): + """Just a default example version test.""" + from importlib.metadata import version + + assert bitbazaar.__version__ == version("bitbazaar") diff --git a/py_rust/.config/nextest.toml b/py_rust/.config/nextest.toml new file mode 100644 index 00000000..57d48425 --- /dev/null +++ b/py_rust/.config/nextest.toml @@ -0,0 +1,112 @@ +# <--- DEFAULTS BELOW FROM https://nexte.st/book/configuration.html ---> + +[store] +# The directory under the workspace root at which nextest-related files are +# written. Profile-specific storage is currently written to dir/