diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ddeac84..5a4502b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,52 +42,41 @@ jobs: os: windows-2019 runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - target: ${{ matrix.target }} - - - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - - name: Setup - run: make setup + - uses: actions/checkout@v3 - name: Publish to pypi + uses: messense/maturin-action@main env: MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - run: make publish TARGET="${{ matrix.target }}" EXTRA_ARGS="--no-sdist" + with: + target: ${{ matrix.target }} + command: publish + args: -m python/Cargo.toml --no-sdist release-pypi-manylinux: needs: validate-git-tag name: PyPI release manylinux - runs-on: ubuntu-20.04 - container: quay.io/pypa/manylinux2010_x86_64:2020-12-31-4928808 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - - name: Install Rust - run: | - curl https://sh.rustup.rs -sSf | sh -s -- -y - $HOME/.cargo/bin/rustup default stable - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - - - name: Enable manylinux Python targets - run: echo "/opt/python/cp37-cp37m/bin" >> $GITHUB_PATH - - - name: Setup - run: make setup - - - name: Publish manylinux to pypi (without sdist) + - name: Publish manylinux to pypi x86_64 + uses: messense/maturin-action@main env: MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - run: make publish TARGET="x86_64-unknown-linux-gnu" EXTRA_ARGS="" + with: + target: x86_64-unknown-linux-gnu + command: publish + args: -m python/Cargo.toml + - name: Publish manylinux to pypi aarch64 (without sdist) + uses: messense/maturin-action@main + env: + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + with: + target: aarch64-unknown-linux-gnu + command: publish + args: -m python/Cargo.toml --no-sdist release-documentation: needs: [ validate-git-tag, release-pypi-manylinux, release-pypi-mac-windows ] @@ -97,22 +86,22 @@ jobs: contents: write steps: - uses: actions/checkout@v1 - + - name: Install Rust run: | curl https://sh.rustup.rs -sSf | sh -s -- -y $HOME/.cargo/bin/rustup default stable echo "$HOME/.cargo/bin" >> $GITHUB_PATH - + - name: Enable manylinux Python targets run: echo "/opt/python/cp37-cp37m/bin" >> $GITHUB_PATH - + - name: Setup run: make setup - + - name: Install metadataguardian run: make install MATURIN_EXTRA_ARGS="--manylinux off" - + - name: Build and Publish Sphinx documentation run: | echo "Generate the new documentation" @@ -123,7 +112,7 @@ jobs: git config --global user.name 'Github Action' git config --global user.email 'fvaleye@users.noreply.github.com' git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY - + echo "Commit the new changes in the gh-pages" git reset --hard HEAD git clean -d -fx . diff --git a/Cargo.lock b/Cargo.lock index 7041cdc..8190864 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,9 +63,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "camino" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3132262930b0522068049f5870a856ab8affc80c70d08b6ecb785771a6fc23" +checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412" dependencies = [ "serde", ] @@ -81,9 +81,9 @@ dependencies = [ [[package]] name = "cargo-tarpaulin" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c79bbc9627c93dbf832906dfa93bf1389ee31364cfb749c0146455e8868ae70" +checksum = "97a95760820263cf52259deac9fe4405a2d3528daf5b63f6af674a5b7ee4a965" dependencies = [ "cargo_metadata", "cfg-if", @@ -268,9 +268,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.54+curl-7.83.0" +version = "0.4.55+curl-7.83.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25debbc3365c3e7ee79e30918df5759e84dbd4485807a18829188abf1786ec4e" +checksum = "23734ec77368ec583c2e61dd3f0b0e5c98b93abe6d2a004ca06b91dd7e3e2762" dependencies = [ "cc", "libc", @@ -325,13 +325,11 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "flate2" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ - "cfg-if", "crc32fast", - "libc", "miniz_oxide", ] @@ -358,9 +356,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e77a14ffc6ba4ad5188d6cf428894c4fcfda725326b37558f35bb677e712cec" +checksum = "d0155506aab710a86160ddb504a480d2964d7ab5b9e62419be69e0032bc5931c" dependencies = [ "bitflags", "libc", @@ -430,9 +428,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" +checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" dependencies = [ "autocfg", "hashbrown", @@ -441,18 +439,15 @@ dependencies = [ [[package]] name = "indoc" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7906a9fababaeacb774f72410e497a1d18de916322e33797bb2cd29baa23c9e" -dependencies = [ - "unindent", -] +checksum = "05a0bd019339e5d968b37855180087b7b9d512c5046fbd244cf8c95687927d6e" [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "jobserver" @@ -471,15 +466,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.125" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" [[package]] name = "libgit2-sys" -version = "0.13.3+1.4.2" +version = "0.13.4+1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c24d36c3ac9b9996a2418d6bf428cc0bc5d1a814a84303fc60986088c5ed60de" +checksum = "d0fa6563431ede25f5cc7f6d803c6afbc1c5d3ad3d4925d12c882bf2b526f5d1" dependencies = [ "cc", "libc", @@ -505,9 +500,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.6" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e7e15d7610cce1d9752e137625f14e61a28cd45929b6e12e47b50fe154ee2e" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" dependencies = [ "cc", "libc", @@ -601,7 +596,7 @@ dependencies = [ [[package]] name = "metadata_guardian-python" -version = "0.2.4" +version = "0.2.5" dependencies = [ "env_logger", "metadata_guardian", @@ -610,24 +605,22 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ "adler", ] [[package]] name = "nix" -version = "0.23.1" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" +checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" dependencies = [ "bitflags", - "cc", "cfg-if", "libc", - "memoffset", ] [[package]] @@ -661,9 +654,9 @@ dependencies = [ [[package]] name = "object" -version = "0.28.3" +version = "0.28.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40bec70ba014595f99f7aa110b84331ffe1ee9aece7fe6f387cc7e3ecda4d456" +checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" dependencies = [ "flate2", "memchr", @@ -671,9 +664,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" [[package]] name = "openssl-probe" @@ -705,9 +698,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", "parking_lot_core", @@ -758,11 +751,11 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.37" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" +checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] @@ -782,9 +775,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.16.4" +version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd86513975ed69bf3fb5d4a286cdcda66dbc56f84bdf4832b6c82b459f4417b2" +checksum = "1e6302e85060011447471887705bb7838f14aba43fcb06957d823739a496b3dc" dependencies = [ "cfg-if", "indoc", @@ -798,9 +791,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.16.4" +version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "450e2e56cbfa67bbe224cef93312b7a76d81c471d4e0c459d24d4bfaf3d75b53" +checksum = "b5b65b546c35d8a3b1b2f0ddbac7c6a569d759f357f2b9df884f5d6b719152c8" dependencies = [ "once_cell", "target-lexicon", @@ -808,9 +801,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.16.4" +version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36e653782972eba2fe86e8319ade54b97822c65fb1ccc1e116368372faa6ebc9" +checksum = "c275a07127c1aca33031a563e384ffdd485aee34ef131116fcd58e3430d1742b" dependencies = [ "libc", "pyo3-build-config", @@ -818,9 +811,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.16.4" +version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317ce641f29f4e10e75765630bf4d28b2008612226fcc80b27f334fee8184d0f" +checksum = "284fc4485bfbcc9850a6d661d627783f18d19c2ab55880b021671c4ba83e90f7" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -830,9 +823,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.16.4" +version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59342fce58a05983688e8d81209d06f67f0fcb1597253ef63b390b2da2417522" +checksum = "53bda0f58f73f5c5429693c96ed57f7abdb38fdfc28ae06da4101a257adb7faf" dependencies = [ "proc-macro2", "quote", @@ -859,9 +852,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ "autocfg", "crossbeam-deque", @@ -871,9 +864,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f51245e1e62e1f1629cbfec37b5793bbabcaeb90f30e94d2ba03564687353e4" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -892,9 +885,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.5" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" dependencies = [ "aho-corasick", "memchr", @@ -912,9 +905,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" [[package]] name = "rustc-demangle" @@ -933,9 +926,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "same-file" @@ -948,12 +941,12 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "winapi", + "windows-sys", ] [[package]] @@ -1053,20 +1046,20 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.92" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52" +checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] name = "target-lexicon" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7fa7e55043acb85fca6b3c01485a2eeb6b69c5d21002e273c79e465f43b7ac1" +checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" [[package]] name = "termcolor" @@ -1207,6 +1200,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +[[package]] +name = "unicode-ident" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" + [[package]] name = "unicode-normalization" version = "0.1.19" @@ -1222,17 +1221,11 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" -[[package]] -name = "unicode-xid" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" - [[package]] name = "unindent" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514672a55d7380da379785a4d70ca8386c8883ff7eaae877be4d2081cebe73d8" +checksum = "52fee519a3e570f7df377a06a1a7775cdbfb7aa460be7e08de2b1f0e69973a44" [[package]] name = "url" diff --git a/python/Cargo.toml b/python/Cargo.toml index 4be299c..cde4701 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "metadata_guardian-python" -version = "0.2.4" +version = "0.2.6" authors = ["Florian Valeye "] homepage = "https://fvaleye.github.io/metadata-guardian/python" license = "Apache-2.0" @@ -16,7 +16,7 @@ crate-type = ["cdylib"] env_logger = "0" [dependencies.pyo3] -version = "0.16.4" +version = "0.16.5" features = ["extension-module", "abi3", "abi3-py37"] [dependencies.metadata_guardian] diff --git a/python/metadata_guardian/data_rules.py b/python/metadata_guardian/data_rules.py index e05fb6b..54f63a9 100644 --- a/python/metadata_guardian/data_rules.py +++ b/python/metadata_guardian/data_rules.py @@ -1,6 +1,6 @@ import importlib.resources from enum import Enum -from typing import Any, List +from typing import Any, Generator, List from loguru import logger from pydantic import BaseModel, PrivateAttr @@ -34,12 +34,16 @@ class MetadataGuardianResults(BaseModel): class DataRules(BaseModel): """Data Rules instances.""" - _data_rules: Any = PrivateAttr() + _data_rules: RawDataRules = PrivateAttr() def __init__(self, data_rules: RawDataRules, **data: Any) -> None: super().__init__(**data) self._data_rules = data_rules + @classmethod + def __get_validators__(cls) -> Generator[Any, None, None]: + yield [] # ignore the validation of RawDataRules attribute + @classmethod def from_new_category( cls, category: str, data_rules: List[DataRule] diff --git a/python/metadata_guardian/scanner.py b/python/metadata_guardian/scanner.py index bfb4e4b..05f6ae2 100644 --- a/python/metadata_guardian/scanner.py +++ b/python/metadata_guardian/scanner.py @@ -9,7 +9,7 @@ from .data_rules import DataRules from .report import MetadataGuardianReport, ProgressionBar, ReportResults -from .source import ExternalMetadataSource, LocalMetadataSource, MetadataSource +from .source import ExternalMetadataSource, LocalMetadataSource class Scanner(BaseModel, ABC): diff --git a/python/pyproject.toml b/python/pyproject.toml index 5746ad1..1904370 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["maturin==0.12.14"] +requires = ["maturin==0.12.18"] build-backend = "maturin" [project]