Skip to content

Commit

Permalink
Rename antsibull module to antsibull_build.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Oct 13, 2024
1 parent c6c645c commit 123fbcf
Show file tree
Hide file tree
Showing 65 changed files with 77 additions and 61 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/antsibull-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ jobs:
antsibull_fileutils_ref: main

steps:
- name: Check out antsibull
- name: Check out antsibull-build
uses: actions/checkout@v4
with:
path: antsibull
path: antsibull-build

- name: Check out dependent project antsibull-changelog
uses: actions/checkout@v4
Expand Down Expand Up @@ -111,16 +111,20 @@ jobs:
- name: "Test building a release: ${{ matrix.name }}"
run: |
nox -e coverage_release -- ${{ matrix.options }}
working-directory: antsibull
env:
# Since antsibull was renamed to antsibull-build, paths during the bytecompile test
# are too long and bytecompile fails with "OSError: AF_UNIX path too long".
COVERAGE_RELEASE_FORCE_TMPDIR: /tmp
working-directory: antsibull-build

- name: Report coverage
run: |
nox -v -e coverage
working-directory: antsibull
working-directory: antsibull-build

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
working-directory: antsibull
working-directory: antsibull-build
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/nox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: antsibull
working-directory: antsibull-build
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -55,10 +55,10 @@ jobs:
packages: ""
name: "Run nox ${{ matrix.session }} session"
steps:
- name: Check out antsibull
- name: Check out antsibull-build
uses: actions/checkout@v4
with:
path: antsibull
path: antsibull-build
- name: Check out dependent project antsibull-core
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
if: ${{ matrix.codecov }}
uses: codecov/codecov-action@v4
with:
working-directory: antsibull
working-directory: antsibull-build
name: "${{ matrix.session }}"
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ github_checks:
annotations: false

fixes:
- "antsibull/::"
- "antsibull_build/::"
29 changes: 18 additions & 11 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test(session: nox.Session):
session.run(
"pytest",
"--cov-branch",
"--cov=antsibull",
"--cov=antsibull_build",
"--cov-report",
"term-missing",
*more_args,
Expand All @@ -102,9 +102,7 @@ def test(session: nox.Session):

@contextlib.contextmanager
def coverage_run(session: nox.Session) -> Iterator[tuple[str, dict[str, str]]]:
build_command = (
"coverage run -p --branch --source antsibull -m antsibull.cli.antsibull_build"
)
build_command = "coverage run -p --branch --source antsibull_build -m antsibull_build.cli.antsibull_build"
tmp = Path(session.create_tmp())
covfile = tmp / ".coverage"
cov_env = {"COVERAGE_FILE": f"{covfile}", **session.env}
Expand Down Expand Up @@ -145,6 +143,9 @@ def coverage_release(session: nox.Session):
"git+https://github.com/ansible-collections/community.general",
env={"ANSIBLE_COLLECTIONS_PATH": str(collections), **session.env},
)
tmp_env = {}
if os.environ.get("COVERAGE_RELEASE_FORCE_TMPDIR"):
tmp_env["TMPDIR"] = os.environ["COVERAGE_RELEASE_FORCE_TMPDIR"]
with coverage_run(session) as (build_command, cov_env):
session.run(
"ansible-playbook",
Expand All @@ -154,9 +155,11 @@ def coverage_release(session: nox.Session):
"-e",
f"antsibull_build_command={build_command!r}",
env={
"TMPDIR": "/tmp",
"ANSIBLE_COLLECTIONS_PATH": str(collections),
"ANSIBLE_CALLBACK_RESULT_FORMAT": "yaml",
**cov_env,
**tmp_env,
},
)

Expand Down Expand Up @@ -193,8 +196,8 @@ def formatters(session: nox.Session):
@nox.session
def codeqa(session: nox.Session):
install(session, ".[codeqa]", *other_antsibull(), editable=True)
session.run("flake8", "src/antsibull", *session.posargs)
session.run("pylint", "--rcfile", ".pylintrc.automated", "src/antsibull")
session.run("flake8", "src/antsibull_build", *session.posargs)
session.run("pylint", "--rcfile", ".pylintrc.automated", "src/antsibull_build")
session.run("reuse", "lint")
session.run("antsibull-changelog", "lint")

Expand All @@ -203,7 +206,7 @@ def codeqa(session: nox.Session):
def typing(session: nox.Session):
others = other_antsibull()
install(session, ".[typing]", *others)
session.run("mypy", "src/antsibull")
session.run("mypy", "src/antsibull_build")


