diff --git a/.github/workflows/pypi-release-minecode-pipeline.yml b/.github/workflows/pypi-release-minecode-pipeline.yml index a7c2aa8b..43bf58a9 100644 --- a/.github/workflows/pypi-release-minecode-pipeline.yml +++ b/.github/workflows/pypi-release-minecode-pipeline.yml @@ -23,13 +23,13 @@ jobs: run: python -m pip install flot --user - name: Build binary wheel and source tarball - run: python -m flot --pyproject pyproject-minecode_pipeline.toml --sdist --wheel --output-dir dist/ + run: python -m flot --pyproject pyproject-minecode_pipelines.toml --sdist --wheel --output-dir dist/ - name: Publish to PyPI if: startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 with: - password: ${{ secrets.PYPI_API_TOKEN_MINECODE_PIPELINE }} + password: ${{ secrets.PYPI_API_TOKEN_MINECODE_PIPELINES }} - name: Upload built archives uses: actions/upload-artifact@v4 diff --git a/Makefile b/Makefile index c7b24b36..294b5726 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,7 @@ test_matchcode: test: test_purldb test_matchcode test_toolkit test_clearcode test_minecode: - ${ACTIVATE} ${PYTHON_EXE} -m pytest -vvs minecode_pipeline + ${ACTIVATE} ${PYTHON_EXE} -m pytest -vvs minecode_pipelines shell: ${MANAGE} shell diff --git a/minecode_pipeline/tests/pipes/__init__.py b/minecode_pipeline/tests/pipes/__init__.py deleted file mode 100644 index e1521118..00000000 --- a/minecode_pipeline/tests/pipes/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# -# Copyright (c) nexB Inc. and others. All rights reserved. -# purldb is a trademark of nexB Inc. -# SPDX-License-Identifier: Apache-2.0 -# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -# See https://github.com/aboutcode-org/purldb for support or download. -# See https://aboutcode.org for more information about nexB OSS projects. -# diff --git a/minecode_pipeline/README.rst b/minecode_pipelines/README.rst similarity index 100% rename from minecode_pipeline/README.rst rename to minecode_pipelines/README.rst diff --git a/minecode_pipeline/__init__.py b/minecode_pipelines/__init__.py similarity index 100% rename from minecode_pipeline/__init__.py rename to minecode_pipelines/__init__.py diff --git a/minecode_pipeline/pipes/__init__.py b/minecode_pipelines/miners/__init__.py similarity index 100% rename from minecode_pipeline/pipes/__init__.py rename to minecode_pipelines/miners/__init__.py diff --git a/minecode_pipeline/miners/pypi.py b/minecode_pipelines/miners/pypi.py similarity index 98% rename from minecode_pipeline/miners/pypi.py rename to minecode_pipelines/miners/pypi.py index f4ea3b2f..e22102d3 100644 --- a/minecode_pipeline/miners/pypi.py +++ b/minecode_pipelines/miners/pypi.py @@ -13,7 +13,7 @@ from packageurl import PackageURL -from minecode_pipeline.utils import get_temp_file +from minecode_pipelines.utils import get_temp_file """ Visitors for Pypi and Pypi-like Python package repositories. diff --git a/minecode_pipeline/miners/__init__.py b/minecode_pipelines/pipelines/__init__.py similarity index 100% rename from minecode_pipeline/miners/__init__.py rename to minecode_pipelines/pipelines/__init__.py diff --git a/minecode_pipeline/pipelines/mine_pypi.py b/minecode_pipelines/pipelines/mine_pypi.py similarity index 98% rename from minecode_pipeline/pipelines/mine_pypi.py rename to minecode_pipelines/pipelines/mine_pypi.py index c891bfac..6ab016ac 100644 --- a/minecode_pipeline/pipelines/mine_pypi.py +++ b/minecode_pipelines/pipelines/mine_pypi.py @@ -23,7 +23,7 @@ from scanpipe.pipelines import Pipeline from scanpipe.pipes import federatedcode -from minecode_pipeline.pipes import pypi +from minecode_pipelines.pipes import pypi class MineandPublishPypiPURLs(Pipeline): diff --git a/minecode_pipelines/pipes/__init__.py b/minecode_pipelines/pipes/__init__.py new file mode 100644 index 00000000..b8339a2b --- /dev/null +++ b/minecode_pipelines/pipes/__init__.py @@ -0,0 +1,28 @@ +# +# Copyright (c) nexB Inc. and others. All rights reserved. +# purldb is a trademark of nexB Inc. +# SPDX-License-Identifier: Apache-2.0 +# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. +# See https://github.com/aboutcode-org/purldb for support or download. +# See https://aboutcode.org for more information about nexB OSS projects. +# + +import os +import saneyaml + +from pathlib import Path + +from aboutcode.hashid import PURLS_FILENAME + + +def write_packageurls_to_file(repo, base_dir, packageurls): + purl_file_rel_path = os.path.join(base_dir, PURLS_FILENAME) + purl_file_full_path = Path(repo.working_dir) / purl_file_rel_path + write_data_to_file(path=purl_file_full_path, data=packageurls) + return purl_file_rel_path + + +def write_data_to_file(path, data): + path.parent.mkdir(parents=True, exist_ok=True) + with open(path, encoding="utf-8", mode="w") as f: + f.write(saneyaml.dump(data)) diff --git a/minecode_pipeline/pipes/pypi.py b/minecode_pipelines/pipes/pypi.py similarity index 94% rename from minecode_pipeline/pipes/pypi.py rename to minecode_pipelines/pipes/pypi.py index 1d8f7121..19fcb18a 100644 --- a/minecode_pipeline/pipes/pypi.py +++ b/minecode_pipelines/pipes/pypi.py @@ -26,13 +26,13 @@ from datetime import datetime -from minecode_pipeline import pipes -from minecode_pipeline.miners.pypi import get_pypi_packages -from minecode_pipeline.miners.pypi import load_pypi_packages -from minecode_pipeline.miners.pypi import get_pypi_packageurls -from minecode_pipeline.miners.pypi import PYPI_REPO +from minecode_pipelines import pipes +from minecode_pipelines.miners.pypi import get_pypi_packages +from minecode_pipelines.miners.pypi import load_pypi_packages +from minecode_pipelines.miners.pypi import get_pypi_packageurls +from minecode_pipelines.miners.pypi import PYPI_REPO -from minecode_pipeline.miners.pypi import PYPI_TYPE +from minecode_pipelines.miners.pypi import PYPI_TYPE from packageurl import PackageURL diff --git a/minecode_pipeline/pipelines/__init__.py b/minecode_pipelines/tests/__init__.py similarity index 100% rename from minecode_pipeline/pipelines/__init__.py rename to minecode_pipelines/tests/__init__.py diff --git a/minecode_pipeline/tests/__init__.py b/minecode_pipelines/tests/pipes/__init__.py similarity index 100% rename from minecode_pipeline/tests/__init__.py rename to minecode_pipelines/tests/pipes/__init__.py diff --git a/minecode_pipeline/tests/pipes/test_pypi.py b/minecode_pipelines/tests/pipes/test_pypi.py similarity index 100% rename from minecode_pipeline/tests/pipes/test_pypi.py rename to minecode_pipelines/tests/pipes/test_pypi.py diff --git a/minecode_pipeline/utils.py b/minecode_pipelines/utils.py similarity index 100% rename from minecode_pipeline/utils.py rename to minecode_pipelines/utils.py diff --git a/pyproject-minecode_pipeline.toml b/pyproject-minecode_pipeline.toml index a134d41c..50e91022 100644 --- a/pyproject-minecode_pipeline.toml +++ b/pyproject-minecode_pipeline.toml @@ -3,10 +3,10 @@ requires = [ "flot>=0.7.0" ] build-backend = "flot.buildapi" [project] -name = "minecode_pipeline" +name = "minecode_pipelines" version = "0.0.1b1" description = "A library for mining packageURLs and package metadata from ecosystem repositories." -readme = "minecode_pipeline/README.rst" +readme = "minecode_pipelines/README.rst" license = { text = "Apache-2.0" } requires-python = ">=3.10" @@ -28,7 +28,7 @@ keywords = [ classifiers = [ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", @@ -45,19 +45,19 @@ dependencies = [ urls = { Homepage = "https://github.com/aboutcode-org/purldb" } [project.entry-points."scancodeio_pipelines"] -mine_pypi = "minecode_pipeline.pipelines.mine_pypi:MineandPublishPypiPURLs" +mine_pypi = "minecode_pipelines.pipelines.mine_pypi:MineandPublishPypiPURLs" [tool.bumpversion] current_version = "0.0.1b1" allow_dirty = true files = [ - { filename = "pyproject-minecode_pipeline.toml" }, + { filename = "pyproject-minecode_pipelines.toml" }, ] [tool.flot] includes = [ - "minecode_pipeline/**/*", + "minecode_pipelines/**/*", ] excludes = [ @@ -71,10 +71,10 @@ excludes = [ "**/.ve", "**/*.bak", "**/.ipynb_checkpoints/*", - "minecode_pipeline/tests/**/*", - "minecode_pipeline/notebooks/*", + "minecode_pipelines/tests/**/*", + "minecode_pipelines/notebooks/*", ] metadata_files = ["apache-2.0.LICENSE", "NOTICE"] -editable_paths = ["minecode_pipeline"] +editable_paths = ["minecode_pipelines"]