Skip to content

Commit

Permalink
Fixed issue #45 by addressing how logomaker was handling paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jbkinney committed Jan 30, 2025
1 parent 4cefac6 commit 520c5a1
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 27 deletions.
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include README.rst
include README.md
include LICENSE
recursive-include logomaker/src *
recursive-include logomaker *.py
recursive-include logomaker/data *
recursive-include logomaker/jupyter_notebooks *
recursive-include logomaker/tests *
Expand Down
14 changes: 7 additions & 7 deletions logomaker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
import matplotlib.pyplot as plt

# Local imports
from logomaker.src.Logo import Logo
from logomaker.src.Glyph import Glyph, list_font_names
from logomaker.src.matrix import (
from .src.Logo import Logo
from .src.Glyph import Glyph, list_font_names
from .src.matrix import (
transform_matrix,
sequence_to_matrix,
alignment_to_matrix,
saliency_to_matrix,
validate_matrix
)
from logomaker.src.colors import list_color_schemes
from logomaker.src.examples import (
from .src.colors import list_color_schemes
from .src.examples import (
list_example_matrices,
get_example_matrix,
list_example_datafiles,
open_example_datafile
)
from logomaker.src.error_handling import check, handle_errors, LogomakerError
from logomaker.tests.functional_tests_logomaker import run_tests
from .src.error_handling import check, handle_errors, LogomakerError
from .tests.functional_tests_logomaker import run_tests

@handle_errors
def demo(name: str = 'fig1b') -> plt.Figure:
Expand Down
2 changes: 1 addition & 1 deletion logomaker/examples/demo_logo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# do imports
import matplotlib.pyplot as plt
import logomaker as logomaker
import logomaker # Use the installed package instead of relative import

# make Figure and Axes objects
fig, ax = plt.subplots(1,1,figsize=[4,2])
Expand Down
10 changes: 5 additions & 5 deletions logomaker/src/Logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from matplotlib.axes import Axes

# Import stuff from logomaker
from logomaker.src.Glyph import Glyph
from logomaker.src.validate import validate_matrix, validate_numeric
from logomaker.src.error_handling import check, handle_errors
from logomaker.src.colors import get_color_dict, get_rgb
from logomaker.src.matrix import transform_matrix
from ..src.Glyph import Glyph
from ..src.validate import validate_matrix, validate_numeric
from ..src.error_handling import check, handle_errors
from ..src.colors import get_color_dict, get_rgb
from ..src.matrix import transform_matrix


class Logo:
Expand Down
1 change: 1 addition & 0 deletions logomaker/src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This can remain empty
14 changes: 2 additions & 12 deletions logomaker/tests/functional_tests_logomaker.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
import os
import sys

# Get the directory of the current file
current_dir = os.path.dirname(os.path.abspath(__file__))

# Add the parent directory to the system path
sys.path = [os.path.dirname(current_dir)+'/..'] + sys.path

import logomaker
from logomaker import LogomakerError

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import logomaker
from logomaker.src.error_handling import LogomakerError

global_success_counter = 0
global_fail_counter = 0
Expand Down
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,15 @@ include = [
"logomaker/jupyter_notebooks/*",
"logomaker/tests/*",
"logomaker/examples/*"
]

[tool.hatch.build.targets.wheel]
packages = ["logomaker"]

[tool.hatch.build.targets.sdist]
packages = ["logomaker"]
include = [
"/logomaker",
"LICENSE",
"README.md"
]

0 comments on commit 520c5a1

Please sign in to comment.