diracx 0.0.1a2__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 (116) hide show
  1. diracx-0.0.1a2/.coveragerc +15 -0
  2. diracx-0.0.1a2/.github/dependabot.yml +7 -0
  3. diracx-0.0.1a2/.github/workflows/containerised.yml +33 -0
  4. diracx-0.0.1a2/.github/workflows/deployment.yml +135 -0
  5. diracx-0.0.1a2/.github/workflows/integration.yml +53 -0
  6. diracx-0.0.1a2/.github/workflows/main.yml +54 -0
  7. diracx-0.0.1a2/.github/workflows/make_release.py +70 -0
  8. diracx-0.0.1a2/.gitignore +92 -0
  9. diracx-0.0.1a2/.gitlab-ci.yml +45 -0
  10. diracx-0.0.1a2/.pre-commit-config.yaml +36 -0
  11. diracx-0.0.1a2/Dockerfile +41 -0
  12. diracx-0.0.1a2/LICENSE +621 -0
  13. diracx-0.0.1a2/PKG-INFO +60 -0
  14. diracx-0.0.1a2/README.md +9 -0
  15. diracx-0.0.1a2/codecov.yml +13 -0
  16. diracx-0.0.1a2/dockerEntrypoint.sh +6 -0
  17. diracx-0.0.1a2/dockerMicroMambaEntrypoint.sh +5 -0
  18. diracx-0.0.1a2/docs/README.md +174 -0
  19. diracx-0.0.1a2/docs/login_demo_1.png +0 -0
  20. diracx-0.0.1a2/docs/login_demo_2.png +0 -0
  21. diracx-0.0.1a2/docs/login_demo_3.png +0 -0
  22. diracx-0.0.1a2/environment.yml +53 -0
  23. diracx-0.0.1a2/pyproject.toml +37 -0
  24. diracx-0.0.1a2/release.notes +2 -0
  25. diracx-0.0.1a2/run_local.sh +31 -0
  26. diracx-0.0.1a2/setup.cfg +82 -0
  27. diracx-0.0.1a2/src/diracx/__init__.py +12 -0
  28. diracx-0.0.1a2/src/diracx/__main__.py +4 -0
  29. diracx-0.0.1a2/src/diracx/api/__init__.py +0 -0
  30. diracx-0.0.1a2/src/diracx/cli/__init__.py +96 -0
  31. diracx-0.0.1a2/src/diracx/cli/internal.py +111 -0
  32. diracx-0.0.1a2/src/diracx/cli/jobs.py +113 -0
  33. diracx-0.0.1a2/src/diracx/cli/utils.py +33 -0
  34. diracx-0.0.1a2/src/diracx/client/__init__.py +21 -0
  35. diracx-0.0.1a2/src/diracx/client/_client.py +96 -0
  36. diracx-0.0.1a2/src/diracx/client/_configuration.py +49 -0
  37. diracx-0.0.1a2/src/diracx/client/_patch.py +22 -0
  38. diracx-0.0.1a2/src/diracx/client/_serialization.py +2127 -0
  39. diracx-0.0.1a2/src/diracx/client/_vendor.py +33 -0
  40. diracx-0.0.1a2/src/diracx/client/aio/__init__.py +21 -0
  41. diracx-0.0.1a2/src/diracx/client/aio/_client.py +98 -0
  42. diracx-0.0.1a2/src/diracx/client/aio/_configuration.py +51 -0
  43. diracx-0.0.1a2/src/diracx/client/aio/_patch.py +22 -0
  44. diracx-0.0.1a2/src/diracx/client/aio/_vendor.py +17 -0
  45. diracx-0.0.1a2/src/diracx/client/aio/operations/__init__.py +23 -0
  46. diracx-0.0.1a2/src/diracx/client/aio/operations/_operations.py +1581 -0
  47. diracx-0.0.1a2/src/diracx/client/aio/operations/_patch.py +129 -0
  48. diracx-0.0.1a2/src/diracx/client/models/__init__.py +69 -0
  49. diracx-0.0.1a2/src/diracx/client/models/_enums.py +74 -0
  50. diracx-0.0.1a2/src/diracx/client/models/_models.py +648 -0
  51. diracx-0.0.1a2/src/diracx/client/models/_patch.py +54 -0
  52. diracx-0.0.1a2/src/diracx/client/operations/__init__.py +23 -0
  53. diracx-0.0.1a2/src/diracx/client/operations/_operations.py +2018 -0
  54. diracx-0.0.1a2/src/diracx/client/operations/_patch.py +132 -0
  55. diracx-0.0.1a2/src/diracx/client/py.typed +1 -0
  56. diracx-0.0.1a2/src/diracx/core/__init__.py +0 -0
  57. diracx-0.0.1a2/src/diracx/core/config/__init__.py +137 -0
  58. diracx-0.0.1a2/src/diracx/core/config/schema.py +139 -0
  59. diracx-0.0.1a2/src/diracx/core/exceptions.py +38 -0
  60. diracx-0.0.1a2/src/diracx/core/extensions.py +40 -0
  61. diracx-0.0.1a2/src/diracx/core/models.py +38 -0
  62. diracx-0.0.1a2/src/diracx/core/preferences.py +45 -0
  63. diracx-0.0.1a2/src/diracx/core/properties.py +150 -0
  64. diracx-0.0.1a2/src/diracx/core/settings.py +60 -0
  65. diracx-0.0.1a2/src/diracx/core/utils.py +23 -0
  66. diracx-0.0.1a2/src/diracx/db/__init__.py +7 -0
  67. diracx-0.0.1a2/src/diracx/db/auth/__init__.py +0 -0
  68. diracx-0.0.1a2/src/diracx/db/auth/db.py +305 -0
  69. diracx-0.0.1a2/src/diracx/db/auth/schema.py +101 -0
  70. diracx-0.0.1a2/src/diracx/db/dummy/__init__.py +0 -0
  71. diracx-0.0.1a2/src/diracx/db/dummy/db.py +52 -0
  72. diracx-0.0.1a2/src/diracx/db/dummy/schema.py +22 -0
  73. diracx-0.0.1a2/src/diracx/db/jobs/__init__.py +0 -0
  74. diracx-0.0.1a2/src/diracx/db/jobs/db.py +244 -0
  75. diracx-0.0.1a2/src/diracx/db/jobs/schema.py +184 -0
  76. diracx-0.0.1a2/src/diracx/db/sandbox_metadata/__init__.py +0 -0
  77. diracx-0.0.1a2/src/diracx/db/sandbox_metadata/db.py +80 -0
  78. diracx-0.0.1a2/src/diracx/db/sandbox_metadata/schema.py +51 -0
  79. diracx-0.0.1a2/src/diracx/db/utils.py +173 -0
  80. diracx-0.0.1a2/src/diracx/py.typed +0 -0
  81. diracx-0.0.1a2/src/diracx/routers/__init__.py +187 -0
  82. diracx-0.0.1a2/src/diracx/routers/auth.py +1005 -0
  83. diracx-0.0.1a2/src/diracx/routers/configuration.py +63 -0
  84. diracx-0.0.1a2/src/diracx/routers/dependencies.py +37 -0
  85. diracx-0.0.1a2/src/diracx/routers/fastapi_classes.py +64 -0
  86. diracx-0.0.1a2/src/diracx/routers/job_manager/__init__.py +382 -0
  87. diracx-0.0.1a2/src/diracx/routers/well_known.py +41 -0
  88. diracx-0.0.1a2/src/diracx.egg-info/PKG-INFO +60 -0
  89. diracx-0.0.1a2/src/diracx.egg-info/SOURCES.txt +115 -0
  90. diracx-0.0.1a2/src/diracx.egg-info/dependency_links.txt +1 -0
  91. diracx-0.0.1a2/src/diracx.egg-info/entry_points.txt +16 -0
  92. diracx-0.0.1a2/src/diracx.egg-info/requires.txt +36 -0
  93. diracx-0.0.1a2/src/diracx.egg-info/top_level.txt +1 -0
  94. diracx-0.0.1a2/tests/.dirac-ci-config.yaml +15 -0
  95. diracx-0.0.1a2/tests/__init__.py +0 -0
  96. diracx-0.0.1a2/tests/cli/test_internal.py +79 -0
  97. diracx-0.0.1a2/tests/client/test_regenerate.py +54 -0
  98. diracx-0.0.1a2/tests/conftest.py +180 -0
  99. diracx-0.0.1a2/tests/core/test_extensions.py +24 -0
  100. diracx-0.0.1a2/tests/core/test_secrets.py +38 -0
  101. diracx-0.0.1a2/tests/core/test_utils.py +26 -0
  102. diracx-0.0.1a2/tests/data/lhcb-auth.web.cern.ch/.well-known/openid-configuration +1 -0
  103. diracx-0.0.1a2/tests/db/__init__.py +0 -0
  104. diracx-0.0.1a2/tests/db/auth/__init__.py +0 -0
  105. diracx-0.0.1a2/tests/db/auth/test_authorization_flow.py +80 -0
  106. diracx-0.0.1a2/tests/db/auth/test_device_flow.py +143 -0
  107. diracx-0.0.1a2/tests/db/auth/test_refresh_token.py +246 -0
  108. diracx-0.0.1a2/tests/db/test_dummyDB.py +67 -0
  109. diracx-0.0.1a2/tests/db/test_jobDB.py +38 -0
  110. diracx-0.0.1a2/tests/db/test_sandboxMetadataDB.py +82 -0
  111. diracx-0.0.1a2/tests/routers/__init__.py +0 -0
  112. diracx-0.0.1a2/tests/routers/test_auth.py +668 -0
  113. diracx-0.0.1a2/tests/routers/test_config_manager.py +104 -0
  114. diracx-0.0.1a2/tests/routers/test_generic.py +10 -0
  115. diracx-0.0.1a2/tests/routers/test_job_manager.py +210 -0
  116. diracx-0.0.1a2/tests/test_generic.py +6 -0
