airflow-cli 0.1.12__tar.gz → 0.1.14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: airflow-cli
3
- Version: 0.1.12
3
+ Version: 0.1.14
4
4
  Summary: CLI para facilitar o setup de Airflow com Docker.
5
5
  Author-email: LEMA-UFPB <ufpb.lema@gmail.com>
6
6
  License-Expression: MIT
@@ -1,9 +1,7 @@
1
1
  import argparse
2
2
  import logging
3
3
  import sys
4
-
5
- from .env_utils import ensure_venv, is_in_venv
6
- from .os_utils import check_docker, check_os
4
+ from .os_utils import check_docker
7
5
  from .docker_utils import docker_up, docker_down, run_dag, fix_python_code
8
6
 
9
7
  logging.basicConfig(level=logging.INFO,
@@ -29,18 +27,10 @@ def main():
29
27
 
30
28
  args = parser.parse_args()
31
29
 
32
- # Pré-checks antes de qualquer comando
33
- ensure_venv()
34
- if not is_in_venv():
35
- log.warning(
36
- "⚠️ Not running inside virtual environment. Interpreter: %s", sys.executable)
37
-
38
30
  if not check_docker():
39
31
  log.error("❌ Docker not ready.")
40
32
  sys.exit(1)
41
33
 
42
- check_os()
43
-
44
34
  # Execução dos comandos
45
35
  if args.command == "up":
46
36
  docker_up()
@@ -18,6 +18,7 @@ x-airflow-common: &airflow-common
18
18
  AIRFLOW_VAR_DATA_DIR: "/opt/airflow/data"
19
19
  AIRFLOW__CORE__SIMPLE_AUTH_MANAGER_ALL_ADMINS: "true"
20
20
  AIRFLOW__WEBSERVER__SIMPLE_AUTH_MANAGER_USERS: "airflow:admin"
21
+ DOCKER_INSECURE_NO_IPTABLES_RAW: "true"
21
22
  volumes:
22
23
  - ./dags:/opt/airflow/dags
23
24
  user: "50000:0"
@@ -7,38 +7,43 @@ import shutil
7
7
 
8
8
  log = logging.getLogger(__name__)
9
9
 
10
+
10
11
  def docker_up():
11
12
  log.info("🐳 Starting Docker environment...")
12
13
  env = os.environ.copy()
13
14
  env["AIRFLOW_UID"] = "50000"
14
-
15
- # Verifica se já existe docker-compose.yml no diretório atual
15
+ env["AIRFLOW_GID"] = "0"
16
+ env["DOCKER_INSECURE_NO_IPTABLES_RAW"] = "1"
17
+
16
18
  local_compose_file = "docker-compose.yml"
17
19
  if not os.path.exists(local_compose_file):
18
- log.info("📋 Copiando docker-compose.yml para o projeto...")
19
- # Copia o arquivo do pacote para o diretório atual
20
- package_compose_file = os.path.join(os.path.dirname(__file__), "docker-compose.yml")
20
+ log.info("📋 Creating docker-compose.yml ...")
21
+
22
+ package_compose_file = os.path.join(
23
+ os.path.dirname(__file__), "docker-compose.yml")
21
24
  shutil.copy2(package_compose_file, local_compose_file)
22
- log.info("✅ docker-compose.yml copiado com sucesso")
23
-
25
+ log.info("✅ docker-compose.yml create successfully!")
26
+
24
27
  # Verifica se a pasta dags existe
25
28
  dags_path = "dags"
26
29
  if not os.path.exists(dags_path):
27
- log.info("📁 Criando pasta 'dags'...")
30
+ log.info("📁 Create 'dags' directory...")
28
31
  os.makedirs(dags_path, exist_ok=True)
29
-
32
+
30
33
  try:
31
34
  subprocess.run(["docker", "compose", "up", "-d"], env=env, check=True)
32
35
  log.info("✅ Docker environment is ready: http://localhost:8080")
33
36
  except subprocess.CalledProcessError as e:
34
- log.error(f"❌ Erro ao iniciar Docker: {e}")
35
- log.error("Verifique se o Docker está rodando e funcionando corretamente")
37
+ log.error(f"❌ Error Docker: {e}")
38
+ log.error("Check if Docker is running and try again.")
36
39
  raise
37
40
 
41
+
38
42
  def docker_down():
39
43
  log.info("🐳 Stopping Docker environment...")
40
44
  subprocess.run(["docker", "compose", "down"], check=False)
41
45
 
46
+
42
47
  def run_dag():
43
48
  log.info("🚀 Running DAG in Docker...")
44
49
  try:
@@ -55,6 +60,7 @@ def run_dag():
55
60
  except Exception as e:
56
61
  log.error(f"❌ Error running DAG: {e}")
57
62
 
63
+
58
64
  def fix_python_code():
59
65
  log.info("🔧 Running flake8 on 'dags' folder...")
60
66
  try:
@@ -1,9 +1,6 @@
1
1
  import logging
2
- import sys
3
2
  from simple_term_menu import TerminalMenu
4
3
  from .docker_utils import docker_up, docker_down, run_dag, fix_python_code
5
- from .env_utils import ensure_venv, is_in_venv
6
- from .os_utils import check_os, update_docker_compose, check_docker
7
4
 
8
5
  log = logging.getLogger(__name__)
9
6
 
@@ -22,16 +19,6 @@ def show_menu():
22
19
 
23
20
 
24
21
  def run():
25
- ensure_venv()
26
- if not is_in_venv():
27
- log.warning("⚠️ Not running inside the virtual environment.")
28
- log.warning(f"Interpreter: {sys.executable}")
29
-
30
- if not check_docker():
31
- log.error("❌ Docker is not ready.")
32
- return
33
-
34
- check_os()
35
22
 
36
23
  while True:
37
24
  option = show_menu()
@@ -0,0 +1,15 @@
1
+ import logging
2
+ import subprocess
3
+
4
+ log = logging.getLogger(__name__)
5
+
6
+
7
+ def check_docker():
8
+ try:
9
+ subprocess.check_output(["docker", "--version"])
10
+ subprocess.check_output(["docker", "info"])
11
+ log.info("✅ Docker is installed and running.")
12
+ return True
13
+ except Exception as e:
14
+ log.error(f"❌ Docker check failed: {e}")
15
+ return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: airflow-cli
3
- Version: 0.1.12
3
+ Version: 0.1.14
4
4
  Summary: CLI para facilitar o setup de Airflow com Docker.
5
5
  Author-email: LEMA-UFPB <ufpb.lema@gmail.com>
6
6
  License-Expression: MIT
@@ -5,7 +5,6 @@ airflow_cli/__init__.py
5
5
  airflow_cli/cli.py
6
6
  airflow_cli/docker-compose.yml
7
7
  airflow_cli/docker_utils.py
8
- airflow_cli/env_utils.py
9
8
  airflow_cli/menu.py
10
9
  airflow_cli/os_utils.py
11
10
  airflow_cli.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "airflow-cli"
3
- version = "0.1.12"
3
+ version = "0.1.14"
4
4
  description = "CLI para facilitar o setup de Airflow com Docker."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.7"
@@ -1,33 +0,0 @@
1
- import os
2
- import subprocess
3
- import sys
4
- import importlib.util
5
- import logging
6
-
7
- log = logging.getLogger(__name__)
8
-
9
- venv_dir = ".venv"
10
-
11
- def is_in_venv():
12
- return os.path.abspath(sys.prefix).endswith(os.path.abspath(venv_dir))
13
-
14
- def ensure_venv():
15
- if not os.path.exists(venv_dir):
16
- log.info(f"🔄 Creating Python virtual environment at {venv_dir}...")
17
- try:
18
- subprocess.check_call([sys.executable, "-m", "venv", venv_dir])
19
- log.info("✅ Virtual environment created.")
20
- except subprocess.CalledProcessError as e:
21
- log.error(f"❌ Error creating venv: {e}")
22
- return False
23
- return True
24
-
25
- def install_package_if_missing(packages):
26
- for package in packages:
27
- if importlib.util.find_spec(package) is None:
28
- log.info(f"📦 Installing missing package '{package}'...")
29
- try:
30
- subprocess.check_call([sys.executable, "-m", "pip", "install", package])
31
- except subprocess.CalledProcessError as e:
32
- log.error(f"❌ Failed to install '{package}': {e}")
33
- sys.exit(1)
@@ -1,35 +0,0 @@
1
- import platform
2
- import logging
3
- import subprocess
4
- import os
5
- import shutil
6
- import pkg_resources
7
-
8
- log = logging.getLogger(__name__)
9
-
10
- def check_os():
11
- system = platform.system()
12
- if system == "Linux":
13
- try:
14
- with open("/proc/version", "r") as f:
15
- if "microsoft" in f.read().lower():
16
- log.info("✅ Running on WSL (Linux under Windows).")
17
- else:
18
- log.info("✅ Running on native Linux.")
19
- except FileNotFoundError:
20
- log.info("✅ Running on Linux.")
21
- elif system == "Darwin":
22
- log.info("✅ Running on MacOS.")
23
- else:
24
- log.error(f"❌ Unsupported OS: {system}")
25
-
26
- def check_docker():
27
- try:
28
- subprocess.check_output(["docker", "--version"])
29
- subprocess.check_output(["docker", "info"])
30
- log.info("✅ Docker is installed and running.")
31
- return True
32
- except Exception as e:
33
- log.error(f"❌ Docker check failed: {e}")
34
- return False
35
-
File without changes
File without changes
File without changes