Skip to content

Commit

Permalink
Merge branch 'main' into 16-adding-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thomass-dev committed Jul 16, 2024
2 parents 8955919 + 1011751 commit 3803faa
Show file tree
Hide file tree
Showing 24 changed files with 527 additions and 189 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,7 @@ cython_debug/
#.idea/
.datamander
.DS_Store


# Visual studio code
.vscode
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ pip-compile:
install:
python -m pip install -e . -r requirements.txt -r requirements-test.txt
pre-commit install

check-wip:
pre-commit run --all-files
python -m pytest tests
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies = [
"rich",
"scikit-learn",
"srsly",
"fastapi",
]

[project.optional-dependencies]
Expand Down
92 changes: 85 additions & 7 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
#
altair==5.3.0
# via mandr (pyproject.toml)
annotated-types==0.7.0
# via pydantic
anyio==4.4.0
# via
# httpx
# starlette
# watchfiles
attrs==23.2.0
# via
# jsonschema
Expand All @@ -14,34 +21,65 @@ blinker==1.8.2
# via flask
catalogue==2.0.10
# via srsly
certifi==2024.7.4
# via
# httpcore
# httpx
cfgv==3.4.0
# via pre-commit
click==8.1.7
# via flask
# via
# flask
# typer
# uvicorn
coverage[toml]==7.5.4
# via pytest-cov
diskcache==5.6.3
# via mandr (pyproject.toml)
distlib==0.3.8
# via virtualenv
dnspython==2.6.1
# via email-validator
email-validator==2.2.0
# via fastapi
fastapi==0.111.0
# via mandr (pyproject.toml)
fastapi-cli==0.0.4
# via fastapi
filelock==3.15.4
# via virtualenv
flask==3.0.3
# via mandr (pyproject.toml)
identify==2.5.36
h11==0.14.0
# via
# httpcore
# uvicorn
httpcore==1.0.5
# via httpx
httptools==0.6.1
# via uvicorn
httpx==0.27.0
# via fastapi
identify==2.6.0
# via pre-commit
idna==3.7
# via
# anyio
# email-validator
# httpx
iniconfig==2.0.0
# via pytest
itsdangerous==2.2.0
# via flask
jinja2==3.1.4
# via
# altair
# fastapi
# flask
# mandr (pyproject.toml)
joblib==1.4.2
# via scikit-learn
jsonschema==4.22.0
jsonschema==4.23.0
# via altair
jsonschema-specifications==2023.12.1
# via jsonschema
Expand All @@ -63,6 +101,8 @@ numpy==2.0.0
# pandas
# scikit-learn
# scipy
orjson==3.10.6
# via fastapi
packaging==24.1
# via
# altair
Expand All @@ -77,6 +117,10 @@ pluggy==1.5.0
# via pytest
pre-commit==3.7.1
# via mandr (pyproject.toml)
pydantic==2.8.2
# via fastapi
pydantic-core==2.20.1
# via pydantic
pygments==2.18.0
# via rich
pytest==8.2.2
Expand All @@ -87,37 +131,71 @@ pytest-cov==5.0.0
# via mandr (pyproject.toml)
python-dateutil==2.9.0.post0
# via pandas
python-dotenv==1.0.1
# via uvicorn
python-multipart==0.0.9
# via fastapi
pytz==2024.1
# via pandas
pyyaml==6.0.1
# via pre-commit
# via
# pre-commit
# uvicorn
referencing==0.35.1
# via
# jsonschema
# jsonschema-specifications
rich==13.7.1
# via mandr (pyproject.toml)
rpds-py==0.18.1
# via
# mandr (pyproject.toml)
# typer
rpds-py==0.19.0
# via
# jsonschema
# referencing
ruff==0.5.0
ruff==0.5.1
# via mandr (pyproject.toml)
scikit-learn==1.5.1
# via mandr (pyproject.toml)
scipy==1.14.0
# via scikit-learn
shellingham==1.5.4
# via typer
six==1.16.0
# via python-dateutil
sniffio==1.3.1
# via
# anyio
# httpx
srsly==2.4.8
# via mandr (pyproject.toml)
starlette==0.37.2
# via fastapi
threadpoolctl==3.5.0
# via scikit-learn
toolz==0.12.1
# via altair
typer==0.12.3
# via fastapi-cli
typing-extensions==4.12.2
# via
# fastapi
# pydantic
# pydantic-core
# typer
tzdata==2024.1
# via pandas
ujson==5.10.0
# via fastapi
uvicorn[standard]==0.30.1
# via fastapi
uvloop==0.19.0
# via uvicorn
virtualenv==20.26.3
# via pre-commit
watchfiles==0.22.0
# via uvicorn
websockets==12.0
# via uvicorn
werkzeug==3.0.3
# via flask
86 changes: 82 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
#
altair==5.3.0
# via mandr (pyproject.toml)
annotated-types==0.7.0
# via pydantic
anyio==4.4.0
# via
# httpx
# starlette
# watchfiles
attrs==23.2.0
# via
# jsonschema
Expand All @@ -14,22 +21,53 @@ blinker==1.8.2
# via flask
catalogue==2.0.10
# via srsly
certifi==2024.7.4
# via
# httpcore
# httpx
click==8.1.7
# via flask
# via
# flask
# typer
# uvicorn
diskcache==5.6.3
# via mandr (pyproject.toml)
dnspython==2.6.1
# via email-validator
email-validator==2.2.0
# via fastapi
fastapi==0.111.0
# via mandr (pyproject.toml)
fastapi-cli==0.0.4
# via fastapi
flask==3.0.3
# via mandr (pyproject.toml)
h11==0.14.0
# via
# httpcore
# uvicorn
httpcore==1.0.5
# via httpx
httptools==0.6.1
# via uvicorn
httpx==0.27.0
# via fastapi
idna==3.7
# via
# anyio
# email-validator
# httpx
itsdangerous==2.2.0
# via flask
jinja2==3.1.4
# via
# altair
# fastapi
# flask
# mandr (pyproject.toml)
joblib==1.4.2
# via scikit-learn
jsonschema==4.22.0
jsonschema==4.23.0
# via altair
jsonschema-specifications==2023.12.1
# via jsonschema
Expand All @@ -49,41 +87,81 @@ numpy==2.0.0
# pandas
# scikit-learn
# scipy
orjson==3.10.6
# via fastapi
packaging==24.1
# via altair
pandas==2.2.2
# via
# altair
# mandr (pyproject.toml)
pydantic==2.8.2
# via fastapi
pydantic-core==2.20.1
# via pydantic
pygments==2.18.0
# via rich
python-dateutil==2.9.0.post0
# via pandas
python-dotenv==1.0.1
# via uvicorn
python-multipart==0.0.9
# via fastapi
pytz==2024.1
# via pandas
pyyaml==6.0.1
# via uvicorn
referencing==0.35.1
# via
# jsonschema
# jsonschema-specifications
rich==13.7.1
# via mandr (pyproject.toml)
rpds-py==0.18.1
# via
# mandr (pyproject.toml)
# typer
rpds-py==0.19.0
# via
# jsonschema
# referencing
scikit-learn==1.5.1
# via mandr (pyproject.toml)
scipy==1.14.0
# via scikit-learn
shellingham==1.5.4
# via typer
six==1.16.0
# via python-dateutil
sniffio==1.3.1
# via
# anyio
# httpx
srsly==2.4.8
# via mandr (pyproject.toml)
starlette==0.37.2
# via fastapi
threadpoolctl==3.5.0
# via scikit-learn
toolz==0.12.1
# via altair
typer==0.12.3
# via fastapi-cli
typing-extensions==4.12.2
# via
# fastapi
# pydantic
# pydantic-core
# typer
tzdata==2024.1
# via pandas
ujson==5.10.0
# via fastapi
uvicorn[standard]==0.30.1
# via fastapi
uvloop==0.19.0
# via uvicorn
watchfiles==0.22.0
# via uvicorn
websockets==12.0
# via uvicorn
werkzeug==3.0.3
# via flask
30 changes: 29 additions & 1 deletion src/mandr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
"""Povide the InfoMander class for managing information in a data science project."""
"""Provide the InfoMander class for managing information in a data science project."""

import logging

import rich.logging

from .infomander import InfoMander

__all__ = ["InfoMander"]


class Handler(rich.logging.RichHandler):
"""A logging handler that renders output with Rich."""

def get_level_text(self, record: rich.logging.LogRecord) -> rich.logging.Text:
"""Get the logger name and levelname from the record."""
levelname = record.levelname
name = record.name
txt = f"<Logger {name} ({levelname})>"

return rich.logging.Text.styled(
txt.ljust(8),
f"logging.level.{levelname.lower()}",
)


formatter = logging.Formatter("%(message)s")
handler = Handler(markup=True)
handler.setFormatter(formatter)

logger = logging.getLogger(__name__)
logger.addHandler(handler)
logger.setLevel(logging.INFO)
6 changes: 0 additions & 6 deletions src/mandr/__main__.py

This file was deleted.

Loading

0 comments on commit 3803faa

Please sign in to comment.