@nox.session
Expand Down Expand Up @@ -252,7 +255,7 @@ def check_package_files(
"run",
"-p",
"--branch",
"--source=antsibull",
"--source=antsibull_build",
"tests/verify_package_files.py",
"check",
f"--data-dir={build_data / major}",
Expand Down Expand Up @@ -332,7 +335,11 @@ def bump(session: nox.Session):
with open(fragment_file, "w") as fp:
fp.write(fragment)
session.run(
"git", "add", "src/antsibull/__init__.py", str(fragment_file), external=True
"git",
"add",
"src/antsibull_build/__init__.py",
str(fragment_file),
external=True,
)
session.run("git", "commit", "-m", f"Prepare {version}.", external=True)
session.run("antsibull-changelog", "release")
Expand All @@ -345,7 +352,7 @@ def bump(session: nox.Session):
"changelogs/fragments/",
# src/antsibull/__init__.py is not committed in the last step
# when the release_summary fragment is created manually
"src/antsibull/__init__.py",
"src/antsibull_build/__init__.py",
external=True,
)
install(session, ".") # Smoke test
Expand All @@ -371,7 +378,7 @@ def publish(session: nox.Session):
install(session, "hatch")
session.run("hatch", "publish", *session.posargs)
session.run("hatch", "version", "post")
session.run("git", "add", "src/antsibull/__init__.py", external=True)
session.run("git", "add", "src/antsibull_build/__init__.py", external=True)
session.run("git", "commit", "-m", "Post-release version bump.", external=True)


Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ email = "[email protected]"
"Changelog" = "https://github.com/ansible-community/antsibull-build/tree/main/CHANGELOG.md"

[project.scripts]
antsibull-build = "antsibull.cli.antsibull_build:main"
antsibull-build = "antsibull_build.cli.antsibull_build:main"

[project.optional-dependencies]
# User-facing extras
Expand Down Expand Up @@ -118,10 +118,10 @@ dev = [
]

[tool.hatch.version]
path = "src/antsibull/__init__.py"
path = "src/antsibull_build/__init__.py"

[tool.hatch.build.targets.wheel]
packages = ["src/antsibull"]
packages = ["src/antsibull_build"]

[tool.isort]
profile = "black"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
from packaging.version import Version as PypiVer
from typing_extensions import TypedDict

from antsibull.constants import ANSIBLE_FORUM_URL, BUILD_DATA_URL
from antsibull.pypi import PyPIClient, SdistAndWheelPair, UrlInfo
from antsibull_build.constants import ANSIBLE_FORUM_URL, BUILD_DATA_URL
from antsibull_build.pypi import PyPIClient, SdistAndWheelPair, UrlInfo

try:
import pyperclip # type: ignore[import]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
from semantic_version import SimpleSpec as SemVerSpec
from semantic_version import Version as SemVer

from antsibull.constants import MINIMUM_ANSIBLE_VERSIONS
from antsibull.python_metadata import BuildMetaMaker, LegacyBuildMetaMaker
from antsibull_build.constants import MINIMUM_ANSIBLE_VERSIONS
from antsibull_build.python_metadata import BuildMetaMaker, LegacyBuildMetaMaker

from . import __version__ as antsibull_version
from .build_changelog import ReleaseNotes
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ def parse_args(program_name: str, args: list[str]) -> argparse.Namespace:
)

# Delay import to avoid potential import loops
from antsibull import __version__ as _ver # pylint: disable=import-outside-toplevel
# pylint: disable-next=import-outside-toplevel
from antsibull_build import __version__ as _ver

