amati 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. amati-0.1.0/.github/dependabot.yml +20 -0
  2. amati-0.1.0/.github/workflows/checks.yaml +64 -0
  3. amati-0.1.0/.github/workflows/codeql.yml +100 -0
  4. amati-0.1.0/.github/workflows/coverage.yaml +36 -0
  5. amati-0.1.0/.github/workflows/publish.yaml +26 -0
  6. amati-0.1.0/.github/workflows/publish_pypi_test.yaml +26 -0
  7. amati-0.1.0/.gitignore +136 -0
  8. amati-0.1.0/.pre-commit-config.yaml +25 -0
  9. amati-0.1.0/.pylintrc +394 -0
  10. amati-0.1.0/.python-version +1 -0
  11. amati-0.1.0/LICENSE +21 -0
  12. amati-0.1.0/PKG-INFO +89 -0
  13. amati-0.1.0/README.md +66 -0
  14. amati-0.1.0/amati/__init__.py +14 -0
  15. amati-0.1.0/amati/_resolve_forward_references.py +185 -0
  16. amati-0.1.0/amati/amati.py +143 -0
  17. amati-0.1.0/amati/data/http-status-codes.json +1 -0
  18. amati-0.1.0/amati/data/iso9110.json +1 -0
  19. amati-0.1.0/amati/data/media-types.json +1 -0
  20. amati-0.1.0/amati/data/schemes.json +1 -0
  21. amati-0.1.0/amati/data/spdx-licences.json +1 -0
  22. amati-0.1.0/amati/data/tlds.json +1 -0
  23. amati-0.1.0/amati/exceptions.py +26 -0
  24. amati-0.1.0/amati/fields/__init__.py +15 -0
  25. amati-0.1.0/amati/fields/_custom_types.py +71 -0
  26. amati-0.1.0/amati/fields/commonmark.py +9 -0
  27. amati-0.1.0/amati/fields/email.py +27 -0
  28. amati-0.1.0/amati/fields/http_status_codes.py +95 -0
  29. amati-0.1.0/amati/fields/iso9110.py +61 -0
  30. amati-0.1.0/amati/fields/json.py +13 -0
  31. amati-0.1.0/amati/fields/media.py +100 -0
  32. amati-0.1.0/amati/fields/oas.py +79 -0
  33. amati-0.1.0/amati/fields/spdx_licences.py +92 -0
  34. amati-0.1.0/amati/fields/uri.py +342 -0
  35. amati-0.1.0/amati/file_handler.py +155 -0
  36. amati-0.1.0/amati/grammars/oas.py +45 -0
  37. amati-0.1.0/amati/grammars/rfc6901.py +26 -0
  38. amati-0.1.0/amati/grammars/rfc7159.py +65 -0
  39. amati-0.1.0/amati/logging.py +57 -0
  40. amati-0.1.0/amati/model_validators.py +438 -0
  41. amati-0.1.0/amati/references.py +33 -0
  42. amati-0.1.0/amati/validators/__init__.py +0 -0
  43. amati-0.1.0/amati/validators/generic.py +133 -0
  44. amati-0.1.0/amati/validators/oas304.py +1031 -0
  45. amati-0.1.0/amati/validators/oas311.py +615 -0
  46. amati-0.1.0/bin/checks.sh +6 -0
  47. amati-0.1.0/bin/startup.sh +7 -0
  48. amati-0.1.0/pyproject.toml +79 -0
  49. amati-0.1.0/scripts/data/http_status_code.py +38 -0
  50. amati-0.1.0/scripts/data/iso9110.py +31 -0
  51. amati-0.1.0/scripts/data/media_types.py +50 -0
  52. amati-0.1.0/scripts/data/schemes.py +31 -0
  53. amati-0.1.0/scripts/data/spdx_licences.py +24 -0
  54. amati-0.1.0/scripts/data/tlds.py +29 -0
  55. amati-0.1.0/scripts/tests/setup_test_specs.py +74 -0
  56. amati-0.1.0/tests/__init__.py +0 -0
  57. amati-0.1.0/tests/data/.amati.tests.yaml +33 -0
  58. amati-0.1.0/tests/data/DigitalOcean-public.v2.errors +28 -0
  59. amati-0.1.0/tests/fields/__init__.py +0 -0
  60. amati-0.1.0/tests/fields/test_email.py +41 -0
  61. amati-0.1.0/tests/fields/test_http_status_codes.py +52 -0
  62. amati-0.1.0/tests/fields/test_iso9110.py +38 -0
  63. amati-0.1.0/tests/fields/test_media.py +84 -0
  64. amati-0.1.0/tests/fields/test_oas.py +103 -0
  65. amati-0.1.0/tests/fields/test_spdx_licences.py +44 -0
  66. amati-0.1.0/tests/fields/test_uri.py +244 -0
  67. amati-0.1.0/tests/helpers.py +50 -0
  68. amati-0.1.0/tests/model_validators/test_all_of.py +203 -0
  69. amati-0.1.0/tests/model_validators/test_at_least_one.py +270 -0
  70. amati-0.1.0/tests/model_validators/test_if_then.py +363 -0
  71. amati-0.1.0/tests/model_validators/test_only_one.py +193 -0
  72. amati-0.1.0/tests/test_external_specs.py +81 -0
  73. amati-0.1.0/tests/test_logging.py +43 -0
  74. amati-0.1.0/tests/test_references.py +25 -0
  75. amati-0.1.0/tests/validators/__init__.py +0 -0
  76. amati-0.1.0/tests/validators/test_generic.py +102 -0
  77. amati-0.1.0/tests/validators/test_licence_object.py +150 -0
  78. amati-0.1.0/tests/validators/test_security_scheme_object.py +307 -0
  79. amati-0.1.0/tests/validators/test_server_variable_object.py +51 -0
  80. amati-0.1.0/uv.lock +563 -0
