Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2f0ac9b
feat: Check existance of __all__ in __init__ files during pre-commit
AcquaDiGiorgio Feb 4, 2026
e4da761
fix: Fix hook, it always failed and executed multiple times
AcquaDiGiorgio Feb 5, 2026
66993a9
chore: Check gubbins extension during the check-init-files precommit …
AcquaDiGiorgio Feb 6, 2026
e1f4dcb
chore: Change check-init-files hook from sh to python
AcquaDiGiorgio Feb 9, 2026
2c84b47
chore: Use ast for __all__ checks
AcquaDiGiorgio Feb 9, 2026
8e670c8
chore: move pre-commit scripts from .github/workflows to scripts
AcquaDiGiorgio Feb 9, 2026
bd06203
chore: update imports and __init__ files at diracx and gubbins
AcquaDiGiorgio Feb 24, 2026
cbdab61
chore: remove unused routers/jobs/legacy.py file
AcquaDiGiorgio Apr 10, 2026
2791005
chore: remove diracx/routers/__init__.py imports
AcquaDiGiorgio Apr 10, 2026
6a49bdf
chore: Add the rest of the properties to the public API
AcquaDiGiorgio Apr 10, 2026
ba7f3c7
chore: Remove pydatic Field being imported from diracx
AcquaDiGiorgio Apr 10, 2026
cb5be6f
chore: Remove BaseModel from the public API
AcquaDiGiorgio Apr 10, 2026
aa051de
chore: Add 'open_access' to access_policies __all__
AcquaDiGiorgio Apr 14, 2026
409e514
chore: empty __all__ from diracx/client/__init__.py
AcquaDiGiorgio Apr 14, 2026
15d4287
fix: Revert wrongly imported router from diracx
AcquaDiGiorgio Apr 14, 2026
e6c8984
chore(docs): Update codeconv to showcase __all__ treatment
AcquaDiGiorgio Apr 14, 2026
86d152a
fix(routers): change wrong import in entrypoints
AcquaDiGiorgio Apr 16, 2026
1e9379e
feat: add conftest to diracx
AcquaDiGiorgio Apr 16, 2026
ed11d95
chore: update pixi.lock
AcquaDiGiorgio Apr 16, 2026
4c66dae
fix: remove diracx-testing import changes
AcquaDiGiorgio Apr 16, 2026
e1935d0
chore: update newly added __init__.py files
AcquaDiGiorgio Apr 16, 2026
4dd2148
chore: set shebang for moved python scripts
AcquaDiGiorgio Apr 16, 2026
e2de73b
chore: remove check-init-files hook from ci
AcquaDiGiorgio Apr 16, 2026
cf2d408
chore: change charts to fork (temporary)
AcquaDiGiorgio Apr 28, 2026
53b4db6
chore: change DIRAC to fork (temporary)
AcquaDiGiorgio Apr 30, 2026
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: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Clone DIRAC
run: |
pip install typer pyyaml gitpython packaging
git clone https://github.com/DIRACGrid/DIRAC.git -b "${{ matrix.dirac-branch }}" /tmp/DIRACRepo
git clone https://github.com/AcquaDiGiorgio/DIRAC.git -b "diracx-issue-426-__all__-in-__init__" /tmp/DIRACRepo
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert the changes here please?

echo "Current revision: $(git -C /tmp/DIRACRepo rev-parse HEAD)"
- name: Prepare environment
run: cd /tmp/DIRACRepo && ./integration_tests.py prepare-environment "TEST_DIRACX=Yes" --diracx-src-dir "${GITHUB_WORKSPACE}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ jobs:
docker image ls -a
- name: Start demo
run: |
git clone https://github.com/DIRACGrid/diracx-charts.git ../diracx-charts
git clone -b "diracx-issue-426-__all__-in-__init__" https://github.com/AcquaDiGiorgio/diracx-charts.git ../diracx-charts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


declare -a demo_args=()
demo_args+=("--enable-open-telemetry")
Expand Down
13 changes: 11 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ default_language_version:
python: python3

ci:
skip: [generate-pixi-docs, settings-doc-check]
skip: [generate-pixi-docs, settings-doc-check, check-init-files]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to ignore that check in the CI.
What if you run with language: python and entry: python ... instead? You can mention that during Ddev to see what other devs think about that


default_stages: [pre-commit]