parser = get_toplevel_parser(
prog=program_name,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

from semantic_version import Version as SemVer

from antsibull.tagging import CollectionTagData
from antsibull.types import CollectionName
from antsibull_build.tagging import CollectionTagData
from antsibull_build.types import CollectionName


def filter_tag_data(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from antsibull_core.subprocess_util import async_log_run
from antsibull_fileutils.yaml import load_yaml_file, store_yaml_file

from antsibull.tagging import CollectionTagData
from antsibull.types import CollectionName
from antsibull.utils.paths import copytree_and_symlinks
from antsibull_build.tagging import CollectionTagData
from antsibull_build.types import CollectionName
from antsibull_build.utils.paths import copytree_and_symlinks

from .exceptions import CloneError
from .verify import FileError, FileErrorOutput
Expand All @@ -45,7 +45,7 @@ async def clone_collection(
Args:
tag_data:
A tag dictionary. See `antsibull.tagging.get_collections_tags()`.
A tag dictionary. See `antsibull_build.tagging.get_collections_tags()`.
Returns:
The path to the collection checkout
"""
Expand Down Expand Up @@ -156,7 +156,7 @@ async def normalize_clone(
expected_collection:
Expected NAMESPACE.NAME of the collection
tag_data:
A tag dictionary. See `antsibull.tagging.get_collections_tags()`.
A tag dictionary. See `antsibull_build.tagging.get_collections_tags()`.
"""
flog = mlog.fields(func="normalize_clone", collection=collection)
errors: list[FileErrorOutput] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
from antsibull_core.subprocess_util import async_log_run
from antsibull_fileutils.yaml import load_yaml_file, store_yaml_file

from antsibull.build_ansible_commands import download_collections
from antsibull.tagging import CollectionTagData
from antsibull.types import CollectionName, make_collection_mapping
from antsibull.utils.galaxy import create_galaxy_context
from antsibull.utils.paths import atemp_or_dir
from antsibull_build.build_ansible_commands import download_collections
from antsibull_build.tagging import CollectionTagData
from antsibull_build.types import CollectionName, make_collection_mapping
from antsibull_build.utils.galaxy import create_galaxy_context
from antsibull_build.utils.paths import atemp_or_dir

from ._utils import filter_tag_data, tag_data_as_version_mapping
from .clone import NormalizedCheckout, clone_collection, normalize_clone
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from antsibull_core import app_context
from antsibull_fileutils.hashing import verify_hash

from antsibull.types import add_yaml_type
from antsibull_build.types import add_yaml_type

if TYPE_CHECKING:
from typing_extensions import NotRequired
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
from antsibull_fileutils.yaml import store_yaml_file
from packaging.version import Version

from antsibull.constants import SANITY_TESTS_BANNED_IGNORES, SANITY_TESTS_DEFAULT
from antsibull.types import CollectionName, add_dataclass_yaml_type
from antsibull_build.constants import SANITY_TESTS_BANNED_IGNORES, SANITY_TESTS_DEFAULT
from antsibull_build.types import CollectionName, add_dataclass_yaml_type

if TYPE_CHECKING:
from _typeshed import StrPath
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@

def get_antsibull_data(filename: str) -> bytes:
"""
Retrieve data from the antsibull.data package as bytes.
Retrieve data from the antsibull_build.data package as bytes.
The filename can be a relative path separated with '/' to access subdirectories.
See https://docs.python.org/3/library/pkgutil.html#pkgutil.get_data for details.
"""
data = pkgutil.get_data("antsibull.data", filename)
data = pkgutil.get_data("antsibull_build.data", filename)
if data is None:
raise RuntimeError(f"Cannot find {filename} in the antsibull.data package")
raise RuntimeError(
f"Cannot find {filename} in the antsibull_build.data package"
)
return data
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import aiofiles.ospath
import aiofiles.tempfile

from antsibull._vendor.shutil import copytree_and_symlinks
from antsibull_build._vendor.shutil import copytree_and_symlinks

if TYPE_CHECKING:
from _typeshed import StrPath
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_announcements.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import pytest

from antsibull.cli.antsibull_build import run
from antsibull_build.cli.antsibull_build import run

ANNOUNCEMENT_TESTS = [
("7.0.0b1", "announce-7.0.0b1"),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This file is here so that pytest won't complain that it cannot find tests.
# Remove once we have actual tests.

import antsibull
import antsibull_build


def test_dummy():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import pytest

from antsibull._vendor.shutil import _should_symlink
from antsibull.utils.paths import atemp_or_dir, copytree_and_symlinks, temp_or_dir
from antsibull_build._vendor.shutil import _should_symlink
from antsibull_build.utils.paths import atemp_or_dir, copytree_and_symlinks, temp_or_dir


@pytest.mark.asyncio
Expand Down
6 changes: 4 additions & 2 deletions tests/test_tagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest
from antsibull_core.yaml import load_yaml_file

from antsibull.cli.antsibull_build import run
from antsibull_build.cli.antsibull_build import run


@pytest.mark.parametrize(
Expand Down Expand Up @@ -213,7 +213,9 @@ def test_validate_tags(test_data_path: Path, tmp_path: Path):
expected_data_path = test_data_path / name
expected_data = load_yaml_file(expected_data_path)
output_data_path = tmp_path / name
with patch("antsibull.tagging.get_collections_tags", return_value=expected_data):
with patch(
"antsibull_build.tagging.get_collections_tags", return_value=expected_data
):
ran = run(
[
"antsibull-build",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import pytest

from antsibull.types import CollectionName, make_collection_mapping
from antsibull_build.types import CollectionName, make_collection_mapping


def test_collection_name() -> None:
Expand Down
Loading

0 comments on commit 123fbcf

Please sign in to comment.