Skip to content

Commit

Permalink
Move pants.backend.explorer -> pants.explorer.server due to being…
Browse files Browse the repository at this point in the history
… in a dedicated distribution. (pantsbuild#17602)
  • Loading branch information
kaos authored Nov 22, 2022
1 parent 89d686f commit a21d8cb
Show file tree
Hide file tree
Showing 21 changed files with 28 additions and 33 deletions.
2 changes: 1 addition & 1 deletion build-support/bin/_release_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
# Disable the explorer backend, as that is packaged into a dedicated Python distribution and thus
# not included in the pex either.
DISABLED_BACKENDS_CONFIG = {
"PANTS_BACKEND_PACKAGES": '-["internal_plugins.test_lockfile_fixtures", "pants.backend.explorer"]',
"PANTS_BACKEND_PACKAGES": '-["internal_plugins.test_lockfile_fixtures", "pants.explorer.server"]',
}


Expand Down
2 changes: 1 addition & 1 deletion pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ backend_packages.add = [
"pants.backend.build_files.fmt.black",
"pants.backend.python",
"pants.backend.experimental.python.packaging.pyoxidizer",
"pants.backend.explorer",
"pants.backend.python.lint.autoflake",
"pants.backend.python.lint.black",
"pants.backend.python.lint.docformatter",
Expand All @@ -31,6 +30,7 @@ backend_packages.add = [
"pants.backend.experimental.scala.lint.scalafmt",
"pants.backend.experimental.scala.debug_goals",
"pants.backend.experimental.visibility",
"pants.explorer.server",
"internal_plugins.releases",
"internal_plugins.test_lockfile_fixtures",
]
Expand Down
4 changes: 0 additions & 4 deletions src/python/pants/backend/explorer/server/BUILD

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ python_distribution(
),
entry_points={
"pantsbuild.plugin": {
"rules": "pants.backend.explorer.register:rules",
"rules": "pants.explorer.server.register:rules",
}
},
)

python_tests(
name="tests",
dependencies=[":explorer"],
dependencies=[":server"],
)


Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from strawberry.types import Info

from pants.backend.explorer.server.uvicorn import UvicornServer
from pants.engine.explorer import RequestState
from pants.explorer.server.uvicorn import UvicornServer


@dataclass(frozen=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import pytest

from pants.backend.docker.target_types import DockerImageTarget
from pants.backend.explorer.graphql.rules import rules
from pants.backend.explorer.graphql.setup import create_schema
from pants.backend.project_info import peek
from pants.engine.environment import EnvironmentName
from pants.engine.explorer import RequestState
from pants.engine.target import RegisteredTargetTypes
from pants.engine.unions import UnionMembership
from pants.explorer.server.graphql.rules import rules
from pants.explorer.server.graphql.setup import create_schema
from pants.help.help_info_extracter import AllHelpInfo, HelpInfoExtracter
from pants.testutil.rule_runner import RuleRunner

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import strawberry

from pants.backend.explorer.graphql.query.rules import QueryRulesMixin
from pants.backend.explorer.graphql.query.targets import QueryTargetsMixin
from pants.explorer.server.graphql.query.rules import QueryRulesMixin
from pants.explorer.server.graphql.query.targets import QueryTargetsMixin


@strawberry.type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import strawberry
from strawberry.types import Info

from pants.backend.explorer.graphql.context import GraphQLContext
from pants.explorer.server.graphql.context import GraphQLContext
from pants.help import help_info_extracter


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
{"name": r"\.explorer\."},
{
"rules": [
{"name": "pants.backend.explorer.graphql.rules.get_graphql_uvicorn_setup"},
{"name": "pants.explorer.server.graphql.rules.get_graphql_uvicorn_setup"},
]
},
),
(
{"name": r"\.graphql\."},
{
"rules": [
{"name": "pants.backend.explorer.graphql.rules.get_graphql_uvicorn_setup"},
{"name": "pants.explorer.server.graphql.rules.get_graphql_uvicorn_setup"},
]
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import strawberry
from strawberry.types import Info

from pants.backend.explorer.graphql.context import GraphQLContext
from pants.backend.explorer.graphql.field_types import JSONScalar
from pants.backend.project_info.peek import TargetData, TargetDatas
from pants.base.specs_parser import SpecsParser
from pants.engine.target import AllUnexpandedTargets, UnexpandedTargets
from pants.explorer.server.graphql.context import GraphQLContext
from pants.explorer.server.graphql.field_types import JSONScalar
from pants.help.help_info_extracter import TargetTypeHelpInfo
from pants.util.strutil import softwrap

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

from __future__ import annotations

from pants.backend.explorer.browser import Browser, BrowserRequest
from pants.backend.explorer.graphql.setup import graphql_uvicorn_setup
from pants.backend.explorer.graphql.subsystem import GraphQLSubsystem
from pants.backend.explorer.server.uvicorn import UvicornServerSetup, UvicornServerSetupRequest
from pants.backend.project_info.peek import TargetDatas
from pants.base.specs import Specs
from pants.engine.environment import EnvironmentName
from pants.engine.rules import Get, QueryRule, collect_rules, rule
from pants.engine.target import AllUnexpandedTargets, UnexpandedTargets
from pants.engine.unions import UnionRule
from pants.explorer.server.browser import Browser, BrowserRequest
from pants.explorer.server.graphql.setup import graphql_uvicorn_setup
from pants.explorer.server.graphql.subsystem import GraphQLSubsystem
from pants.explorer.server.uvicorn import UvicornServerSetup, UvicornServerSetupRequest


class GraphQLUvicornServerSetupRequest(UvicornServerSetupRequest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
from starlette.responses import JSONResponse
from strawberry.fastapi import GraphQLRouter

from pants.backend.explorer.browser import Browser
from pants.backend.explorer.graphql.context import GraphQLContext
from pants.backend.explorer.graphql.query.root import Query
from pants.backend.explorer.graphql.subsystem import GraphQLSubsystem
from pants.backend.explorer.server.uvicorn import UvicornServer
from pants.backend.project_info.peek import _PeekJsonEncoder
from pants.explorer.server.browser import Browser
from pants.explorer.server.graphql.context import GraphQLContext
from pants.explorer.server.graphql.query.root import Query
from pants.explorer.server.graphql.subsystem import GraphQLSubsystem
from pants.explorer.server.uvicorn import UvicornServer


class ExplorerJSONResponse(JSONResponse):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
{
"data": {
"rules": [{"name": "pants.backend.explorer.server.uvicorn.create_server"}],
"rules": [{"name": "pants.explorer.server.uvicorn.create_server"}],
},
},
),
Expand All @@ -38,7 +38,7 @@ def test_explorer_graphql_query(query: dict, expected_result: dict) -> None:
with temporary_workdir() as workdir:
handle = run_pants_with_workdir_without_waiting(
[
"--backend-packages=['pants.backend.explorer']",
"--backend-packages=['pants.explorer.server']",
"--no-watch-filesystem",
"--no-dynamic-ui",
"experimental-explorer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

from __future__ import annotations

from pants.backend.explorer import browser
from pants.backend.explorer.graphql import rules as graphql
from pants.backend.explorer.server import uvicorn
from pants.explorer.server import browser, uvicorn
from pants.explorer.server.graphql import rules as graphql


def rules():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
from fastapi import FastAPI
from uvicorn import Config, Server # type: ignore

from pants.backend.explorer.browser import BrowserRequest
from pants.base.exiter import ExitCode
from pants.engine.environment import EnvironmentName
from pants.engine.explorer import ExplorerServer, ExplorerServerRequest, RequestState
from pants.engine.rules import Get, MultiGet, collect_rules, rule
from pants.engine.unions import UnionMembership, union
from pants.explorer.server.browser import BrowserRequest

logger = logging.getLogger(__name__)

Expand Down

0 comments on commit a21d8cb

Please sign in to comment.