Skip to content

Commit

Permalink
make nebari API private (#1778)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pmeier and pre-commit-ci[bot] committed May 30, 2023
1 parent ad23a13 commit 0436553
Show file tree
Hide file tree
Showing 346 changed files with 91 additions and 93 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/kubernetes_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- "tests_deployment/**"
- "tests_e2e/**"
- "scripts/**"
- "nebari/**"
- "src/**"
- "pyproject.toml"
- "pytest.ini"
push:
Expand All @@ -22,7 +22,7 @@ on:
- "tests_deployment/**"
- "tests_e2e/**"
- "scripts/**"
- "nebari/**"
- "src/**"
- "pyproject.toml"
- "pytest.ini"
workflow_call:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- "tests_deployment/**"
- "tests_e2e/**"
- "scripts/**"
- "nebari/**"
- "src/**"
- "pyproject.toml"
push:
branches:
Expand All @@ -21,7 +21,7 @@ on:
- "tests_deployment/**"
- "tests_e2e/**"
- "scripts/**"
- "nebari/**"
- "src/**"
- "pyproject.toml"
workflow_call:
inputs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- "tests_deployment/**"
- "tests_e2e/**"
- "scripts/**"
- "nebari/**"
- "src/**"
- "pyproject.toml"
- "pytest.ini"
push:
Expand All @@ -22,7 +22,7 @@ on:
- "tests_deployment/**"
- "tests_e2e/**"
- "scripts/**"
- "nebari/**"
- "src/**"
- "pyproject.toml"
- "pytest.ini"

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# setuptools scm
nebari/_version.py
src/_nebari/_version.py

# ignore terraform state
.terraform
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ repos:
- id: check-json
- id: check-yaml
# jinja2 templates for helm charts
exclude: "nebari/template/stages/07-kubernetes-services/modules/kubernetes/services/(clearml/chart/templates/.*|prefect/chart/templates/.*)"
exclude: "src/_nebari/template/stages/07-kubernetes-services/modules/kubernetes/services/(clearml/chart/templates/.*|prefect/chart/templates/.*)"
args: [--allow-multiple-documents]
- id: check-toml
# Lint: Checks that non-binary executables have a proper shebang.
- id: check-executables-have-shebangs
exclude: "^nebari/template/"
exclude: "^src/_nebari/template/"

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
Expand All @@ -54,7 +54,7 @@ repos:
rev: 23.3.0
hooks:
- id: black
args: ["--line-length=88", "--exclude=/nebari/template/"]
args: ["--line-length=88", "--exclude=/src/_nebari/template/"]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.263
Expand Down
11 changes: 0 additions & 11 deletions nebari/__main__.py

This file was deleted.

11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
include = ["nebari"]
packages = [
"src/_nebari",
"src/nebari",
]

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "nebari/_version.py"
version-file = "src/_nebari/_version.py"
local_scheme = "node-and-timestamp"


Expand Down Expand Up @@ -90,15 +93,15 @@ Documentation = "https://www.nebari.dev/docs"
Source = "https://github.com/nebari-dev/nebari"

[project.scripts]
nebari = "nebari.cli.main:app"
nebari = "_nebari.cli.main:app"

[tool.ruff]
ignore = [
"E501", # Line too long
"F821", # Undefined name
]
extend-exclude = [
"nebari/template",
"src/_nebari/template",
"home",
"__pycache__"
]
2 changes: 1 addition & 1 deletion scripts/aws-force-destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pathlib
import time

from nebari.utils import check_cloud_credentials, load_yaml, timer
from _nebari.utils import check_cloud_credentials, load_yaml, timer

logging.basicConfig(level=logging.INFO)

Expand Down
2 changes: 1 addition & 1 deletion scripts/keycloak-export.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pathlib
import sys

from nebari.keycloak import get_keycloak_admin_from_config
from _nebari.keycloak import get_keycloak_admin_from_config

logging.basicConfig(level=logging.INFO)

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion nebari/cli/dev.py → src/_nebari/cli/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import typer

from nebari.keycloak import keycloak_rest_api_call
from _nebari.keycloak import keycloak_rest_api_call

app_dev = typer.Typer(
add_completion=False,
Expand Down
6 changes: 3 additions & 3 deletions nebari/cli/init.py → src/_nebari/cli/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import rich
import typer

from nebari.initialize import render_config
from nebari.schema import (
from _nebari.initialize import render_config
from _nebari.schema import (
AuthenticationEnum,
CiEnum,
GitRepoEnum,
Expand All @@ -16,7 +16,7 @@
TerraformStateEnum,
project_name_convention,
)
from nebari.utils import NEBARI_DASK_VERSION, NEBARI_IMAGE_TAG, yaml
from _nebari.utils import NEBARI_DASK_VERSION, NEBARI_IMAGE_TAG, yaml

MISSING_CREDS_TEMPLATE = "Unable to locate your {provider} credentials, refer to this guide on how to generate them:\n\n[green]\t{link_to_docs}[/green]\n\n"
LINKS_TO_DOCS_TEMPLATE = (
Expand Down
2 changes: 1 addition & 1 deletion nebari/cli/keycloak.py → src/_nebari/cli/keycloak.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import typer

from nebari.keycloak import do_keycloak, export_keycloak_users
from _nebari.keycloak import do_keycloak, export_keycloak_users

app_keycloak = typer.Typer(
add_completion=False,
Expand Down
20 changes: 10 additions & 10 deletions nebari/cli/main.py → src/_nebari/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from ruamel import yaml
from typer.core import TyperGroup

from nebari.cli.dev import app_dev
from nebari.cli.init import (
from _nebari.cli.dev import app_dev
from _nebari.cli.init import (
check_auth_provider_creds,
check_cloud_provider_creds,
check_project_name,
Expand All @@ -20,11 +20,11 @@
guided_init_wizard,
handle_init,
)
from nebari.cli.keycloak import app_keycloak
from nebari.deploy import deploy_configuration
from nebari.destroy import destroy_configuration
from nebari.render import render_template
from nebari.schema import (
from _nebari.cli.keycloak import app_keycloak
from _nebari.deploy import deploy_configuration
from _nebari.destroy import destroy_configuration
from _nebari.render import render_template
from _nebari.schema import (
AuthenticationEnum,
CiEnum,
GitRepoEnum,
Expand All @@ -33,9 +33,9 @@
TerraformStateEnum,
verify,
)
from nebari.upgrade import do_upgrade
from nebari.utils import load_yaml
from nebari.version import __version__
from _nebari.upgrade import do_upgrade
from _nebari.utils import load_yaml
from _nebari.version import __version__

SECOND_COMMAND_GROUP_NAME = "Additional Commands"
GUIDED_INIT_MSG = (
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions nebari/deploy.py → src/_nebari/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import subprocess
import textwrap

from nebari.provider import terraform
from nebari.provider.dns.cloudflare import update_record
from nebari.stages import checks, input_vars, state_imports
from nebari.utils import (
from _nebari.provider import terraform
from _nebari.provider.dns.cloudflare import update_record
from _nebari.stages import checks, input_vars, state_imports
from _nebari.utils import (
check_cloud_credentials,
keycloak_provider_context,
kubernetes_provider_context,
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions nebari/destroy.py → src/_nebari/destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import logging
import os

from nebari.provider import terraform
from nebari.stages import input_vars, state_imports
from nebari.utils import (
from _nebari.provider import terraform
from _nebari.stages import input_vars, state_imports
from _nebari.utils import (
check_cloud_credentials,
keycloak_provider_context,
kubernetes_provider_context,
Expand Down
8 changes: 4 additions & 4 deletions nebari/initialize.py → src/_nebari/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import requests

from nebari.provider import git
from nebari.provider.cicd import github
from nebari.provider.oauth.auth0 import create_client
from nebari.utils import (
from _nebari.provider import git
from _nebari.provider.cicd import github
from _nebari.provider.oauth.auth0 import create_client
from _nebari.utils import (
check_cloud_credentials,
namestr_regex,
set_docker_image_tag,
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 @@ -6,8 +6,8 @@
from nacl import encoding, public
from pydantic import BaseModel, Field

from nebari.constants import LATEST_SUPPORTED_PYTHON_VERSION
from nebari.provider.cicd.common import pip_install_nebari
from _nebari.constants import LATEST_SUPPORTED_PYTHON_VERSION
from _nebari.provider.cicd.common import pip_install_nebari

GITHUB_BASE_URL = "https://api.github.com/"

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

from pydantic import BaseModel, Field

from nebari.constants import LATEST_SUPPORTED_PYTHON_VERSION
from nebari.provider.cicd.common import pip_install_nebari
from _nebari.constants import LATEST_SUPPORTED_PYTHON_VERSION
from _nebari.provider.cicd.common import pip_install_nebari


class GLCI_extras(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import requests

from nebari.schema import verify
from _nebari.schema import verify


def nebari_validate(config):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import boto3

from nebari.provider.cloud.commons import filter_by_highest_supported_k8s_version
from _nebari.provider.cloud.commons import filter_by_highest_supported_k8s_version


@functools.lru_cache()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient

from nebari.provider.cloud.commons import filter_by_highest_supported_k8s_version
from _nebari.provider.cloud.commons import filter_by_highest_supported_k8s_version

logger = logging.getLogger("azure")
logger.setLevel(logging.ERROR)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from nebari.constants import HIGHEST_SUPPORTED_K8S_VERSION
from _nebari.constants import HIGHEST_SUPPORTED_K8S_VERSION


def filter_by_highest_supported_k8s_version(k8s_versions_list):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import requests

from nebari.provider.cloud.commons import filter_by_highest_supported_k8s_version
from _nebari.provider.cloud.commons import filter_by_highest_supported_k8s_version


def digital_ocean_request(url, method="GET", json=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import subprocess

from nebari.provider.cloud.commons import filter_by_highest_supported_k8s_version
from _nebari.provider.cloud.commons import filter_by_highest_supported_k8s_version


@functools.lru_cache()
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion nebari/provider/git.py → src/_nebari/provider/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import subprocess

from nebari.utils import change_directory
from _nebari.utils import change_directory


def is_git_repo(path=None):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import zipfile
from typing import Any, Dict, List

from nebari import constants
from nebari.utils import deep_merge, run_subprocess_cmd, timer
from _nebari import constants
from _nebari.utils import deep_merge, run_subprocess_cmd, timer

logger = logging.getLogger(__name__)

Expand Down
14 changes: 7 additions & 7 deletions nebari/render.py → src/_nebari/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
from rich.table import Table
from ruamel.yaml import YAML

import nebari
from nebari.deprecate import DEPRECATED_FILE_PATHS
from nebari.provider.cicd.github import gen_nebari_linter, gen_nebari_ops
from nebari.provider.cicd.gitlab import gen_gitlab_ci
from nebari.stages import tf_objects
import _nebari
from _nebari.deprecate import DEPRECATED_FILE_PATHS
from _nebari.provider.cicd.github import gen_nebari_linter, gen_nebari_ops
from _nebari.provider.cicd.gitlab import gen_gitlab_ci
from _nebari.stages import tf_objects


def render_template(output_directory, config_filename, dry_run=False):
# get directory for nebari templates
template_directory = pathlib.Path(nebari.__file__).parent / "template"
template_directory = pathlib.Path(_nebari.__file__).parent / "template"

# would be nice to remove assumption that input directory
# is in local filesystem and a directory
Expand Down Expand Up @@ -148,7 +148,7 @@ def render_template(output_directory, config_filename, dry_run=False):


def render_contents(config: Dict):
"""Dynamically generated contents from Nebari configuration."""
"""Dynamically generated contents from _nebari configuration."""
contents = {
**tf_objects.stage_01_terraform_state(config),
**tf_objects.stage_02_infrastructure(config),
Expand Down
Loading

0 comments on commit 0436553

Please sign in to comment.