@@ -0,0 +1,15 @@
1
+ [run]
2
+ omit =
3
+ tests/*
4
+ src/diracx/client/*
5
+ */site-packages/diracx/client/*
6
+
7
+ [report]
8
+ exclude_lines =
9
+ # Have to re-enable the standard pragma
10
+ pragma: no cover
11
+
12
+ # Don't complain if tests don't hit defensive assertion code:
13
+ raise NotImplementedError
14
+
15
+ if TYPE_CHECKING:
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ # Maintain dependencies for GitHub Actions
4
+ - package-ecosystem: "github-actions"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
@@ -0,0 +1,33 @@
1
+ name: containerised
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ docker:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout
16
+ uses: actions/checkout@v3
17
+ - name: Set up QEMU
18
+ uses: docker/setup-qemu-action@v2
19
+ - name: Set up Docker Buildx
20
+ uses: docker/setup-buildx-action@v2
21
+ - name: Login to GitHub container registry
22
+ uses: docker/login-action@v2
23
+ with:
24
+ registry: ghcr.io
25
+ username: ${{ github.actor }}
26
+ password: ${{ secrets.GITHUB_TOKEN }}
27
+ - name: Build and push
28
+ uses: docker/build-push-action@v4
29
+ with:
30
+ context: .
31
+ push: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx' && github.ref_name == 'main' }}
32
+ tags: ghcr.io/diracgrid/diracx/server:latest
33
+ platforms: linux/amd64,linux/arm64
@@ -0,0 +1,135 @@
1
+ name: Deployment
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+ inputs:
8
+ check-ci:
9
+ description: "Require the CI to have passed for this commit"
10
+ required: true
11
+ default: "yes"
12
+ version:
13
+ description: "Override the release version number (e.g. 8.0.0a5)"
14
+
15
+ jobs:
16
+ deploy-pypi:
17
+ name: PyPI deployment
18
+ runs-on: "ubuntu-latest"
19
+ if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx'
20
+ permissions:
21
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing on pypi
22
+ actions: write
23
+ checks: write
24
+ contents: write
25
+ deployments: write
26
+ discussions: write
27
+ issues: write
28
+ packages: write
29
+ pages: write
30
+ pull-requests: write
31
+ repository-projects: write
32
+ security-events: write
33
+ statuses: write
34
+ defaults:
35
+ run:
36
+ # We need extglob for REFERENCE_BRANCH substitution
37
+ shell: bash -l -O extglob {0}
38
+ steps:
39
+ - uses: actions/checkout@v3
40
+ with:
41
+ token: ${{ github.token }}
42
+ - run: |
43
+ git fetch --prune --unshallow
44
+ git config --global user.email "ci@diracgrid.org"
45
+ git config --global user.name "DIRACGrid CI"
46
+ - uses: actions/setup-python@v4
47
+ with:
48
+ python-version: '3.11'
49
+ - name: Installing dependencies
50
+ run: |
51
+ python -m pip install \
52
+ build \
53
+ python-dateutil \
54
+ pytz \
55
+ readme_renderer[md] \
56
+ requests \
57
+ setuptools_scm
58
+ - name: Validate README for PyPI
59
+ run: |
60
+ python -m readme_renderer README.md -o /tmp/README.html
61
+ - name: Prepare release notes
62
+ run: |
63
+ set -xeuo pipefail
64
+ IFS=$'\n\t'
65
+ # Needed for the advanced patter matching used in REFERENCE_BRANCH
66
+ PREV_VERSION=$(git describe --tags --abbrev=0)
67
+ # In case of manual trigger,
68
+ # GITHUB_REF is of the form refs/heads/main -> we want main
69
+ # In case of PR it is of the form refs/pull/59/merge -> we want pull/59/merge
70
+ REFERENCE_BRANCH=${GITHUB_REF##refs*(/heads)/}
71
+ echo "Making release notes for ${REFERENCE_BRANCH} since ${PREV_VERSION}"
72
+ (git log ${PREV_VERSION}...${REFERENCE_BRANCH} --oneline --no-merges --) > release.notes.new
73
+ cat release.notes.new
74
+ - name: Create tag if required
75
+ id: check-tag
76
+ run: |
77
+ set -xeuo pipefail
78
+ IFS=$'\n\t'
79
+ # Only do a real release for workflow_dispatch events
80
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
81
+ echo "Will create a real release"
82
+ export NEW_VERSION="v${{ github.event.inputs.version }}"
83
+ if [[ "${NEW_VERSION}" == "v" ]]; then
84
+ # If version wasn't given as an input to the workflow, use setuptools_scm to guess while removing "dev" portion of the version number
85
+ NEW_VERSION=v$(python -m setuptools_scm | sed 's@Guessed Version @@g' | sed -E 's@(\.dev|\+g).+@@g')
86
+ export NEW_VERSION
87
+ fi
88
+ echo "Release will be named $NEW_VERSION"
89
+ # Validate the version
90
+ # Ensure the version doesn't look like a PEP-440 "dev release" (which might happen if the automatic version bump has issues)
91
+ python -c $'from packaging.version import Version; v = Version('"'$NEW_VERSION'"$')\nif v.is_devrelease:\n raise ValueError(v)'
92
+ # Make sure we always only create pre-releases
93
+ python -c $'from packaging.version import Version; v = Version('"'$NEW_VERSION'"$')\nif not v.is_prerelease:\n raise ValueError("integration should only be used for pre-releases")'
94
+ # Commit the release notes
95
+ mv release.notes release.notes.old
96
+ cat release.notes.old
97
+ (echo -e "[${NEW_VERSION}]" && cat release.notes.new release.notes.old) > release.notes
98
+ ###################3
99
+ # TODO: we should add the release notes somewhere at some point
100
+ # now we just don't do it because main branch is protected
101
+ # and we can't push directly from the CI
102
+ #git add release.notes
103
+ #git commit -m "docs: Add release notes for $NEW_VERSION"
104
+ # Stash is mandatory not to leave the repo dirty
105
+ git stash
106
+ ########################
107
+ git show
108
+ # Create the tag
109
+ git tag "$NEW_VERSION"
110
+ echo "create-release=true" >> $GITHUB_OUTPUT
111
+ echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
112
+ fi
113
+ - name: Build distributions
114
+ run: |
115
+ python -m build
116
+ - name: Make release on GitHub
117
+ if: steps.check-tag.outputs.create-release == 'true'
118
+ run: |
119
+ set -e
120
+ export NEW_VERSION=${{ steps.check-tag.outputs.new-version }}
121
+ REFERENCE_BRANCH=${GITHUB_REF##refs*(/heads)/}
122
+ echo "Pushing tagged release notes to ${REFERENCE_BRANCH}"
123
+ git push "origin" "${REFERENCE_BRANCH}"
124
+ echo "Making GitHub release for ${NEW_VERSION}"
125
+ .github/workflows/make_release.py \
126
+ --repo="${{ github.repository }}" \
127
+ --token="${{ secrets.GITHUB_TOKEN }}" \
128
+ --version="${NEW_VERSION}" \
129
+ --rev="$(git rev-parse HEAD)" \
130
+ --release-notes-fn="release.notes.new"
131
+ # Use trusted publisher for pypi
132
+ # https://docs.pypi.org/trusted-publishers/
133
+ - name: Publish package on PyPI
134
+ if: steps.check-tag.outputs.create-release == 'true'
135
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,53 @@
1
+ name: Integration Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ defaults:
12
+ run:
13
+ shell: bash -el {0}
14
+
15
+ jobs:
16
+ dirac-integration-tests:
17
+ name: DIRAC Integration tests
18
+ if: github.repository == 'DIRACGrid/diracx'
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ dirac-branch:
24
+ - integration
25
+ steps:
26
+ - uses: actions/checkout@v3
27
+ - uses: actions/setup-python@v4
28
+ with:
29
+ python-version: '3.11'
30
+ - name: Prepare environment
31
+ run: |
32
+ pip install typer pyyaml gitpython packaging
33
+ git clone https://github.com/DIRACGrid/DIRAC.git -b "${{ matrix.dirac-branch }}" /tmp/DIRACRepo
34
+ # We need to cd in the directory for the integration_tests.py to work
35
+ - name: Prepare environment
36
+ run: cd /tmp/DIRACRepo && ./integration_tests.py prepare-environment "TEST_DIRACX=Yes" --extra-module "diracx=${GITHUB_WORKSPACE}"
37
+ - name: Install server
38
+ run: cd /tmp/DIRACRepo && ./integration_tests.py install-server
39
+ - name: Install client
40
+ run: cd /tmp/DIRACRepo && ./integration_tests.py install-client
41
+ - name: Server tests
42
+ run: cd /tmp/DIRACRepo && ./integration_tests.py test-server || touch server-tests-failed
43
+ - name: Client tests
44
+ run: cd /tmp/DIRACRepo && ./integration_tests.py test-client || touch client-tests-failed
45
+ - name: diracx logs
46
+ run: docker logs diracx
47
+ - name: Check test status
48
+ run: |
49
+ has_error=0
50
+ # TODO: set has_error=1 when we are ready to really run the tests
51
+ if [ -f server-tests-failed ]; then has_error=0; echo "Server tests failed"; fi
52
+ if [ -f client-tests-failed ]; then has_error=0; echo "Client tests failed"; fi
53
+ if [ ${has_error} = 1 ]; then exit 1; fi
@@ -0,0 +1,54 @@
1
+ name: Basic Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+
12
+ defaults:
13
+ run:
14
+ shell: bash -el {0}
15
+
16
+ jobs:
17
+ pytest:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - name: Checkout code
21
+ uses: actions/checkout@v3
22
+ - uses: mamba-org/setup-micromamba@v1
23
+ with:
24
+ environment-file: environment.yml
25
+ init-shell: bash
26
+ post-cleanup: 'all'
27
+ - name: Set up environment
28
+ run: |
29
+ pip install pytest-github-actions-annotate-failures
30
+ pip install git+https://github.com/DIRACGrid/DIRAC.git@integration
31
+ pip install .
32
+ - name: Run pytest
33
+ run: |
34
+ pytest . --cov-report=xml:coverage.xml --junitxml=report.xml
35
+ - name: Upload coverage report
36
+ uses: codecov/codecov-action@v3.1.4
37
+
38
+ mypy:
39
+ runs-on: ubuntu-latest
40
+ steps:
41
+ - name: Checkout code
42
+ uses: actions/checkout@v3
43
+ - uses: mamba-org/setup-micromamba@v1
44
+ with:
45
+ environment-file: environment.yml
46
+ init-shell: bash
47
+ post-cleanup: 'all'
48
+ - name: Set up environment
49
+ run: |
50
+ pip install git+https://github.com/DIRACGrid/DIRAC.git@integration
51
+ pip install .
52
+ - name: Run mypy
53
+ run: |
54
+ mypy .
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env python
2
+ import argparse
3
+ from pathlib import Path
4
+
5
+ import requests
6
+ from packaging.version import Version
7
+
8
+
9
+ def make_release(version, commit_hash, release_notes=""):
10
+ """Create a new GitHub release using the given data
11
+
12
+ This function always makes a pre-release first to ensure the "latest" release never corresponds
13
+ to one without artifacts uploaded. If the new version number is not a pre-release, as
14
+ determined by PEP-440, it is promoted to at full release after the uploads have completed
15
+ successfully.
16
+
17
+ :param str version: The version of the new release
18
+ :param str commit_hash: Git revision used for the release
19
+ :param str release_notes: Release notes
20
+ """
21
+ # Create a draft release
22
+ r = requests.post(
23
+ f"{api_root}/releases",
24
+ json={
25
+ "tag_name": version,
26
+ "target_commitish": commit_hash,
27
+ "body": release_notes,
28
+ "draft": True,
29
+ "prerelease": Version(version).is_prerelease,
30
+ },
31
+ headers=headers,
32
+ )
33
+ r.raise_for_status()
34
+ release_data = r.json()
35
+ print(f"Created draft release at: {release_data['html_url']}")
36
+
37
+ # Publish the release
38
+ r = requests.patch(
39
+ release_data["url"],
40
+ json={
41
+ "draft": False,
42
+ },
43
+ headers=headers,
44
+ )
45
+ r.raise_for_status()
46
+ release_data = r.json()
47
+ print(f"Published release at: {release_data['html_url']}")
48
+
49
+
50
+ if __name__ == "__main__":
51
+ parser = argparse.ArgumentParser()
52
+ parser.add_argument("--token", required=True)
53
+ parser.add_argument("--repo", default="DIRACGrid/DIRAC")
54
+ parser.add_argument("--version", required=True)
55
+ parser.add_argument("--rev", required=True)
56
+ parser.add_argument("--release-notes-fn", required=True)
57
+ args = parser.parse_args()
58
+
59
+ token = args.token
60
+ headers = {
61
+ "Accept": "application/vnd.github.v3+json",
62
+ "Authorization": f"token {token}",
63
+ }
64
+ api_root = f"https://api.github.com/repos/{args.repo}"
65
+ release_notes = Path(args.release_notes_fn).read_text()
66
+
67
+ if not args.version.startswith("v"):
68
+ raise ValueError('For consistency versions must start with "v"')
69
+
70
+ make_release(args.version, args.rev, release_notes=release_notes)
@@ -0,0 +1,92 @@
1
+ # Python
2
+ *.py[cod]
3
+
4
+ # Conda
5
+ .conda
6
+
7
+ # C extensions
8
+ *.so
9
+ var
10
+ sdist
11
+ lib
12
+ lib64
13
+
14
+ # Packages
15
+ *.egg
16
+ *.egg-info
17
+ dist
18
+ build
19
+ eggs
20
+ parts
21
+ bin
22
+ develop-eggs
23
+ .installed.cfg
24
+
25
+ # Translations
26
+ *.mo
27
+
28
+ # Mr Developer
29
+ .mr.developer.cfg
30
+
31
+ # Installer logs
32
+ pip-log.txt
33
+
34
+ # Unit test / coverage reports
35
+ .coverage
36
+ .tox
37
+ .ruff_cache
38
+ .mypy_cache
39
+
40
+ # Eclipse
41
+ .project
42
+ .pydevproject
43
+ .pyproject
44
+ .settings
45
+ .metadata
46
+
47
+ #VSCode
48
+ .vscode
49
+ .env
50
+
51
+ # Vim
52
+ .*.sw[a-z]
53
+ *.un~
54
+ Session.vim
55
+ *~
56
+
57
+ # Intellij
58
+ .idea/
59
+ LHCbDIRAC.iml
60
+
61
+ # MaxOSX files
62
+ .DS_Store
63
+
64
+ # test stuff
65
+ .pytest_cache
66
+ .cache
67
+ __pycache__
68
+ pytests.xml
69
+ nosetests.xml
70
+ coverage.xml
71
+ Local_*
72
+ .hypothesis
73
+ *.gz
74
+ htmlcov/
75
+ *.xml.temp
76
+
77
+ #remove in case we want a specific LHCb one
78
+ .pylintrc
79
+
80
+ # docs
81
+ # this is auto generated
82
+ docs/source/CodeDocumentation/
83
+ docs/source/AdministratorGuide/Configuration/ExampleConfig.rst
84
+ docs/source/AdministratorGuide/CommandReference
85
+ docs/source/UserGuide/CommandReference
86
+ docs/_build
87
+ docs/source/_build
88
+
89
+
90
+ # CMT junk
91
+ /*/*/x86_64-*-*-*/
92
+ */*/cmt/Makefile
@@ -0,0 +1,45 @@
1
+ .defaults:
2
+ only:
3
+ - merge_requests
4
+ - master@chaen/chrissquare-hack-a-ton
5
+
6
+ .defaults-micromamba:
7
+ extends: .defaults
8
+ image: registry.cern.ch/docker.io/mambaorg/micromamba
9
+ before_script:
10
+ - micromamba env create --file environment.yml --name test-env
11
+ - eval "$(micromamba shell hook --shell=bash)"
12
+ - micromamba activate test-env
13
+ - pip install git+https://github.com/DIRACGrid/DIRAC.git@integration
14
+ - pip install .
15
+
16
+ pre-commit:
17
+ extends: .defaults
18
+ image: registry.cern.ch/docker.io/library/python:3.11
19
+ variables:
20
+ PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
21
+ cache:
22
+ paths:
23
+ - ${PRE_COMMIT_HOME}
24
+ before_script:
25
+ - pip install pre-commit
26
+ script:
27
+ - pre-commit run --all-files
28
+
29
+ pytest:
30
+ extends: .defaults-micromamba
31
+ script:
32
+ - pytest . --cov-report=xml:coverage.xml --junitxml=report.xml
33
+ coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
34
+ artifacts:
35
+ when: always
36
+ reports:
37
+ junit: report.xml
38
+ coverage_report:
39
+ coverage_format: cobertura
40
+ path: coverage.xml
41
+
42
+ mypy:
43
+ extends: .defaults-micromamba
44
+ script:
45
+ - mypy .
@@ -0,0 +1,36 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ default_language_version:
4
+ python: python3
5
+
6
+ repos:
7
+ - repo: https://github.com/pre-commit/pre-commit-hooks
8
+ rev: v4.4.0
9
+ hooks:
10
+ - id: trailing-whitespace
11
+ - id: end-of-file-fixer
12
+ - id: check-yaml
13
+ - id: check-added-large-files
14
+
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: 'v0.0.287'
17
+ hooks:
18
+ - id: ruff
19
+ args: ["--fix"]
20
+
21
+ - repo: https://github.com/psf/black
22
+ rev: 23.7.0
23
+ hooks:
24
+ - id: black
25
+
26
+ - repo: https://github.com/pre-commit/mirrors-mypy
27
+ rev: v1.5.1
28
+ hooks:
29
+ - id: mypy
30
+ additional_dependencies:
31
+ - pydantic==1.10.10
32
+ - sqlalchemy
33
+ - types-PyYAML
34
+ - types-cachetools
35
+ - types-requests
36
+ exclude: ^(src/diracx/client/|tests/|build)
@@ -0,0 +1,41 @@
1
+ #TODO: replace with micromamba
2
+ FROM registry.cern.ch/docker.io/mambaorg/micromamba
3
+ EXPOSE 8000
4
+
5
+ # Create empty directory for the various volume to be mounted
6
+ # and assign them to mambauser
7
+ # This is needed for the DIRAC integration test, as docker-compose
8
+ # isn't playing well with permissions and volumes
9
+ USER root
10
+ RUN mkdir /cs_store /signing-key && chown $MAMBA_USER:$MAMBA_USER /cs_store /signing-key
11
+ USER $MAMBA_USER
12
+
13
+ WORKDIR /code
14
+
15
+ COPY --chown=$MAMBA_USER:$MAMBA_USER . /code/diracx
16
+
17
+ # openssh is needed for ssh-keygen when we generate signing key
18
+ RUN micromamba install --yes --file diracx/environment.yml --name=base git openssh && micromamba clean --all --yes
19
+
20
+ ARG MAMBA_DOCKERFILE_ACTIVATE=1
21
+
22
+ RUN pip install ./diracx git+https://github.com/DIRACGrid/DIRAC.git@integration
23
+ # Copying in ENTRYPOINT script
24
+ COPY --chown=$MAMBA_USER:$MAMBA_USER dockerEntrypoint.sh /
25
+ RUN chmod 755 /dockerEntrypoint.sh
26
+
27
+ # Copying the mamba specific entrypoint with lower ulimit
28
+ COPY --chown=$MAMBA_USER:$MAMBA_USER dockerMicroMambaEntrypoint.sh /
29
+ RUN chmod 755 /dockerMicroMambaEntrypoint.sh
30
+
31
+ ENTRYPOINT [ "/dockerEntrypoint.sh" ]
32
+
33
+
34
+
35
+
36
+ # activate mamba for run commands
37
+ # RUN pip install ./diracx
38
+
39
+ # CMD ["uvicorn", "--factory", "diracx.routers:create_app", "--host", "0.0.0.0", "--port", "8000"]
40
+
41
+ # "--reload-dir", "/opt/conda/lib/python3.11/site-packages/diracx", "--reload"