Skip to content

Introduce src-layout #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/install_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ jobs:
shell: bash
- name: Run tests
run: pytest
- name: Run CLI
run: pyspdxtools -i ./tests/data/formats/SPDXJSONExample-v2.3.spdx.json
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dynamic = ["version"]
test = ["pytest"]

[project.scripts]
pyspdxtools = "src.clitools.pyspdxtools:main"
pyspdxtools = "spdx.clitools.pyspdxtools:main"

[tool.setuptools]
zip-safe = false # because of the uses of __file__: https://github.com/spdx/tools-python/issues/257
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions src/clitools/pyspdxtools.py → src/spdx/clitools/pyspdxtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

import click

from src.model.document import Document
from src.parser.parse_anything import parse_file
from src.validation.document_validator import validate_full_spdx_document
from src.validation.validation_message import ValidationMessage
from src.writer.tagvalue import tagvalue_writer
from src.writer.write_anything import write_file
from spdx.model.document import Document
from spdx.parser.parse_anything import parse_file
from spdx.validation.document_validator import validate_full_spdx_document
from spdx.validation.validation_message import ValidationMessage
from spdx.writer.tagvalue import tagvalue_writer
from spdx.writer.write_anything import write_file


@click.command()
Expand Down
2 changes: 1 addition & 1 deletion src/config.py → src/spdx/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import json
import os

from src.model.version import Version
from spdx.model.version import Version

_base_dir = os.path.dirname(__file__)
_licenses = os.path.join(_base_dir, "licenses.json")
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/document_utils.py → src/spdx/document_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from typing import List

from src.model.document import Document
from spdx.model.document import Document


def get_contained_spdx_element_ids(document: Document) -> List[str]:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/formats.py → src/spdx/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import Enum, auto

from src.parser.error import SPDXParsingError
from spdx.parser.error import SPDXParsingError


class FileFormat(Enum):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
# limitations under the License.
from typing import Type, Any

from src.datetime_conversions import datetime_to_iso_string
from src.jsonschema.annotation_properties import AnnotationProperty
from src.jsonschema.converter import TypedConverter
from src.jsonschema.json_property import JsonProperty
from src.model.annotation import Annotation
from src.model.document import Document
from spdx.datetime_conversions import datetime_to_iso_string
from spdx.jsonschema.annotation_properties import AnnotationProperty
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.json_property import JsonProperty
from spdx.model.annotation import Annotation
from spdx.model.document import Document


