Skip to content

Commit

Permalink
Fix test_init_files (#2982)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2982

I randomly came across this test that would've prevented a recent broken release if it has been working. I believe it was written based on the old directory structure (before we moved ax/ax/... to ax/...), and had to be updated to continue working. This diff updates the target directory and adds exclusions for
- ax/fb -- these are only used with buck, so no need to enforce __init__
- ax/github -- these are for github templates and workflows, so no need to have them included in builds. They also live in a separate directory in OSS.
- tests -- I don't have a strong opinion on this one either way

Reviewed By: esantorella

Differential Revision: D65141273

fbshipit-source-id: 61f0f7dcb5cb9d3666880065d861cbae70d6665b
  • Loading branch information
saitcakmak authored and facebook-github-bot committed Oct 29, 2024
1 parent 7d8635c commit fed5c55
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ax/health_check/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
5 changes: 5 additions & 0 deletions ax/preview/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
5 changes: 5 additions & 0 deletions ax/preview/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
5 changes: 5 additions & 0 deletions ax/telemetry/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
9 changes: 7 additions & 2 deletions ax/utils/testing/test_init_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@

from ax.utils.common.testutils import TestCase

DIRS_TO_SKIP = ["ax/fb", "ax/github", "tests"]


class InitTest(TestCase):
def test_InitFiles(self) -> None:
"""__init__.py files are necessary when not using buck targets"""
for root, _dirs, files in os.walk("./ax/ax", topdown=False):
"""__init__.py files are necessary for the inclusion of the directories
in pip builds."""
for root, _, files in os.walk("./ax", topdown=False):
if any(s in root for s in DIRS_TO_SKIP):
continue
if len(glob(f"{root}/**/*.py", recursive=True)) > 0:
with self.subTest(root):
self.assertTrue(
Expand Down
19 changes: 19 additions & 0 deletions sphinx/source/health_check.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. role:: hidden
:class: hidden-section

ax.health_check
===============

.. automodule:: ax.health_check
.. currentmodule:: ax.health_check

Ax Experiment Health Checks
---------------------------

Search Space
~~~~~~~~~~~~

.. automodule:: ax.health_check.search_space
:members:
:undoc-members:
:show-inheritance:
5 changes: 5 additions & 0 deletions sphinx/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ API Reference
.. toctree::
:maxdepth: 2

analysis
ax
benchmark
core
early_stopping
exceptions
global_stopping
health_check
metrics
modelbridge
models
plot
preview
runners
service
storage
Expand Down
19 changes: 19 additions & 0 deletions sphinx/source/preview.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. role:: hidden
:class: hidden-section

ax.preview
==========

.. automodule:: ax.preview
.. currentmodule:: ax.preview

A preview of future Ax API
--------------------------

Configs
~~~~~~~

.. automodule:: ax.preview.api.configs
:members:
:undoc-members:
:show-inheritance:
24 changes: 24 additions & 0 deletions sphinx/source/telemetry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ ax.telemetry
.. automodule:: ax.telemetry
.. currentmodule:: ax.telemetry

AxClient
~~~~~~~~

.. automodule:: ax.telemetry.ax_client
:members:
:undoc-members:
:show-inheritance:

Common
~~~~~~

.. automodule:: ax.telemetry.common
:members:
:undoc-members:
:show-inheritance:

Experiment
~~~~~~~~~~

Expand All @@ -23,6 +39,14 @@ Generation Strategy
:undoc-members:
:show-inheritance:

Optimization
~~~~~~~~~~~~

.. automodule:: ax.telemetry.optimization
:members:
:undoc-members:
:show-inheritance:

Scheduler
~~~~~~~~~

Expand Down

0 comments on commit fed5c55

Please sign in to comment.