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/. +dir = "target/nextest" + +# This section defines the default nextest profile. Custom profiles are layered +# on top of the default profile. +[profile.default] +# "retries" defines the number of times a test should be retried. If set to a +# non-zero value, tests that succeed on a subsequent attempt will be marked as +# flaky. Can be overridden through the `--retries` option. +# Examples +# * retries = 3 +# * retries = { backoff = "fixed", count = 2, delay = "1s" } +# * retries = { backoff = "exponential", count = 10, delay = "1s", jitter = true, max-delay = "10s" } +retries = 0 + +# The number of threads to run tests with. Supported values are either an integer or +# the string "num-cpus". Can be overridden through the `--test-threads` option. +test-threads = "num-cpus" + +# The number of threads required for each test. This is generally used in overrides to +# mark certain tests as heavier than others. However, it can also be set as a global parameter. +threads-required = 1 + +# Show these test statuses in the output. +# +# The possible values this can take are: +# * none: no output +# * fail: show failed (including exec-failed) tests +# * retry: show flaky and retried tests +# * slow: show slow tests +# * pass: show passed tests +# * skip: show skipped tests (most useful for CI) +# * all: all of the above +# +# Each value includes all the values above it; for example, "slow" includes +# failed and retried tests. +# +# Can be overridden through the `--status-level` flag. +status-level = "pass" + +# Similar to status-level, show these test statuses at the end of the run. +final-status-level = "flaky" + +# "failure-output" defines when standard output and standard error for failing tests are produced. +# Accepted values are +# * "immediate": output failures as soon as they happen +# * "final": output failures at the end of the test run +# * "immediate-final": output failures as soon as they happen and at the end of +# the test run; combination of "immediate" and "final" +# * "never": don't output failures at all +# +# For large test suites and CI it is generally useful to use "immediate-final". +# +# Can be overridden through the `--failure-output` option. +failure-output = "immediate" + +# "success-output" controls production of standard output and standard error on success. This should +# generally be set to "never". +success-output = "never" + +# Cancel the test run on the first failure. For CI runs, consider setting this +# to false. +fail-fast = true + +# Treat a test that takes longer than the configured 'period' as slow, and print a message. +# See for more information. +# +# Optional: specify the parameter 'terminate-after' with a non-zero integer, +# which will cause slow tests to be terminated after the specified number of +# periods have passed. +# Example: slow-timeout = { period = "60s", terminate-after = 2 } +slow-timeout = { period = "60s" } + +# Treat a test as leaky if after the process is shut down, standard output and standard error +# aren't closed within this duration. +# +# This usually happens in case of a test that creates a child process and lets it inherit those +# handles, but doesn't clean the child process up (especially when it fails). +# +# See for more information. +leak-timeout = "100ms" + +[profile.default.junit] +# Output a JUnit report into the given file inside 'store.dir/'. +# If unspecified, JUnit is not written out. + +# path = "junit.xml" + +# The name of the top-level "report" element in JUnit report. If aggregating +# reports across different test runs, it may be useful to provide separate names +# for each report. +report-name = "nextest-run" + +# Whether standard output and standard error for passing tests should be stored in the JUnit report. +# Output is stored in the and elements of the element. +store-success-output = false + +# Whether standard output and standard error for failing tests should be stored in the JUnit report. +# Output is stored in the and elements of the element. +# +# Note that if a description can be extracted from the output, it is always stored in the +# element. +store-failure-output = true + +# This profile is activated if MIRI_SYSROOT is set. +[profile.default-miri] +# Miri tests take up a lot of memory, so only run 1 test at a time by default. +test-threads = 1 diff --git a/py_rust/Cargo.lock b/py_rust/Cargo.lock index b4dde1a4..968f9f64 100644 --- a/py_rust/Cargo.lock +++ b/py_rust/Cargo.lock @@ -17,15 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -41,60 +32,18 @@ dependencies = [ "libc", ] -[[package]] -name = "anstream" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" - -[[package]] -name = "anstyle-parse" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - [[package]] name = "anyhow" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + [[package]] name = "async-trait" version = "0.1.77" @@ -178,14 +127,23 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitbazaar" -version = "0.0.31" +version = "0.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caa2497814b06c0b3550f63d9e65c914ebf355725473ae873dcc5ac5ba886db9" +checksum = "ddffcb103ced7be1e95fc199e955ffb9ed752c997de2d51c27bea5fbd1a79328" dependencies = [ "chrono", - "clap", + "chrono-humanize", "colored", "comfy-table", "error-stack", @@ -198,11 +156,8 @@ dependencies = [ "opentelemetry-semantic-conventions", "opentelemetry_sdk", "parking_lot", - "regex", "rustc_version", "serde", - "serde_json", - "strum", "time", "tracing", "tracing-appender", @@ -210,6 +165,7 @@ dependencies = [ "tracing-log", "tracing-opentelemetry", "tracing-subscriber", + "tracing-subscriber-wasm", ] [[package]] @@ -217,6 +173,7 @@ name = "bitbazaar_rs" version = "0.0.3" dependencies = [ "bitbazaar", + "colored", "error-stack", "parking_lot", "pyo3", @@ -278,51 +235,14 @@ dependencies = [ ] [[package]] -name = "clap" -version = "4.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.0" +name = "chrono-humanize" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" +checksum = "799627e6b4d27827a814e837b9d8a504832086081806d45b1afa34dc982b023b" dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.49", + "chrono", ] -[[package]] -name = "clap_lex" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - [[package]] name = "colored" version = "2.1.0" @@ -330,7 +250,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ "lazy_static", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -431,6 +351,15 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + [[package]] name = "futures-channel" version = "0.3.30" @@ -518,6 +447,172 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gloo" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d" +dependencies = [ + "gloo-console", + "gloo-dialogs", + "gloo-events", + "gloo-file", + "gloo-history", + "gloo-net", + "gloo-render", + "gloo-storage", + "gloo-timers", + "gloo-utils", + "gloo-worker", +] + +[[package]] +name = "gloo-console" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-dialogs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-events" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-file" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7" +dependencies = [ + "gloo-events", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-history" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85725d90bf0ed47063b3930ef28e863658a7905989e9929a8708aab74a1d5e7f" +dependencies = [ + "gloo-events", + "gloo-utils", + "serde", + "serde-wasm-bindgen", + "serde_urlencoded", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-net" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66b4e3c7d9ed8d315fd6b97c8b1f74a7c6ecbbc2320e65ae7ed38b7068cc620" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils", + "http 0.2.11", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-render" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-storage" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "gloo-utils" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-worker" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a" +dependencies = [ + "anymap2", + "bincode", + "gloo-console", + "gloo-utils", + "js-sys", + "serde", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "h2" version = "0.3.24" @@ -799,7 +894,7 @@ checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1197,35 +1292,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "regex" -version = "1.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - [[package]] name = "rustc-demangle" version = "0.1.23" @@ -1274,6 +1340,17 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-wasm-bindgen" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "serde_derive" version = "1.0.196" @@ -1296,6 +1373,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -1327,15 +1416,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys", ] -[[package]] -name = "strsim" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" - [[package]] name = "strum" version = "0.25.0" @@ -1478,7 +1561,7 @@ dependencies = [ "pin-project-lite", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1675,6 +1758,17 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "tracing-subscriber-wasm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79804e80980173c6c8e53d98508eb24a2dbc4ee17a3e8d2ca8e5bad6bf13a898" +dependencies = [ + "gloo", + "tracing", + "tracing-subscriber", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -1705,12 +1799,6 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - [[package]] name = "valuable" version = "0.1.0" @@ -1757,6 +1845,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.91" @@ -1786,6 +1886,16 @@ version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +[[package]] +name = "web-sys" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "web-time" version = "0.2.4" @@ -1836,15 +1946,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] - [[package]] name = "windows-targets" version = "0.48.5" diff --git a/py_rust/Cargo.toml b/py_rust/Cargo.toml index 36d2e9a4..705fc380 100644 --- a/py_rust/Cargo.toml +++ b/py_rust/Cargo.toml @@ -14,19 +14,19 @@ path = "src/lib.rs" # Add your dependencies here [dependencies] +colored = '2' tracing = "0.1" error-stack = "0.4" -bitbazaar = { version = '0.0.31', features = ["opentelemetry"] } +bitbazaar = { version = '0.0.52', features = ["timing", "opentelemetry-grpc"] } pyo3 = { version = '0.20.0', features = ['extension-module', 'chrono', 'generate-import-lib'] } parking_lot = { version = "0.12", features = ['deadlock_detection', 'serde'] } strum = { version = '0.25', features = ['derive'] } +[profile.release] +strip = "debuginfo" # Note: true or "symbols" seems to break static c linking e.g. with ffmpeg. + [profile.profiler] inherits = "release" # Adds on top of the default release profile incremental = true debug = true strip = false - -# Modifying the test runtime (from release is just so much faster) -[profile.test] -inherits = "release" # Adds on top of the default release profile diff --git a/py_rust/dev_requirements.txt b/py_rust/dev_requirements.txt new file mode 100644 index 00000000..065f5078 --- /dev/null +++ b/py_rust/dev_requirements.txt @@ -0,0 +1,6 @@ +maturin==1.4.0 +typing-extensions==4.9.0 +pyright==1.1.351 +pytest==8.0.1 +pytest-xdist==3.5.0 +pytest-profiling==1.7.0 \ No newline at end of file diff --git a/py_rust/rustfmt.toml b/py_rust/rustfmt.toml index 8b137891..3a26366d 100644 --- a/py_rust/rustfmt.toml +++ b/py_rust/rustfmt.toml @@ -1 +1 @@ - +edition = "2021" diff --git a/py_rust/src/lib.rs b/py_rust/src/lib.rs index f69d209d..f38d6d74 100644 --- a/py_rust/src/lib.rs +++ b/py_rust/src/lib.rs @@ -1,12 +1,15 @@ +#![allow(clippy::module_inception)] +#![allow(clippy::type_complexity)] #![warn(clippy::disallowed_types)] +use colored::Colorize; use pyo3::prelude::*; mod utils; #[pyfunction] pub fn hello() -> String { - "Hello, World!".to_string() + "Hello, World!".cyan().to_string() } /// A Python module implemented in Rust. The name of this function must match diff --git a/py_rust/src/prelude.rs b/py_rust/src/prelude.rs index c668559e..458648f0 100644 --- a/py_rust/src/prelude.rs +++ b/py_rust/src/prelude.rs @@ -1,6 +1,10 @@ #[allow(unused_imports)] -pub use bitbazaar::{anyerr, errors::AnyErr, panic_on_err}; +pub use bitbazaar::{anyerr, err, errors::AnyErr, panic_on_err, panic_on_err_async}; #[allow(unused_imports)] -pub use error_stack::{Result, ResultExt}; +pub use error_stack::{Report, Result, ResultExt}; #[allow(unused_imports)] pub use tracing::{debug, error, info, warn}; + +/// Shorthand for a [`Result`] with a [`Report`] as the error variant +#[allow(dead_code)] +pub type RResult = Result>; diff --git a/py_rust/tests/test_basic.py b/py_rust/tests/test_basic.py deleted file mode 100644 index 876cf347..00000000 --- a/py_rust/tests/test_basic.py +++ /dev/null @@ -1,9 +0,0 @@ -import bitbazaar_rs - - -def test_hello(): - assert bitbazaar_rs.hello() == "Hello, World!" - - -def test_add(): - assert bitbazaar_rs.utils.add(1, 2) == 3 diff --git a/py_rust/tests/test_version.py b/py_rust/tests/test_version.py new file mode 100644 index 00000000..951bff27 --- /dev/null +++ b/py_rust/tests/test_version.py @@ -0,0 +1,8 @@ +import bitbazaar_rs + + +def test_version(): + """Just a default example version test.""" + from importlib.metadata import version + + assert bitbazaar_rs.__version__ == version("bitbazaar_rs") diff --git a/rust/.config/nextest.toml b/rust/.config/nextest.toml index a236338b..57d48425 100644 --- a/rust/.config/nextest.toml +++ b/rust/.config/nextest.toml @@ -1,12 +1,4 @@ -[test-groups] -serial = { max-threads = 1 } - -# A lot of the log tests use static variables or read from files for tests, causing conflicts if run in parallel: -[[profile.default.overrides]] -filter = 'test(log::)' -test-group = 'serial' - -# <--- DEFAULTS ---> +# <--- DEFAULTS BELOW FROM https://nexte.st/book/configuration.html ---> [store] # The directory under the workspace root at which nextest-related files are diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 511922bd..959debab 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -64,6 +64,17 @@ dependencies = [ "syn 2.0.49", ] +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -154,6 +165,7 @@ dependencies = [ "colored", "comfy-table", "conch-parser", + "criterion", "deadpool-redis", "error-stack", "futures", @@ -178,7 +190,7 @@ dependencies = [ "serde", "serde_json", "sha1_smol", - "strum", + "strum 0.25.0", "sysinfo", "tempfile", "time", @@ -201,9 +213,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bumpalo" @@ -217,6 +229,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + [[package]] name = "cc" version = "1.0.83" @@ -234,9 +252,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -256,6 +274,17 @@ dependencies = [ "chrono", ] +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "bitflags 1.3.2", + "textwrap", + "unicode-width", +] + [[package]] name = "colored" version = "2.1.0" @@ -268,9 +297,9 @@ dependencies = [ [[package]] name = "combine" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ "bytes", "futures-core", @@ -282,13 +311,13 @@ dependencies = [ [[package]] name = "comfy-table" -version = "7.1.0" +version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c64043d6c7b7a4c58e39e7efccfdea7b93d885a795d0c054a69dbbf4dd52686" +checksum = "b34115915337defe99b2aff5c2ce6771e5fbc4079f4b506301f5cf394c8452f7" dependencies = [ "crossterm", - "strum", - "strum_macros", + "strum 0.26.2", + "strum_macros 0.26.4", "unicode-width", ] @@ -317,6 +346,43 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "criterion" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" +dependencies = [ + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "futures", + "itertools", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" +dependencies = [ + "cast", + "itertools", +] + [[package]] name = "crossbeam-channel" version = "0.5.11" @@ -357,7 +423,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "crossterm_winapi", "libc", "parking_lot", @@ -373,11 +439,32 @@ dependencies = [ "winapi", ] +[[package]] +name = "csv" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" +dependencies = [ + "memchr", +] + [[package]] name = "deadpool" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "144f5e4b9ce67c972acc225e71aefe6b21241276f94005024562874611064d30" +checksum = "6541a3916932fe57768d4be0b1ffb5ec7cbf74ca8c903fdfd5c0fe8aa958f0ed" dependencies = [ "deadpool-runtime", "num_cpus", @@ -386,9 +473,9 @@ dependencies = [ [[package]] name = "deadpool-redis" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2244d421c9514eab2e1ce1aa1e3c9d5c7cbb9cf3d9bbcac21a6b27e6a868d84" +checksum = "7ff315fab2a7a42132352909afc81140d06b8bbfd1414b098ce278e3f95dd1b9" dependencies = [ "deadpool", "redis", @@ -396,9 +483,9 @@ dependencies = [ [[package]] name = "deadpool-runtime" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63dfa964fe2a66f3fde91fc70b267fe193d822c7e603e2a675a49a7f46ad3f49" +checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" dependencies = [ "tokio", ] @@ -412,6 +499,17 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", +] + [[package]] name = "either" version = "1.10.0" @@ -420,9 +518,9 @@ checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] @@ -766,9 +864,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", @@ -783,6 +881,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" + [[package]] name = "hashbrown" version = "0.12.3" @@ -801,11 +905,26 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" -version = "0.3.6" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "homedir" @@ -867,9 +986,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "d0e7a4dd27b9476dc40cb050d3632d3bba3a70ddbff012285f7f8559a1e7e545" [[package]] name = "httpdate" @@ -879,9 +998,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" dependencies = [ "bytes", "futures-channel", @@ -936,14 +1055,134 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f8ac670d7422d7f76b32e17a5db556510825b29ec9154f235977c9caba61036" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", +] + [[package]] name = "idna" -version = "0.5.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", + "smallvec", + "utf8_iter", ] [[package]] @@ -1014,6 +1253,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "lock_api" version = "0.4.11" @@ -1099,11 +1344,11 @@ dependencies = [ [[package]] name = "normpath" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5" +checksum = "5831952a9476f2fed74b77d74182fa5ddc4d21c72ec45a333b250e3ed0272804" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1146,7 +1391,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] @@ -1174,6 +1419,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + [[package]] name = "opentelemetry" version = "0.21.0" @@ -1371,6 +1622,34 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "plotters" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" + +[[package]] +name = "plotters-svg" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" +dependencies = [ + "plotters-backend", +] + [[package]] name = "portpicker" version = "0.1.1" @@ -1485,9 +1764,9 @@ dependencies = [ [[package]] name = "redis" -version = "0.25.3" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6472825949c09872e8f2c50bde59fcefc17748b6be5c90fd67cd8b4daca73bfd" +checksum = "e0d7a6955c7511f60f3ba9e86c6d02b3c3f144f8c24b288d1f4e18074ab8bbec" dependencies = [ "async-trait", "bytes", @@ -1575,9 +1854,9 @@ checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" [[package]] name = "reqwest" -version = "0.11.24" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64", "bytes", @@ -1659,7 +1938,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -1678,6 +1957,15 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -1710,6 +1998,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.196" @@ -1784,22 +2082,47 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "strum" version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ - "strum_macros", + "strum_macros 0.25.3", ] +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" + [[package]] name = "strum_macros" version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "heck", + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.49", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", "proc-macro2", "quote", "rustversion", @@ -1834,6 +2157,17 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", +] + [[package]] name = "sysinfo" version = "0.30.12" @@ -1882,6 +2216,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.57" @@ -1956,19 +2299,24 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.6.0" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "tinyvec_macros", + "displaydoc", + "zerovec", ] [[package]] -name = "tinyvec_macros" -version = "0.1.1" +name = "tinytemplate" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] [[package]] name = "tokio" @@ -2198,27 +2546,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-width" version = "0.1.11" @@ -2227,9 +2560,9 @@ checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "url" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" dependencies = [ "form_urlencoded", "idna", @@ -2242,11 +2575,23 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", ] @@ -2263,6 +2608,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -2366,9 +2721,9 @@ dependencies = [ [[package]] name = "widestring" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" [[package]] name = "winapi" @@ -2386,6 +2741,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2579,9 +2943,9 @@ dependencies = [ [[package]] name = "wmi" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff298e96fd8ef6bb55dcb2a7fd2f26969f962bf428ffa6b267457dd804d64d8" +checksum = "fc2f0a4062ca522aad4705a2948fd4061b3857537990202a8ddd5af21607f79a" dependencies = [ "chrono", "futures", @@ -2590,3 +2954,82 @@ dependencies = [ "thiserror", "windows", ] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.49", +] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 20b204d7..900a777c 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -11,6 +11,7 @@ name = "bitbazaar" crate-type = ["lib", "cdylib"] # cdylib allows things like wasm to compile path = "bitbazaar/lib.rs" + [build-dependencies] rustc_version = "0.4.0" @@ -18,49 +19,6 @@ rustc_version = "0.4.0" # For the features to show in docs.rs, need to tell it to include them: all-features = true -[features] -log-filter = ["dep:regex"] -chrono = ['dep:chrono', 'dep:chrono-humanize'] -timing = ['dep:comfy-table', 'chrono'] -cli = ['dep:normpath', 'dep:conch-parser', 'dep:homedir', 'chrono', 'dep:strum'] -system = ['dep:sysinfo'] -redis = [ - 'dep:tokio', - 'dep:deadpool-redis', - 'dep:redis', - "dep:redis-macros", - 'dep:sha1_smol', - 'dep:serde_json', - 'dep:rand', - 'dep:futures', - 'chrono', - 'dep:uuid', -] -opentelemetry-grpc = [ - 'dep:tracing-log', - 'dep:opentelemetry-appender-tracing', - 'dep:opentelemetry_sdk', - 'dep:tracing-opentelemetry', - 'dep:opentelemetry', - 'dep:opentelemetry-otlp', - 'dep:opentelemetry-semantic-conventions', - 'dep:http', - 'opentelemetry-otlp/grpc-tonic', -] -opentelemetry-http = [ # In general there's no point with this currently, made for wasm but otlp can't be used on wasm yet (tonic) - 'dep:tracing-log', - 'dep:opentelemetry-appender-tracing', - 'dep:opentelemetry_sdk', - 'dep:tracing-opentelemetry', - 'dep:opentelemetry', - 'dep:opentelemetry-otlp', - 'dep:opentelemetry-semantic-conventions', - 'dep:http', - 'opentelemetry-otlp/grpc-tonic', # Stupid needed but it currently is due to otlp internals - 'opentelemetry-otlp/http-proto', - 'opentelemetry-otlp/reqwest-client', -] - # Add your dependencies here [dependencies] tracing = "0.1" @@ -130,6 +88,7 @@ hostname = "0.3.1" [dev-dependencies] rstest = "0.18" +criterion = { version = "0.3", features = ["html_reports", "async_futures"] } portpicker = '0.1.1' tempfile = '3.8' tokio = { version = '1', features = ["rt-multi-thread", "macros"] } @@ -138,12 +97,60 @@ regex = "1" serde_json = "1" futures = "0.3" +# When adding new benches, they should be added like this with the name of the file in benches/: (obviously uncommented) +# [[bench]] +# name = "bench_tester" +# harness = false + +[features] +log-filter = ["dep:regex"] +chrono = ['dep:chrono', 'dep:chrono-humanize'] +timing = ['dep:comfy-table', 'chrono'] +cli = ['dep:normpath', 'dep:conch-parser', 'dep:homedir', 'chrono', 'dep:strum'] +system = ['dep:sysinfo'] +redis = [ + 'dep:tokio', + 'dep:deadpool-redis', + 'dep:redis', + "dep:redis-macros", + 'dep:sha1_smol', + 'dep:serde_json', + 'dep:rand', + 'dep:futures', + 'chrono', + 'dep:uuid', +] +opentelemetry-grpc = [ + 'dep:tracing-log', + 'dep:opentelemetry-appender-tracing', + 'dep:opentelemetry_sdk', + 'dep:tracing-opentelemetry', + 'dep:opentelemetry', + 'dep:opentelemetry-otlp', + 'dep:opentelemetry-semantic-conventions', + 'dep:http', + 'opentelemetry-otlp/grpc-tonic', +] +opentelemetry-http = [ # In general there's no point with this currently, made for wasm but otlp can't be used on wasm yet (tonic) + 'dep:tracing-log', + 'dep:opentelemetry-appender-tracing', + 'dep:opentelemetry_sdk', + 'dep:tracing-opentelemetry', + 'dep:opentelemetry', + 'dep:opentelemetry-otlp', + 'dep:opentelemetry-semantic-conventions', + 'dep:http', + 'opentelemetry-otlp/grpc-tonic', # Stupid needed but it currently is due to otlp internals + 'opentelemetry-otlp/http-proto', + 'opentelemetry-otlp/reqwest-client', +] + +[profile.release] +strip = "debuginfo" # Note: true or "symbols" seems to break static c linking e.g. with ffmpeg. + [profile.profiler] + inherits = "release" # Adds on top of the default release profile incremental = true debug = true strip = false - -# Modifying the test runtime (from release is just so much faster) -[profile.test] -inherits = "release" # Adds on top of the default release profile diff --git a/rust/benches/bench_setup_test.rs b/rust/benches/bench_setup_test.rs new file mode 100644 index 00000000..44289562 --- /dev/null +++ b/rust/benches/bench_setup_test.rs @@ -0,0 +1,25 @@ +use criterion::{black_box, criterion_group, criterion_main, Criterion}; + +fn fibonacci(n: u64) -> u64 { + let mut a = 0; + let mut b = 1; + + match n { + 0 => b, + _ => { + for _ in 0..n { + let c = a + b; + a = b; + b = c; + } + b + } + } +} + +pub fn criterion_benchmark(c: &mut Criterion) { + c.bench_function("fib 20", |b| b.iter(|| fibonacci(black_box(20)))); +} + +criterion_group!(benches, criterion_benchmark); +criterion_main!(benches); diff --git a/rust/bitbazaar/lib.rs b/rust/bitbazaar/lib.rs index f47fc3b4..9059bead 100644 --- a/rust/bitbazaar/lib.rs +++ b/rust/bitbazaar/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::module_inception)] +#![allow(clippy::type_complexity)] #![warn(clippy::disallowed_types)] #![warn(missing_docs)] diff --git a/rust/bitbazaar/prelude.rs b/rust/bitbazaar/prelude.rs index cdd9d362..621e16f7 100644 --- a/rust/bitbazaar/prelude.rs +++ b/rust/bitbazaar/prelude.rs @@ -1,7 +1,12 @@ #[allow(unused_imports)] -pub use error_stack::{Result, ResultExt}; +pub use error_stack::{Report, Result, ResultExt}; #[allow(unused_imports)] pub use tracing::{debug, error, info, warn}; #[allow(unused_imports)] pub use crate::{anyerr, err, errors::prelude::*, panic_on_err, panic_on_err_async}; + +// TODO maybe upstream in bb +/// Shorthand for a [`Result`] with a [`Report`] as the error variant +#[allow(dead_code)] +pub type RResult = Result>; diff --git a/rust/rustfmt.toml b/rust/rustfmt.toml index 455c8209..3a26366d 100644 --- a/rust/rustfmt.toml +++ b/rust/rustfmt.toml @@ -1,2 +1 @@ -imports_granularity = "Crate" -group_imports = "StdExternalCrate" +edition = "2021" diff --git a/zetch.config.toml b/zetch.config.toml index 2cb379c3..7c913355 100644 --- a/zetch.config.toml +++ b/zetch.config.toml @@ -1,4 +1,4 @@ -#:schema https://raw.githubusercontent.com/zakstucke/zetch/v0.0.10/py_rust/src/config/schema.json +#:schema https://raw.githubusercontent.com/zakstucke/zetch/v0.0.16/py_rust/src/config/schema.json ignore_files = [".gitignore"] @@ -12,14 +12,17 @@ custom_extensions = [] commands = ["./dev_scripts/pkg.sh update_versions"] [context.static] -PY_VERSION = { value = "0.0.7" } -JS_VERSION = { value = "0.0.29" } -RUST_VERSION = { value = "0.0.52" } -PY_RUST_VERSION = { value = "0.0.3" } +PY_VERSION = "0.0.7" +JS_VERSION = "0.0.29" +RUST_VERSION = "0.0.52" +PY_RUST_VERSION = "0.0.3" JS_ALIASES = { value = '{ "@root": "./bitbazaar", "@scripts": "./scripts" }', coerce = "json" } +# This will be updated manually in locations that need it: (using ./dev_scripts/utils.sh rand_id) +BUILD_UNIQUE_ID = "foobar" [context.env] DEBUG = { default = true, coerce = "bool" } +IN_DOCKER = { default = false, coerce = "bool" } OTLP_OO_ENDPOINT = { default = "http://localhost:5080/api/default/" } OTLP_OO_AUTH = { default = "Basic ZGV2QGRldi5jb206cGFzcw==" } # Not security issue! This is just base64('dev@dev.com:pass')