class AnnotationConverter(TypedConverter[Annotation]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import auto

from src.jsonschema.json_property import JsonProperty
from spdx.jsonschema.json_property import JsonProperty


class AnnotationProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
# limitations under the License.
from typing import Type

from src.jsonschema.checksum_properties import ChecksumProperty
from src.jsonschema.converter import TypedConverter
from src.jsonschema.json_property import JsonProperty
from src.model.checksum import Checksum, ChecksumAlgorithm
from src.model.document import Document
from spdx.jsonschema.checksum_properties import ChecksumProperty
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.json_property import JsonProperty
from spdx.model.checksum import Checksum, ChecksumAlgorithm
from spdx.model.document import Document


class ChecksumConverter(TypedConverter[Checksum]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import auto

from src.jsonschema.json_property import JsonProperty
from spdx.jsonschema.json_property import JsonProperty


class ChecksumProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from abc import ABC, abstractmethod
from typing import Any, Type, Dict, TypeVar, Generic

from src.jsonschema.json_property import JsonProperty
from src.model.document import Document
from src.writer.casing_tools import snake_case_to_camel_case
from spdx.jsonschema.json_property import JsonProperty
from spdx.model.document import Document
from spdx.writer.casing_tools import snake_case_to_camel_case

MISSING_IMPLEMENTATION_MESSAGE = "Must be implemented"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
# limitations under the License.
from typing import Type, Any

from src.datetime_conversions import datetime_to_iso_string
from src.jsonschema.converter import TypedConverter
from src.jsonschema.creation_info_properties import CreationInfoProperty
from src.jsonschema.json_property import JsonProperty
from src.jsonschema.optional_utils import apply_if_present
from src.model.document import CreationInfo, Document
from spdx.datetime_conversions import datetime_to_iso_string
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.creation_info_properties import CreationInfoProperty
from spdx.jsonschema.json_property import JsonProperty
from spdx.jsonschema.optional_utils import apply_if_present
from spdx.model.document import CreationInfo, Document


class CreationInfoConverter(TypedConverter[CreationInfo]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import auto

from src.jsonschema.json_property import JsonProperty
from spdx.jsonschema.json_property import JsonProperty


class CreationInfoProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
# limitations under the License.
from typing import Type, Any

from src.document_utils import get_contained_spdx_element_ids
from src.jsonschema.annotation_converter import AnnotationConverter
from src.jsonschema.converter import TypedConverter
from src.jsonschema.creation_info_converter import CreationInfoConverter
from src.jsonschema.document_properties import DocumentProperty
from src.jsonschema.external_document_ref_converter import ExternalDocumentRefConverter
from src.jsonschema.extracted_licensing_info_converter import ExtractedLicensingInfoConverter
from src.jsonschema.file_converter import FileConverter
from src.jsonschema.json_property import JsonProperty
from src.jsonschema.package_converter import PackageConverter
from src.jsonschema.relationship_converter import RelationshipConverter
from src.jsonschema.snippet_converter import SnippetConverter
from src.model.document import Document
from src.model.relationship import RelationshipType
from src.model.relationship_filters import filter_by_type_and_origin, filter_by_type_and_target, \
from spdx.document_utils import get_contained_spdx_element_ids
from spdx.jsonschema.annotation_converter import AnnotationConverter
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.creation_info_converter import CreationInfoConverter
from spdx.jsonschema.document_properties import DocumentProperty
from spdx.jsonschema.external_document_ref_converter import ExternalDocumentRefConverter
from spdx.jsonschema.extracted_licensing_info_converter import ExtractedLicensingInfoConverter
from spdx.jsonschema.file_converter import FileConverter
from spdx.jsonschema.json_property import JsonProperty
from spdx.jsonschema.package_converter import PackageConverter
from spdx.jsonschema.relationship_converter import RelationshipConverter
from spdx.jsonschema.snippet_converter import SnippetConverter
from spdx.model.document import Document
from spdx.model.relationship import RelationshipType
from spdx.model.relationship_filters import filter_by_type_and_origin, filter_by_type_and_target, \
find_package_contains_file_relationships, \
find_file_contained_by_package_relationships

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import auto

from src.jsonschema.json_property import JsonProperty
from spdx.jsonschema.json_property import JsonProperty


class DocumentProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
# limitations under the License.
from typing import Type, Any

from src.jsonschema.checksum_converter import ChecksumConverter
from src.jsonschema.converter import TypedConverter
from src.jsonschema.external_document_ref_properties import ExternalDocumentRefProperty
from src.jsonschema.json_property import JsonProperty
from src.model.document import Document
from src.model.external_document_ref import ExternalDocumentRef
from spdx.jsonschema.checksum_converter import ChecksumConverter
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.external_document_ref_properties import ExternalDocumentRefProperty
from spdx.jsonschema.json_property import JsonProperty
from spdx.model.document import Document
from spdx.model.external_document_ref import ExternalDocumentRef


class ExternalDocumentRefConverter(TypedConverter[ExternalDocumentRef]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import auto

from src.jsonschema.json_property import JsonProperty
from spdx.jsonschema.json_property import JsonProperty


class ExternalDocumentRefProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
# limitations under the License.
from typing import Type, Any

from src.jsonschema.converter import TypedConverter
from src.jsonschema.external_package_ref_properties import ExternalPackageRefProperty
from src.jsonschema.json_property import JsonProperty
from src.model.document import Document
from src.model.package import ExternalPackageRef
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.external_package_ref_properties import ExternalPackageRefProperty
from spdx.jsonschema.json_property import JsonProperty
from spdx.model.document import Document
from spdx.model.package import ExternalPackageRef


class ExternalPackageRefConverter(TypedConverter[ExternalPackageRef]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import auto

from src.jsonschema.json_property import JsonProperty
from spdx.jsonschema.json_property import JsonProperty


class ExternalPackageRefProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
# limitations under the License.
from typing import Type, Any

from src.jsonschema.converter import TypedConverter
from src.jsonschema.extracted_licensing_info_properties import ExtractedLicensingInfoProperty
from src.jsonschema.json_property import JsonProperty
from src.jsonschema.optional_utils import apply_if_present
from src.model.document import Document
from src.model.extracted_licensing_info import ExtractedLicensingInfo
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.extracted_licensing_info_properties import ExtractedLicensingInfoProperty
from spdx.jsonschema.json_property import JsonProperty
from spdx.jsonschema.optional_utils import apply_if_present
from spdx.model.document import Document
from spdx.model.extracted_licensing_info import ExtractedLicensingInfo


class ExtractedLicensingInfoConverter(TypedConverter[ExtractedLicensingInfo]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import auto

from src.jsonschema.json_property import JsonProperty
from spdx.jsonschema.json_property import JsonProperty


class ExtractedLicensingInfoProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
# limitations under the License.
from typing import Type, Any

from src.jsonschema.annotation_converter import AnnotationConverter
from src.jsonschema.checksum_converter import ChecksumConverter
from src.jsonschema.converter import TypedConverter
from src.jsonschema.file_properties import FileProperty
from src.jsonschema.json_property import JsonProperty
from src.jsonschema.optional_utils import apply_if_present
from src.model.document import Document
from src.model.file import File
from spdx.jsonschema.annotation_converter import AnnotationConverter
from spdx.jsonschema.checksum_converter import ChecksumConverter
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.file_properties import FileProperty
from spdx.jsonschema.json_property import JsonProperty
from spdx.jsonschema.optional_utils import apply_if_present
from spdx.model.document import Document
from spdx.model.file import File


class FileConverter(TypedConverter[File]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import auto

from src.jsonschema.json_property import JsonProperty
from spdx.jsonschema.json_property import JsonProperty


class FileProperty(JsonProperty):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
# limitations under the License.
from typing import Type, Any

from src.datetime_conversions import datetime_to_iso_string
from src.jsonschema.annotation_converter import AnnotationConverter
from src.jsonschema.checksum_converter import ChecksumConverter
from src.jsonschema.converter import TypedConverter
from src.jsonschema.external_package_ref_converter import ExternalPackageRefConverter
from src.jsonschema.json_property import JsonProperty
from src.jsonschema.optional_utils import apply_if_present
from src.jsonschema.package_properties import PackageProperty
from src.jsonschema.package_verification_code_converter import PackageVerificationCodeConverter
from src.model.actor import Actor
from src.model.document import Document
from src.model.package import Package
from src.model.relationship_filters import find_package_contains_file_relationships, \
from spdx.datetime_conversions import datetime_to_iso_string
from spdx.jsonschema.annotation_converter import AnnotationConverter
from spdx.jsonschema.checksum_converter import ChecksumConverter
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.external_package_ref_converter import ExternalPackageRefConverter
from spdx.jsonschema.json_property import JsonProperty
from spdx.jsonschema.optional_utils import apply_if_present
from spdx.jsonschema.package_properties import PackageProperty
from spdx.jsonschema.package_verification_code_converter import PackageVerificationCodeConverter
from spdx.model.actor import Actor
from spdx.model.document import Document
from spdx.model.package import Package
from spdx.model.relationship_filters import find_package_contains_file_relationships, \
find_file_contained_by_package_relationships


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import auto

from src.jsonschema.json_property import JsonProperty
from spdx.jsonschema.json_property import JsonProperty


class PackageProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
# limitations under the License.
from typing import Type, Any

from src.jsonschema.converter import TypedConverter
from src.jsonschema.json_property import JsonProperty
from src.jsonschema.package_verification_code_properties import PackageVerificationCodeProperty
from src.model.document import Document
from src.model.package import PackageVerificationCode
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.json_property import JsonProperty
from spdx.jsonschema.package_verification_code_properties import PackageVerificationCodeProperty
from spdx.model.document import Document
from spdx.model.package import PackageVerificationCode


class PackageVerificationCodeConverter(TypedConverter[PackageVerificationCode]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# limitations under the License.
from enum import auto

from src.jsonschema.json_property import JsonProperty
from spdx.jsonschema.json_property import JsonProperty


class PackageVerificationCodeProperty(JsonProperty):
Expand Down
Loading