diff --git a/.gitignore b/.gitignore index d28c7c8572e..c2ed8d7e5a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ -fidesapi/src/main/resources/application.conf +fidesctl/api/src/main/resources/application.conf docs/fides/docs/api/openapi.json docs/fides/docs/schemas/config_schema.json -fidesapi/build/static +fidesctl/api/build/static ## generic files to ignore *~ diff --git a/CHANGELOG.md b/CHANGELOG.md index 3081694f74e..3b4b35164d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,8 @@ The types of changes are: ### Changed * Updated the `datamap` endpoint to return human-readable column names as the first response item [#779](https://github.com/ethyca/fides/pull/779) +* Remove the `obscure` requirement from the `generate` endpoint [#819](https://github.com/ethyca/fides/pull/819) +* Moved all files from `fidesapi` to `fidesctl/api` [#885](https://github.com/ethyca/fides/pull/885) * Moved `scan` and `generate` to the list of commands that can be run in local mode [#841](https://github.com/ethyca/fides/pull/841) * Webserver dependencies now come as a standard part of the package [#881](https://github.com/ethyca/fides/pull/881) * Initial configuration wizard UI view diff --git a/Dockerfile b/Dockerfile index 76a78e69239..75a9f90779e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -91,7 +91,7 @@ ENV PYTHONUNBUFFERED=TRUE ENV RUNNING_IN_DOCKER=TRUE # Make a static files directory -RUN mkdir -p src/fidesapi/build/static +RUN mkdir -p src/fidesctl/api/build/static EXPOSE 8080 CMD ["fidesctl", "webserver"] @@ -116,4 +116,4 @@ RUN python setup.py sdist RUN pip install dist/fidesctl-*.tar.gz # Copy frontend build over -COPY --from=frontend /fides/clients/admin-ui/out/ /fides/src/fidesapi/build/static/ +COPY --from=frontend /fides/clients/admin-ui/out/ /fides/src/fidesctl/api/build/static/ diff --git a/MANIFEST.in b/MANIFEST.in index 470a2ae3524..269cc294109 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,8 +1,6 @@ include LICENSE -include README.md include requirements.txt include dev-requirements.txt include versioneer.py -include src/fidesapi/alembic.ini -include src/fidesctl/_version.py +include src/fidesctl/api/alembic.ini include src/fidesctl/templates/fides_datamap_template.xlsx diff --git a/clients/admin-ui/package.json b/clients/admin-ui/package.json index 8651c545b9d..30db53b04ab 100644 --- a/clients/admin-ui/package.json +++ b/clients/admin-ui/package.json @@ -14,7 +14,7 @@ "analyze:server": "cross-env BUNDLE_ANALYZE=server next build", "analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build", "export": "next build && next export", - "copy-export": "rsync -a --delete out/ ../../src/fidesapi/build/static/", + "copy-export": "rsync -a --delete out/ ../../src/fidesctl/api/build/static/", "prod-export": "npm run export && npm run copy-export", "cy:open": "cypress open", "cy:run": "cypress run", diff --git a/docker-compose.yml b/docker-compose.yml index dbb7a161737..3ab3d102804 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: fidesctl: image: ethyca/fidesctl:local - command: uvicorn --host 0.0.0.0 --port 8080 --reload fidesapi.main:app + command: uvicorn --host 0.0.0.0 --port 8080 --reload fidesctl.api.main:app healthcheck: test: [ diff --git a/docs/fides/docs/development/database_migration.md b/docs/fides/docs/development/database_migration.md index f56438f85bf..01a65003abc 100644 --- a/docs/fides/docs/development/database_migration.md +++ b/docs/fides/docs/development/database_migration.md @@ -1,12 +1,14 @@ # Database Migration + --- -Changes to fidesctl could require a change to the database model. This includes scenarios where you want to persist a new field or replace an existing field. Changes made to the fidesctl database are done through alembic migration scripts. Migrations can be found in the following direcotry: `fidesctl/src/fidesapi/migrations/versions` +Changes to fidesctl could require a change to the database model. This includes scenarios where you want to persist a new field or replace an existing field. Changes made to the fidesctl database are done through alembic migration scripts. Migrations can be found in the following direcotry: `fidesctl/src/fidesctl/api/migrations/versions` To create a new migration we use the `alembic revision` command: + ```bash -cd fidesctl/src/fidesapi +cd fidesctl/src/fidesctl/api alembic revision --autogenerate -m "migration message" ``` -The autogenerated script should be verified and could require some manual changes. Migrations will run on the fidesctl server startup. +The autogenerated script should be verified and could require some manual changes. Migrations will run on the fidesctl server startup. diff --git a/generate_docs.py b/generate_docs.py index 33f235de9ba..2829739d510 100644 --- a/generate_docs.py +++ b/generate_docs.py @@ -4,19 +4,20 @@ import json import sys -from fidesapi.main import app +from fidesctl.api.main import app + def generate_openapi(outfile_dir: str) -> None: "Write out an openapi.json file for the API." outfile_name = "api/openapi.json" outfile_path = f"{outfile_dir}/{outfile_name}" - print(f"Generating OpenAPI JSON from fidesapi and writing to '{outfile_path}'...") + print(f"Generating OpenAPI JSON from the API and writing to '{outfile_path}'...") with open(outfile_path, "w") as outfile: json.dump(app.openapi(), outfile, indent=2) - print(f"Exported OpenAPI JSON from fidesapi to '{outfile_path}'") + print(f"Exported OpenAPI JSON from the API to '{outfile_path}'") if __name__ == "__main__": outfile_dir = sys.argv[1] - generate_openapi(outfile_dir) \ No newline at end of file + generate_openapi(outfile_dir) diff --git a/setup.py b/setup.py index f3adc69ec0b..fbc231d2c02 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,6 @@ python_requires=">=3.8, <4", package_dir={"": "src"}, packages=find_packages(where="src"), - package_data={"fidesapi": ["alembic.ini"]}, include_package_data=True, author="Ethyca, Inc.", author_email="fidesteam@ethyca.com", diff --git a/src/fidesapi/__init__.py b/src/fidesctl/api/__init__.py similarity index 100% rename from src/fidesapi/__init__.py rename to src/fidesctl/api/__init__.py diff --git a/src/fidesapi/alembic.ini b/src/fidesctl/api/alembic.ini similarity index 100% rename from src/fidesapi/alembic.ini rename to src/fidesctl/api/alembic.ini diff --git a/src/fidesapi/database/__init__.py b/src/fidesctl/api/database/__init__.py similarity index 100% rename from src/fidesapi/database/__init__.py rename to src/fidesctl/api/database/__init__.py diff --git a/src/fidesapi/database/crud.py b/src/fidesctl/api/database/crud.py similarity index 98% rename from src/fidesapi/database/crud.py rename to src/fidesctl/api/database/crud.py index 88820234dc6..d72d90c100b 100644 --- a/src/fidesapi/database/crud.py +++ b/src/fidesctl/api/database/crud.py @@ -12,9 +12,9 @@ from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.future import select -from fidesapi.database.session import async_session -from fidesapi.sql_models import SqlAlchemyBase -from fidesapi.utils import errors +from fidesctl.api.database.session import async_session +from fidesctl.api.sql_models import SqlAlchemyBase +from fidesctl.api.utils import errors # CRUD Functions diff --git a/src/fidesapi/database/database.py b/src/fidesctl/api/database/database.py similarity index 97% rename from src/fidesapi/database/database.py rename to src/fidesctl/api/database/database.py index d7e9da11235..16ffa1de8f9 100644 --- a/src/fidesapi/database/database.py +++ b/src/fidesctl/api/database/database.py @@ -11,8 +11,8 @@ from sqlalchemy import create_engine from sqlalchemy_utils.functions import create_database, database_exists -from fidesapi.sql_models import SqlAlchemyBase, sql_model_map -from fidesapi.utils.errors import ( +from fidesctl.api.sql_models import SqlAlchemyBase, sql_model_map +from fidesctl.api.utils.errors import ( AlreadyExistsError, QueryError, get_full_exception_name, diff --git a/src/fidesapi/database/session.py b/src/fidesctl/api/database/session.py similarity index 100% rename from src/fidesapi/database/session.py rename to src/fidesctl/api/database/session.py diff --git a/src/fidesapi/main.py b/src/fidesctl/api/main.py similarity index 90% rename from src/fidesapi/main.py rename to src/fidesctl/api/main.py index 446a70a5e6a..1efb6b65375 100644 --- a/src/fidesapi/main.py +++ b/src/fidesctl/api/main.py @@ -12,11 +12,19 @@ from loguru import logger as log from uvicorn import Config, Server -from fidesapi import view -from fidesapi.database.database import configure_db -from fidesapi.routes import admin, crud, datamap, generate, health, validate, visualize -from fidesapi.routes.util import API_PREFIX, WEBAPP_DIRECTORY, WEBAPP_INDEX -from fidesapi.utils.logger import setup as setup_logging +from fidesctl.api import view +from fidesctl.api.database.database import configure_db +from fidesctl.api.routes import ( + admin, + crud, + datamap, + generate, + health, + validate, + visualize, +) +from fidesctl.api.routes.util import API_PREFIX, WEBAPP_DIRECTORY, WEBAPP_INDEX +from fidesctl.api.utils.logger import setup as setup_logging from fidesctl.core.config import FidesctlConfig, get_config app = FastAPI(title="fidesctl") diff --git a/src/fidesapi/migrations/__init__.py b/src/fidesctl/api/migrations/__init__.py similarity index 100% rename from src/fidesapi/migrations/__init__.py rename to src/fidesctl/api/migrations/__init__.py diff --git a/src/fidesapi/migrations/env.py b/src/fidesctl/api/migrations/env.py similarity index 95% rename from src/fidesapi/migrations/env.py rename to src/fidesctl/api/migrations/env.py index f963ace8590..bb58fa9f1e9 100644 --- a/src/fidesapi/migrations/env.py +++ b/src/fidesctl/api/migrations/env.py @@ -3,7 +3,7 @@ from alembic import context from sqlalchemy import engine_from_config, pool -from fidesapi.utils.logger import setup as setup_fidesapi_logger +from fidesctl.api.utils.logger import setup as setup_fidesapi_logger from fidesctl.core.config import get_config # this is the Alembic Config object, which provides @@ -24,7 +24,7 @@ # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata -from fidesapi.sql_models import SqlAlchemyBase +from fidesctl.api.sql_models import SqlAlchemyBase target_metadata = SqlAlchemyBase.metadata diff --git a/src/fidesapi/migrations/script.py.mako b/src/fidesctl/api/migrations/script.py.mako similarity index 100% rename from src/fidesapi/migrations/script.py.mako rename to src/fidesctl/api/migrations/script.py.mako diff --git a/src/fidesapi/migrations/versions/150f234ef1de_add_fidesctl_meta_to_organization_object.py b/src/fidesctl/api/migrations/versions/150f234ef1de_add_fidesctl_meta_to_organization_object.py similarity index 100% rename from src/fidesapi/migrations/versions/150f234ef1de_add_fidesctl_meta_to_organization_object.py rename to src/fidesctl/api/migrations/versions/150f234ef1de_add_fidesctl_meta_to_organization_object.py diff --git a/src/fidesapi/migrations/versions/1739aa4a4ab7_add_security_policy_link_and_erasure_.py b/src/fidesctl/api/migrations/versions/1739aa4a4ab7_add_security_policy_link_and_erasure_.py similarity index 100% rename from src/fidesapi/migrations/versions/1739aa4a4ab7_add_security_policy_link_and_erasure_.py rename to src/fidesctl/api/migrations/versions/1739aa4a4ab7_add_security_policy_link_and_erasure_.py diff --git a/src/fidesapi/migrations/versions/26934c96ec80_initial_migration.py b/src/fidesctl/api/migrations/versions/26934c96ec80_initial_migration.py similarity index 100% rename from src/fidesapi/migrations/versions/26934c96ec80_initial_migration.py rename to src/fidesctl/api/migrations/versions/26934c96ec80_initial_migration.py diff --git a/src/fidesapi/migrations/versions/312aff72b275_migrate_to_usage_of_evaluation_.py b/src/fidesctl/api/migrations/versions/312aff72b275_migrate_to_usage_of_evaluation_.py similarity index 100% rename from src/fidesapi/migrations/versions/312aff72b275_migrate_to_usage_of_evaluation_.py rename to src/fidesctl/api/migrations/versions/312aff72b275_migrate_to_usage_of_evaluation_.py diff --git a/src/fidesapi/migrations/versions/327cd266f7b3_update_dataset_depth.py b/src/fidesctl/api/migrations/versions/327cd266f7b3_update_dataset_depth.py similarity index 100% rename from src/fidesapi/migrations/versions/327cd266f7b3_update_dataset_depth.py rename to src/fidesctl/api/migrations/versions/327cd266f7b3_update_dataset_depth.py diff --git a/src/fidesapi/migrations/versions/45c7a349db68_remove_qualifier_lists_from_data_set_.py b/src/fidesctl/api/migrations/versions/45c7a349db68_remove_qualifier_lists_from_data_set_.py similarity index 100% rename from src/fidesapi/migrations/versions/45c7a349db68_remove_qualifier_lists_from_data_set_.py rename to src/fidesctl/api/migrations/versions/45c7a349db68_remove_qualifier_lists_from_data_set_.py diff --git a/src/fidesapi/migrations/versions/4c3693c289d0_add_optional_contact_information_for_.py b/src/fidesctl/api/migrations/versions/4c3693c289d0_add_optional_contact_information_for_.py similarity index 100% rename from src/fidesapi/migrations/versions/4c3693c289d0_add_optional_contact_information_for_.py rename to src/fidesctl/api/migrations/versions/4c3693c289d0_add_optional_contact_information_for_.py diff --git a/src/fidesapi/migrations/versions/50b3736634d2_extend_data_use_with_recipients_and_.py b/src/fidesctl/api/migrations/versions/50b3736634d2_extend_data_use_with_recipients_and_.py similarity index 100% rename from src/fidesapi/migrations/versions/50b3736634d2_extend_data_use_with_recipients_and_.py rename to src/fidesctl/api/migrations/versions/50b3736634d2_extend_data_use_with_recipients_and_.py diff --git a/src/fidesapi/migrations/versions/732105cd54e3_update_dataset_field_name.py b/src/fidesctl/api/migrations/versions/732105cd54e3_update_dataset_field_name.py similarity index 100% rename from src/fidesapi/migrations/versions/732105cd54e3_update_dataset_field_name.py rename to src/fidesctl/api/migrations/versions/732105cd54e3_update_dataset_field_name.py diff --git a/src/fidesapi/migrations/versions/7a94527643a1_add_column_for_special_category_to_data_.py b/src/fidesctl/api/migrations/versions/7a94527643a1_add_column_for_special_category_to_data_.py similarity index 100% rename from src/fidesapi/migrations/versions/7a94527643a1_add_column_for_special_category_to_data_.py rename to src/fidesctl/api/migrations/versions/7a94527643a1_add_column_for_special_category_to_data_.py diff --git a/src/fidesapi/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py b/src/fidesctl/api/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py similarity index 95% rename from src/fidesapi/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py rename to src/fidesctl/api/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py index ffa6f36608b..9ad9c77a6f9 100644 --- a/src/fidesapi/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py +++ b/src/fidesctl/api/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py @@ -8,7 +8,7 @@ from alembic import op from sqlalchemy import Column, DateTime, text -from fidesapi.sql_models import sql_model_map +from fidesctl.api.sql_models import sql_model_map # revision identifiers, used by Alembic. revision = "7c851d8a102a" diff --git a/src/fidesapi/migrations/versions/__init__.py b/src/fidesctl/api/migrations/versions/__init__.py similarity index 100% rename from src/fidesapi/migrations/versions/__init__.py rename to src/fidesctl/api/migrations/versions/__init__.py diff --git a/src/fidesapi/migrations/versions/a2b9b156ebaf_data_protection_impact_assessments_.py b/src/fidesctl/api/migrations/versions/a2b9b156ebaf_data_protection_impact_assessments_.py similarity index 100% rename from src/fidesapi/migrations/versions/a2b9b156ebaf_data_protection_impact_assessments_.py rename to src/fidesctl/api/migrations/versions/a2b9b156ebaf_data_protection_impact_assessments_.py diff --git a/src/fidesapi/migrations/versions/adad3be6af08_privacy_notice_attributes.py b/src/fidesctl/api/migrations/versions/adad3be6af08_privacy_notice_attributes.py similarity index 100% rename from src/fidesapi/migrations/versions/adad3be6af08_privacy_notice_attributes.py rename to src/fidesctl/api/migrations/versions/adad3be6af08_privacy_notice_attributes.py diff --git a/src/fidesapi/migrations/versions/be432bd23596_add_fidesctl_meta_field_to_dataset.py b/src/fidesctl/api/migrations/versions/be432bd23596_add_fidesctl_meta_field_to_dataset.py similarity index 100% rename from src/fidesapi/migrations/versions/be432bd23596_add_fidesctl_meta_field_to_dataset.py rename to src/fidesctl/api/migrations/versions/be432bd23596_add_fidesctl_meta_field_to_dataset.py diff --git a/src/fidesapi/migrations/versions/d8f8bd52754f_add_tags_as_part_of_fideslang_1_1_0.py b/src/fidesctl/api/migrations/versions/d8f8bd52754f_add_tags_as_part_of_fideslang_1_1_0.py similarity index 100% rename from src/fidesapi/migrations/versions/d8f8bd52754f_add_tags_as_part_of_fideslang_1_1_0.py rename to src/fidesctl/api/migrations/versions/d8f8bd52754f_add_tags_as_part_of_fideslang_1_1_0.py diff --git a/src/fidesapi/migrations/versions/e576b6a80a49_add_parent_key_to_dataqualifier.py b/src/fidesctl/api/migrations/versions/e576b6a80a49_add_parent_key_to_dataqualifier.py similarity index 100% rename from src/fidesapi/migrations/versions/e576b6a80a49_add_parent_key_to_dataqualifier.py rename to src/fidesctl/api/migrations/versions/e576b6a80a49_add_parent_key_to_dataqualifier.py diff --git a/src/fidesapi/migrations/versions/edcd28ede1f7_add_fidesctl_meta_to_system.py b/src/fidesctl/api/migrations/versions/edcd28ede1f7_add_fidesctl_meta_to_system.py similarity index 100% rename from src/fidesapi/migrations/versions/edcd28ede1f7_add_fidesctl_meta_to_system.py rename to src/fidesctl/api/migrations/versions/edcd28ede1f7_add_fidesctl_meta_to_system.py diff --git a/src/fidesapi/migrations/versions/fdd28c39a679_add_responsibility_role_attribute_for_.py b/src/fidesctl/api/migrations/versions/fdd28c39a679_add_responsibility_role_attribute_for_.py similarity index 100% rename from src/fidesapi/migrations/versions/fdd28c39a679_add_responsibility_role_attribute_for_.py rename to src/fidesctl/api/migrations/versions/fdd28c39a679_add_responsibility_role_attribute_for_.py diff --git a/src/fidesapi/routes/__init__.py b/src/fidesctl/api/routes/__init__.py similarity index 100% rename from src/fidesapi/routes/__init__.py rename to src/fidesctl/api/routes/__init__.py diff --git a/src/fidesapi/routes/admin.py b/src/fidesctl/api/routes/admin.py similarity index 84% rename from src/fidesapi/routes/admin.py rename to src/fidesctl/api/routes/admin.py index 3d9d8884b3b..69c18859d22 100644 --- a/src/fidesapi/routes/admin.py +++ b/src/fidesctl/api/routes/admin.py @@ -1,9 +1,9 @@ from enum import Enum from typing import Dict -from fidesapi.database import database -from fidesapi.routes.util import API_PREFIX -from fidesapi.utils.api_router import APIRouter +from fidesctl.api.database import database +from fidesctl.api.routes.util import API_PREFIX +from fidesctl.api.utils.api_router import APIRouter from fidesctl.core.config import FidesctlConfig, get_config CONFIG: FidesctlConfig = get_config() diff --git a/src/fidesapi/routes/crud.py b/src/fidesctl/api/routes/crud.py similarity index 95% rename from src/fidesapi/routes/crud.py rename to src/fidesctl/api/routes/crud.py index 8fd6bf84ae1..5156176a78f 100644 --- a/src/fidesapi/routes/crud.py +++ b/src/fidesctl/api/routes/crud.py @@ -11,7 +11,7 @@ from fastapi import Response, status from fideslang import model_map -from fidesapi.database.crud import ( +from fidesctl.api.database.crud import ( create_resource, delete_resource, get_resource, @@ -19,9 +19,9 @@ update_resource, upsert_resources, ) -from fidesapi.routes.util import API_PREFIX, get_resource_type -from fidesapi.sql_models import sql_model_map -from fidesapi.utils.api_router import APIRouter +from fidesctl.api.routes.util import API_PREFIX, get_resource_type +from fidesctl.api.sql_models import sql_model_map +from fidesctl.api.utils.api_router import APIRouter # CRUD Endpoints routers = [] diff --git a/src/fidesapi/routes/datamap.py b/src/fidesctl/api/routes/datamap.py similarity index 94% rename from src/fidesapi/routes/datamap.py rename to src/fidesctl/api/routes/datamap.py index d82d1191418..b88967faf5b 100644 --- a/src/fidesapi/routes/datamap.py +++ b/src/fidesctl/api/routes/datamap.py @@ -8,11 +8,11 @@ from loguru import logger as log from pandas import DataFrame -from fidesapi.routes.crud import get_resource, list_resource -from fidesapi.routes.util import API_PREFIX -from fidesapi.sql_models import sql_model_map -from fidesapi.utils.api_router import APIRouter -from fidesapi.utils.errors import DatabaseUnavailableError, NotFoundError +from fidesctl.api.routes.crud import get_resource, list_resource +from fidesctl.api.routes.util import API_PREFIX +from fidesctl.api.sql_models import sql_model_map +from fidesctl.api.utils.api_router import APIRouter +from fidesctl.api.utils.errors import DatabaseUnavailableError, NotFoundError from fidesctl.core.export import build_joined_dataframe from fidesctl.core.export_helpers import DATAMAP_COLUMNS diff --git a/src/fidesapi/routes/generate.py b/src/fidesctl/api/routes/generate.py similarity index 96% rename from src/fidesapi/routes/generate.py rename to src/fidesctl/api/routes/generate.py index b4954987822..3c358cfac6d 100644 --- a/src/fidesapi/routes/generate.py +++ b/src/fidesctl/api/routes/generate.py @@ -9,14 +9,14 @@ from loguru import logger as log from pydantic import BaseModel, root_validator -from fidesapi.routes.crud import get_resource -from fidesapi.routes.util import ( +from fidesctl.api.routes.crud import get_resource +from fidesctl.api.routes.util import ( API_PREFIX, route_requires_aws_connector, route_requires_okta_connector, ) -from fidesapi.sql_models import sql_model_map -from fidesapi.utils.api_router import APIRouter +from fidesctl.api.sql_models import sql_model_map +from fidesctl.api.utils.api_router import APIRouter from fidesctl.connectors.models import ( AWSConfig, ConnectorAuthFailureException, diff --git a/src/fidesapi/routes/health.py b/src/fidesctl/api/routes/health.py similarity index 90% rename from src/fidesapi/routes/health.py rename to src/fidesctl/api/routes/health.py index 589e450c139..fcd80d3711d 100644 --- a/src/fidesapi/routes/health.py +++ b/src/fidesctl/api/routes/health.py @@ -3,9 +3,9 @@ from fastapi import HTTPException, status import fidesctl -from fidesapi.database.database import get_db_health -from fidesapi.routes.util import API_PREFIX -from fidesapi.utils.api_router import APIRouter +from fidesctl.api.database.database import get_db_health +from fidesctl.api.routes.util import API_PREFIX +from fidesctl.api.utils.api_router import APIRouter from fidesctl.core.config import FidesctlConfig, get_config CONFIG: FidesctlConfig = get_config() diff --git a/src/fidesapi/routes/util.py b/src/fidesctl/api/routes/util.py similarity index 94% rename from src/fidesapi/routes/util.py rename to src/fidesctl/api/routes/util.py index 167b973ac6c..96c714a763d 100644 --- a/src/fidesapi/routes/util.py +++ b/src/fidesctl/api/routes/util.py @@ -4,11 +4,11 @@ from fastapi import HTTPException, status -from fidesapi.utils.api_router import APIRouter +from fidesctl.api.utils.api_router import APIRouter from fidesctl.core.utils import API_PREFIX as _API_PREFIX API_PREFIX = _API_PREFIX -WEBAPP_DIRECTORY = Path("src/fidesapi/build/static") +WEBAPP_DIRECTORY = Path("src/fidesctl/api/build/static") WEBAPP_INDEX = WEBAPP_DIRECTORY / "index.html" diff --git a/src/fidesapi/routes/validate.py b/src/fidesctl/api/routes/validate.py similarity index 96% rename from src/fidesapi/routes/validate.py rename to src/fidesctl/api/routes/validate.py index 6f2169388fb..ab7cdac35ed 100644 --- a/src/fidesapi/routes/validate.py +++ b/src/fidesctl/api/routes/validate.py @@ -7,12 +7,12 @@ from fastapi import Response, status from pydantic import BaseModel -from fidesapi.routes.util import ( +from fidesctl.api.routes.util import ( API_PREFIX, route_requires_aws_connector, route_requires_okta_connector, ) -from fidesapi.utils.api_router import APIRouter +from fidesctl.api.utils.api_router import APIRouter from fidesctl.connectors.models import ( AWSConfig, ConnectorAuthFailureException, diff --git a/src/fidesapi/routes/visualize.py b/src/fidesctl/api/routes/visualize.py similarity index 90% rename from src/fidesapi/routes/visualize.py rename to src/fidesctl/api/routes/visualize.py index fa0b67f5fcb..0f100875899 100644 --- a/src/fidesapi/routes/visualize.py +++ b/src/fidesctl/api/routes/visualize.py @@ -8,10 +8,10 @@ from fastapi.responses import HTMLResponse from fideslang import model_map -from fidesapi.routes.crud import list_resource -from fidesapi.routes.util import API_PREFIX, get_resource_type -from fidesapi.sql_models import sql_model_map -from fidesapi.utils.api_router import APIRouter +from fidesctl.api.routes.crud import list_resource +from fidesctl.api.routes.util import API_PREFIX, get_resource_type +from fidesctl.api.sql_models import sql_model_map +from fidesctl.api.utils.api_router import APIRouter from fidesctl.core import visualize # pylint: disable=redefined-outer-name,cell-var-from-loop diff --git a/src/fidesapi/sql_models.py b/src/fidesctl/api/sql_models.py similarity index 100% rename from src/fidesapi/sql_models.py rename to src/fidesctl/api/sql_models.py diff --git a/src/fidesapi/utils/__init__.py b/src/fidesctl/api/utils/__init__.py similarity index 100% rename from src/fidesapi/utils/__init__.py rename to src/fidesctl/api/utils/__init__.py diff --git a/src/fidesapi/utils/api_router.py b/src/fidesctl/api/utils/api_router.py similarity index 100% rename from src/fidesapi/utils/api_router.py rename to src/fidesctl/api/utils/api_router.py diff --git a/src/fidesapi/utils/errors.py b/src/fidesctl/api/utils/errors.py similarity index 100% rename from src/fidesapi/utils/errors.py rename to src/fidesctl/api/utils/errors.py diff --git a/src/fidesapi/utils/logger.py b/src/fidesctl/api/utils/logger.py similarity index 96% rename from src/fidesapi/utils/logger.py rename to src/fidesctl/api/utils/logger.py index f80ccc30872..b444cae2cf4 100644 --- a/src/fidesapi/utils/logger.py +++ b/src/fidesctl/api/utils/logger.py @@ -1,5 +1,5 @@ """ -Defines the logging format to be used throughout the fidesapi server code. +Defines the logging format to be used throughout the API server code. """ # pylint: disable=eval-used,no-member @@ -13,7 +13,7 @@ class FidesAPIHandler(logging.Handler): """ - The logging.Handler used by the fidesapi logger. + The logging.Handler used by the api logger. """ def __init__( diff --git a/src/fidesapi/view.py b/src/fidesctl/api/view.py similarity index 92% rename from src/fidesapi/view.py rename to src/fidesctl/api/view.py index ce975c3ffb6..b528d7fe266 100644 --- a/src/fidesapi/view.py +++ b/src/fidesctl/api/view.py @@ -3,9 +3,9 @@ """ from fastapi.responses import HTMLResponse -from fidesapi.routes.crud import list_resource -from fidesapi.sql_models import Evaluation -from fidesapi.utils.api_router import APIRouter +from fidesctl.api.routes.crud import list_resource +from fidesctl.api.sql_models import Evaluation +from fidesctl.api.utils.api_router import APIRouter router = APIRouter( tags=["View"], diff --git a/src/fidesctl/cli/commands/util.py b/src/fidesctl/cli/commands/util.py index b12a2805a93..01878428a93 100644 --- a/src/fidesctl/cli/commands/util.py +++ b/src/fidesctl/cli/commands/util.py @@ -112,6 +112,6 @@ def webserver(ctx: click.Context) -> None: Starts the fidesctl API server using Uvicorn on port 8080. """ # This has to be here to avoid a circular dependency - from fidesapi.main import start_webserver + from fidesctl.api.main import start_webserver start_webserver() diff --git a/src/fidesctl/core/utils.py b/src/fidesctl/core/utils.py index fced99c31d8..f6383b57f37 100644 --- a/src/fidesctl/core/utils.py +++ b/src/fidesctl/core/utils.py @@ -20,7 +20,7 @@ echo_red = partial(click.secho, fg="red", bold=True) echo_green = partial(click.secho, fg="green", bold=True) -# This duplicates a constant in `fidesapi/routes/utils.py` +# This duplicates a constant in `fidesctl/api/routes/utils.py` # To avoid import errors API_PREFIX = "/api/v1" diff --git a/tests/api/test_datamap.py b/tests/api/test_datamap.py index 0716c7db36d..e2e02a58a62 100644 --- a/tests/api/test_datamap.py +++ b/tests/api/test_datamap.py @@ -2,7 +2,7 @@ import pytest from starlette.testclient import TestClient -from fidesapi.routes.util import API_PREFIX +from fidesctl.api.routes.util import API_PREFIX from fidesctl.core.config import FidesctlConfig diff --git a/tests/api/test_generate.py b/tests/api/test_generate.py index c84050e9eac..755da27d9dd 100644 --- a/tests/api/test_generate.py +++ b/tests/api/test_generate.py @@ -5,8 +5,8 @@ import pytest from starlette.testclient import TestClient -from fidesapi.routes.generate import GenerateResponse -from fidesapi.routes.util import API_PREFIX +from fidesctl.api.routes.generate import GenerateResponse +from fidesctl.api.routes.util import API_PREFIX from fidesctl.core.config import FidesctlConfig EXTERNAL_CONFIG_BODY = { diff --git a/tests/api/test_validate.py b/tests/api/test_validate.py index fabfb06e0a8..302958437e4 100644 --- a/tests/api/test_validate.py +++ b/tests/api/test_validate.py @@ -5,8 +5,8 @@ import pytest from starlette.testclient import TestClient -from fidesapi.routes.util import API_PREFIX -from fidesapi.routes.validate import ValidateResponse +from fidesctl.api.routes.util import API_PREFIX +from fidesctl.api.routes.validate import ValidateResponse from fidesctl.core.config import FidesctlConfig EXTERNAL_CONFIG_BODY = { diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py index ff7187b5585..29fd503fcc9 100644 --- a/tests/cli/test_cli.py +++ b/tests/cli/test_cli.py @@ -34,7 +34,7 @@ def test_webserver() -> None: This is specifically meant to catch when the webserver command breaks, without spinning up an additional instance. """ - from fidesapi.main import start_webserver # pylint: disable=unused-import + from fidesctl.api.main import start_webserver # pylint: disable=unused-import assert True diff --git a/tests/conftest.py b/tests/conftest.py index 7ecbf742878..52cc10b388d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,7 +8,7 @@ from fideslang import models from starlette.testclient import TestClient -from fidesapi import main +from fidesctl.api import main from fidesctl.core import api from fidesctl.core.config import FidesctlConfig, get_config diff --git a/tests/core/test_api.py b/tests/core/test_api.py index 72ac2650617..7936610b603 100644 --- a/tests/core/test_api.py +++ b/tests/core/test_api.py @@ -9,7 +9,7 @@ from pytest import MonkeyPatch from starlette.testclient import TestClient -from fidesapi.routes import health +from fidesctl.api.routes import health from fidesctl.core import api as _api from fidesctl.core.config import FidesctlConfig from fidesctl.core.utils import API_PREFIX