Skip to content

Commit

Permalink
Try a lazy import on requests so not required during setup
Browse files Browse the repository at this point in the history
byteface committed Dec 8, 2024
1 parent 8d06dde commit 375b609
Showing 2 changed files with 8 additions and 16 deletions.
3 changes: 1 addition & 2 deletions domonic/__init__.py
Original file line number Diff line number Diff line change
@@ -15,8 +15,6 @@

import re

import requests

# from domonic.components import Input
from domonic.html import *
from domonic.html import html_attributes as attributes
@@ -33,6 +31,7 @@ class domonic:
@staticmethod
def get(url: str):
"""downloads html and converts to domonic"""
import requests
r = requests.get(url)
return domonic.parse(r.content.decode("utf-8"))
# TODO - param to eval
21 changes: 7 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -19,22 +19,15 @@ def read(filename: str) -> str:
with open(filename, encoding="utf-8") as file:
return file.read()

# def get_requirements(filename: str = "requirements.txt"):
# """returns a list of all requirements"""
# requirements = read(filename)
# return list(
# filter(
# None,
# [req.strip() for req in requirements.split() if not req.startswith("#")],
# )
# )

def get_requirements(filename: str = "requirements.txt"):
"""returns a list of all requirements"""
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
requirements = f.read().splitlines()
return [req.strip() for req in requirements if req and not req.startswith("#")]

requirements = read(filename)
return list(
filter(
None,
[req.strip() for req in requirements.split() if not req.startswith("#")],
)
)

setup(
name="domonic",

0 comments on commit 375b609

Please sign in to comment.