Expand Down Expand Up @@ -90,7 +90,7 @@ repos:
hooks:
- id: generate-pixi-docs
name: Generate pixi tasks documentation
entry: pixi run -e default python .github/workflows/generate_pixi_tasks_doc.py
entry: pixi run -e default python scripts/generate_pixi_tasks_doc.py
language: system
pass_filenames: false
files: ^pixi\.toml$|^pixi\.lock$ # only run if pixi files change
Expand All @@ -103,3 +103,12 @@ repos:
language: system
pass_filenames: false
files: ^(diracx-.*/src/diracx/.*/settings\.py|diracx-routers/src/diracx/routers/otel\.py|docs/.*\.j2|docs/templates/.*\.jinja|scripts/generate_settings_docs\.py)$

- repo: local
hooks:
- id: check-init-files
name: Check __all__ dunder in __init__.py files
language: system
entry: pixi run -e default python scripts/check_init_files_precommit_hook.py
files: ^(diracx-|extensions/gubbins/gubbins-).*__init__\.py$
exclude: _generated
4 changes: 1 addition & 3 deletions diracx-api/src/diracx/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

__all__ = ("jobs",)

from . import jobs
__all__ = []
2 changes: 1 addition & 1 deletion diracx-api/src/diracx/api/jobs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

__all__ = ("create_sandbox", "download_sandbox")
__all__ = ["create_sandbox", "download_sandbox"]

import hashlib
import logging
Expand Down
2 changes: 1 addition & 1 deletion diracx-api/src/diracx/api/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

__all__ = ("with_client",)
__all__ = ["with_client"]

from functools import wraps

Expand Down
5 changes: 2 additions & 3 deletions diracx-cli/src/diracx/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from __future__ import annotations

__all__ = ["app"]

from diracx.core.extensions import DiracEntryPoint, select_from_extension

from .auth import app

__all__ = ("app",)