@@ -0,0 +1,20 @@
1
+ version: 2
2
+ updates:
3
+ # Enable version updates for npm
4
+ - package-ecosystem: "uv"
5
+ # Look for `uv.lock` file in the root directory.
6
+ directory: "/"
7
+ # Check the registry for updates every day (weekdays)
8
+ schedule:
9
+ interval: "daily"
10
+
11
+ # Enable version updates for GitHub Actions
12
+ - package-ecosystem: "github-actions"
13
+ # Workflow files stored in the default location of `.github/workflows`
14
+ # You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
15
+ directory: "/"
16
+ schedule:
17
+ interval: "weekly"
18
+ allow:
19
+ - dependency-type: "direct"
20
+ - dependency-type: "indirect"
@@ -0,0 +1,64 @@
1
+ name: Checks
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [ "main" ]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ # Gives the action the necessary permissions for publishing new
15
+ # comments in pull requests.
16
+ pull-requests: write
17
+ # Gives the action the necessary permissions for pushing data to the
18
+ # python-coverage-comment-action branch, and for editing existing
19
+ # comments (to avoid publishing multiple comments in the same PR)
20
+ contents: write
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - name: Install uv
24
+ uses: astral-sh/setup-uv@v6
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version-file: ".python-version"
29
+
30
+ - name: Install the project
31
+ run: uv sync --locked --all-extras --dev
32
+
33
+ - name: Formatting
34
+ run: uv run black .
35
+
36
+ - name: Import sorting
37
+ run: uv run isort .
38
+
39
+ - name: Linting
40
+ run: uv run pylint amati
41
+
42
+ - name: Test Linting
43
+ run: uv run pylint tests
44
+
45
+ - name: Testing
46
+ run: uv run pytest -m"not external" --cov
47
+
48
+ - name: Doctests
49
+ run: uv run pytest --doctest-modules amati/
50
+
51
+ - name: Coverage comment
52
+ id: coverage_comment
53
+ uses: py-cov-action/python-coverage-comment-action@v3
54
+ with:
55
+ GITHUB_TOKEN: ${{ github.token }}
56
+
57
+ - name: Store Pull Request comment to be posted
58
+ uses: actions/upload-artifact@v4
59
+ if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
60
+ with:
61
+ # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly
62
+ name: python-coverage-comment-action
63
+ # If you use a different name, update COMMENT_FILENAME accordingly
64
+ path: python-coverage-comment-action.txt
@@ -0,0 +1,100 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL Advanced"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "main" ]
17
+ pull_request:
18
+ branches: [ "main" ]
19
+ schedule:
20
+ - cron: '35 2 * * 3'
21
+
22
+ jobs:
23
+ analyze:
24
+ name: Analyze (${{ matrix.language }})
25
+ # Runner size impacts CodeQL analysis time. To learn more, please see:
26
+ # - https://gh.io/recommended-hardware-resources-for-running-codeql
27
+ # - https://gh.io/supported-runners-and-hardware-resources
28
+ # - https://gh.io/using-larger-runners (GitHub.com only)
29
+ # Consider using larger runners or machines with greater resources for possible analysis time improvements.
30
+ runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31
+ permissions:
32
+ # required for all workflows
33
+ security-events: write
34
+
35
+ # required to fetch internal or private CodeQL packs
36
+ packages: read
37
+
38
+ # only required for workflows in private repositories
39
+ actions: read
40
+ contents: read
41
+
42
+ strategy:
43
+ fail-fast: false
44
+ matrix:
45
+ include:
46
+ - language: actions
47
+ build-mode: none
48
+ - language: python
49
+ build-mode: none
50
+ # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
51
+ # Use `c-cpp` to analyze code written in C, C++ or both
52
+ # Use 'java-kotlin' to analyze code written in Java, Kotlin or both
53
+ # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
54
+ # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
55
+ # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
56
+ # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
57
+ # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
58
+ steps:
59
+ - name: Checkout repository
60
+ uses: actions/checkout@v4
61
+
62
+ # Add any setup steps before running the `github/codeql-action/init` action.
63
+ # This includes steps like installing compilers or runtimes (`actions/setup-node`
64
+ # or others). This is typically only required for manual builds.
65
+ # - name: Setup runtime (example)
66
+ # uses: actions/setup-example@v1
67
+
68
+ # Initializes the CodeQL tools for scanning.
69
+ - name: Initialize CodeQL
70
+ uses: github/codeql-action/init@v3
71
+ with:
72
+ languages: ${{ matrix.language }}
73
+ build-mode: ${{ matrix.build-mode }}
74
+ # If you wish to specify custom queries, you can do so here or in a config file.
75
+ # By default, queries listed here will override any specified in a config file.
76
+ # Prefix the list here with "+" to use these queries and those in the config file.
77
+
78
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
79
+ # queries: security-extended,security-and-quality
80
+
81
+ # If the analyze step fails for one of the languages you are analyzing with
82
+ # "We were unable to automatically build your code", modify the matrix above
83
+ # to set the build mode to "manual" for that language. Then modify this step
84
+ # to build your code.
85
+ # ℹ️ Command-line programs to run using the OS shell.
86
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
87
+ - if: matrix.build-mode == 'manual'
88
+ shell: bash
89
+ run: |
90
+ echo 'If you are using a "manual" build mode for one or more of the' \
91
+ 'languages you are analyzing, replace this with the commands to build' \
92
+ 'your code, for example:'
93
+ echo ' make bootstrap'
94
+ echo ' make release'
95
+ exit 1
96
+
97
+ - name: Perform CodeQL Analysis
98
+ uses: github/codeql-action/analyze@v3
99
+ with:
100
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,36 @@
1
+ # .github/workflows/coverage.yml
2
+ name: Post coverage comment
3
+
4
+ on:
5
+ workflow_run:
6
+ workflows: ["Checks"]
7
+ types:
8
+ - completed
9
+
10
+ jobs:
11
+ test:
12
+ name: Run tests & display coverage
13
+ runs-on: ubuntu-latest
14
+ if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
15
+ permissions:
16
+ # Gives the action the necessary permissions for publishing new
17
+ # comments in pull requests.
18
+ pull-requests: write
19
+ # Gives the action the necessary permissions for editing existing
20
+ # comments (to avoid publishing multiple comments in the same PR)
21
+ contents: write
22
+ # Gives the action the necessary permissions for looking up the
23
+ # workflow that launched this workflow, and download the related
24
+ # artifact that contains the comment to be published
25
+ actions: read
26
+ steps:
27
+ # DO NOT run actions/checkout here, for security reasons
28
+ # For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
29
+ - name: Post comment
30
+ uses: py-cov-action/python-coverage-comment-action@v3
31
+ with:
32
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33
+ GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
34
+ # Update those if you changed the default values:
35
+ # COMMENT_ARTIFACT_NAME: python-coverage-comment-action
36
+ # COMMENT_FILENAME: python-coverage-comment-action.txt
@@ -0,0 +1,26 @@
1
+ name: Publish to PyPI test
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+
7
+ jobs:
8
+ run:
9
+ name: "Build and publish release"
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ id-token: write # Required for OIDC authentication
13
+ contents: read
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - name: Install uv
18
+ uses: astral-sh/setup-uv@v6
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version-file: ".python-version"
23
+ - name: Build
24
+ run: uv build
25
+ - name: Publish
26
+ run: uv publish
@@ -0,0 +1,26 @@
1
+ name: Publish to PyPI test
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+
7
+ jobs:
8
+ run:
9
+ name: "Build and publish release"
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ id-token: write # Required for OIDC authentication
13
+ contents: read
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - name: Install uv
18
+ uses: astral-sh/setup-uv@v6
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version-file: ".python-version"
23
+ - name: Build
24
+ run: uv build
25
+ - name: Publish
26
+ run: uv publish --index testpypi
amati-0.1.0/.gitignore ADDED
@@ -0,0 +1,136 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+
55
+ # IPython
56
+ profile_default/
57
+ ipython_config.py
58
+
59
+ # pyenv
60
+ # For a library or package, you might want to ignore these files since the code is
61
+ # intended to run in multiple environments; otherwise, check them in:
62
+ # .python-version
63
+
64
+ # pipenv
65
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
66
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
67
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
68
+ # install all needed dependencies.
69
+ #Pipfile.lock
70
+
71
+ # poetry
72
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
73
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
74
+ # commonly ignored for libraries.
75
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
76
+ #poetry.lock
77
+
78
+ # pdm
79
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
80
+ #pdm.lock
81
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
82
+ # in version control.
83
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
84
+ .pdm.toml
85
+ .pdm-python
86
+ .pdm-build/
87
+
88
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
89
+ __pypackages__/
90
+
91
+
92
+ # Environments
93
+ .env
94
+ .venv
95
+ env/
96
+ venv/
97
+ ENV/
98
+ env.bak/
99
+ venv.bak/
100
+
101
+ # VS code
102
+ .vscode/
103
+
104
+ # mutmut
105
+ mutants
106
+
107
+ # mkdocs documentation
108
+ /site
109
+
110
+ # mypy
111
+ .mypy_cache/
112
+ .dmypy.json
113
+ dmypy.json
114
+
115
+ # Pyre type checker
116
+ .pyre/
117
+
118
+ # pytype static type analyzer
119
+ .pytype/
120
+
121
+ # Cython debug symbols
122
+ cython_debug/
123
+
124
+ # PyCharm
125
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
126
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
127
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
128
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
129
+ #.idea/
130
+
131
+
132
+ # Mac
133
+ .DS_Store
134
+
135
+ # Logging output
136
+ .amati/*
@@ -0,0 +1,25 @@
1
+ repos:
2
+ # Using this mirror lets us use mypyc-compiled black, which is about 2x faster
3
+ - repo: https://github.com/psf/black-pre-commit-mirror
4
+ rev: 24.8.0
5
+ hooks:
6
+ - id: black
7
+ language_version: python3.13
8
+ - repo: https://github.com/pycqa/isort
9
+ rev: 5.13.2
10
+ hooks:
11
+ - id: isort
12
+ name: isort (python)
13
+ - repo: local
14
+ hooks:
15
+ - id: pylint
16
+ name: pylint
17
+ entry: pylint
18
+ language: system
19
+ types: [python]
20
+ require_serial: true
21
+ args:
22
+ [
23
+ "-rn", # Only display messages
24
+ "--rcfile=.pylintrc", # Link to your config file
25
+ ]