# Load all the sub commands
cli_names = set(
[
Expand Down
2 changes: 1 addition & 1 deletion diracx-cli/src/diracx/cli/auth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

__all__ = ("app",)
__all__ = ["app"]

import asyncio
import json
Expand Down
2 changes: 1 addition & 1 deletion diracx-cli/src/diracx/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# from __future__ import annotations
from __future__ import annotations

__all__ = ("dump",)
__all__ = ["dump"]

import json

Expand Down
4 changes: 2 additions & 2 deletions diracx-cli/src/diracx/cli/internal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

__all__ = ["app"]

from . import legacy
from .config import app

__all__ = ("app",)

app.add_typer(legacy.app, name="legacy")
5 changes: 3 additions & 2 deletions diracx-cli/src/diracx/cli/internal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import yaml
from pydantic import TypeAdapter

from diracx.core.config import ConfigSource, ConfigSourceUrl
from diracx.core.config.schema import (
from diracx.core.config import (
Config,
ConfigSource,
ConfigSourceUrl,
DIRACConfig,
GroupConfig,
IdpConfig,
Expand Down
5 changes: 2 additions & 3 deletions diracx-cli/src/diracx/cli/internal/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
if TYPE_CHECKING:
from diraccfg.cfg import CFGAsDict

from pydantic import BaseModel
from pydantic import BaseModel, Field
from typer import Option

from diracx.core.config import Config
from diracx.core.config.schema import Field, SupportInfo
from diracx.core.config import Config, SupportInfo
from diracx.core.extensions import DiracEntryPoint, select_from_extension

from ..utils import AsyncTyper
Expand Down
4 changes: 2 additions & 2 deletions diracx-cli/src/diracx/cli/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# from __future__ import annotations
from __future__ import annotations

__all__ = ("app",)
__all__ = ["app"]

import json
import re
Expand All @@ -13,7 +13,7 @@
from typer import FileText, Option

from diracx.client.aio import AsyncDiracClient
from diracx.core.models.search import (
from diracx.core.models import (
ScalarSearchOperator,
SearchSpec,
VectorSearchOperator,
Expand Down
2 changes: 1 addition & 1 deletion diracx-cli/src/diracx/cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

__all__ = ("AsyncTyper",)
__all__ = ["AsyncTyper"]

from asyncio import run
from functools import wraps
Expand Down
3 changes: 3 additions & 0 deletions diracx-cli/tests/legacy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from __future__ import annotations

__all__ = []
3 changes: 3 additions & 0 deletions diracx-cli/tests/legacy/cs_sync/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from __future__ import annotations

__all__ = []
2 changes: 1 addition & 1 deletion diracx-cli/tests/legacy/cs_sync/test_cssync.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typer.testing import CliRunner

from diracx.cli import app
from diracx.core.config.schema import Config
from diracx.core.config import Config

runner = CliRunner()

Expand Down
2 changes: 1 addition & 1 deletion diracx-cli/tests/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


async def test_login(monkeypatch, capfd, cli_env):
from diracx.testing import test_login
from diracx.testing.utils import test_login

return await test_login(monkeypatch, capfd, cli_env)

Expand Down
14 changes: 1 addition & 13 deletions diracx-client/src/diracx/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
from __future__ import absolute_import

__all__ = [
"aio",
"models",
"sync",
]

from typing import TYPE_CHECKING


if TYPE_CHECKING:
from . import aio
from . import models
from . import sync
__all__ = []
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/patches/auth/aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from azure.core.pipeline import PipelineResponse
from azure.core.tracing.decorator_async import distributed_trace_async
from diracx.core.models.auth import TokenResponse
from diracx.core.models import TokenResponse

from ..._generated.aio.operations._operations import (
_models,
Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/patches/client/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import jwt
from azure.core.credentials import AccessToken
from diracx.core.utils import EXPIRES_GRACE_SECONDS, serialize_credentials
from diracx.core.models.auth import TokenResponse
from diracx.core.models import TokenResponse


class TokenStatus(Enum):
Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/patches/jobs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from io import BytesIO, IOBase
from typing import Any, IO, Dict, TypedDict, Union, Unpack, cast, Literal

from diracx.core.models.search import SearchSpec
from diracx.core.models import SearchSpec


class ResponseExtra(TypedDict, total=False):
Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/patches/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from azure.core.pipeline import PipelineRequest
from azure.core.pipeline.policies import BearerTokenCredentialPolicy

from diracx.core.models.auth import TokenResponse
from diracx.core.models import TokenResponse
from diracx.core.preferences import DiracxPreferences, get_diracx_preferences


Expand Down
2 changes: 1 addition & 1 deletion diracx-client/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from azure.core.credentials import AccessToken

from diracx.client.patches.utils import get_token
from diracx.core.models.auth import TokenResponse
from diracx.core.models import TokenResponse
from diracx.core.utils import serialize_credentials

# Create a fake jwt dictionary
Expand Down
3 changes: 3 additions & 0 deletions diracx-core/src/diracx/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from __future__ import annotations

__all__ = []
40 changes: 30 additions & 10 deletions diracx-core/src/diracx/core/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,40 @@

from __future__ import annotations

from .schema import Config
from .sources import (
ConfigSource,
ConfigSourceUrl,
LocalGitConfigSource,
RemoteGitConfigSource,
is_running_in_async_context,
)

__all__ = (
__all__ = [
# Schema
"Config",
"DIRACConfig",
"GroupConfig",
"IdpConfig",
"OperationsConfig",
"RegistryConfig",
"SerializableSet",
"SupportInfo",
"UserConfig",
# Sources
"ConfigSource",
"ConfigSourceUrl",
"LocalGitConfigSource",
"RemoteGitConfigSource",
"is_running_in_async_context",
]

from .schema import (
Config,
DIRACConfig,
GroupConfig,
IdpConfig,
OperationsConfig,
RegistryConfig,
SerializableSet,
SupportInfo,
UserConfig,
)
from .sources import (
ConfigSource,
ConfigSourceUrl,
LocalGitConfigSource,
RemoteGitConfigSource,
is_running_in_async_context,
)
4 changes: 2 additions & 2 deletions diracx-core/src/diracx/core/config/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
)
from pydantic.functional_serializers import PlainSerializer

from ..properties import SecurityProperty
from ..utils import recursive_merge
from diracx.core.properties import SecurityProperty
from diracx.core.utils import recursive_merge

# By default the serialization of set doesn't have a well defined ordering so
# we have to use a custom type to make sure the values are always sorted.
Expand Down
7 changes: 4 additions & 3 deletions diracx-core/src/diracx/core/config/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
from cachetools import Cache, LRUCache
from pydantic import AnyUrl, BeforeValidator, TypeAdapter, UrlConstraints

from ..exceptions import BadConfigurationVersionError
from ..extensions import DiracEntryPoint, select_from_extension
from ..utils import TwoLevelCache
from diracx.core.exceptions import BadConfigurationVersionError
from diracx.core.extensions import DiracEntryPoint, select_from_extension
from diracx.core.utils import TwoLevelCache

from .schema import Config

DEFAULT_CONFIG_FILE = "default.yml"
Expand Down
16 changes: 16 additions & 0 deletions diracx-core/src/diracx/core/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
from __future__ import annotations

__all__ = [
"AuthorizationError",
"DiracError",
"DiracHttpResponseError",
"IAMClientError",
"IAMServerError",
"InvalidCredentialsError",
"InvalidQueryError",
"NotReadyError",
"PendingAuthorizationError",
"SandboxAlreadyAssignedError",
"SandboxAlreadyInsertedError",
"SandboxNotFoundError",
"TokenNotFoundError",
]

from http import HTTPStatus


Expand Down
Loading
Loading