From cbc27c7b4ad2f83d096cfb535c21893e94f3206a Mon Sep 17 00:00:00 2001 From: DataGreed Date: Tue, 5 Apr 2022 18:13:26 +0100 Subject: [PATCH] fixed package import for usage as an external library --- main.py | 2 +- polytracker2midi.py | 4 ++-- polytracker2text.py | 3 +-- polytrackermidi.py | 6 ------ polytrackermidi/__init__.py | 2 ++ {exporters => polytrackermidi/exporters}/__init__.py | 0 {exporters => polytrackermidi/exporters}/midi.py | 6 ++---- {parsers => polytrackermidi/parsers}/__init__.py | 0 {parsers => polytrackermidi/parsers}/arps.py | 2 +- {parsers => polytrackermidi/parsers}/chords.py | 3 +-- {parsers => polytrackermidi/parsers}/constants.py | 0 {parsers => polytrackermidi/parsers}/patterns.py | 0 {parsers => polytrackermidi/parsers}/project.py | 2 +- setup.py | 4 ++-- 14 files changed, 13 insertions(+), 21 deletions(-) delete mode 100644 polytrackermidi.py create mode 100644 polytrackermidi/__init__.py rename {exporters => polytrackermidi/exporters}/__init__.py (100%) rename {exporters => polytrackermidi/exporters}/midi.py (99%) rename {parsers => polytrackermidi/parsers}/__init__.py (100%) rename {parsers => polytrackermidi/parsers}/arps.py (99%) rename {parsers => polytrackermidi/parsers}/chords.py (99%) rename {parsers => polytrackermidi/parsers}/constants.py (100%) rename {parsers => polytrackermidi/parsers}/patterns.py (100%) rename {parsers => polytrackermidi/parsers}/project.py (99%) diff --git a/main.py b/main.py index c3dafe3..5b5519d 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ if __name__ == '__main__': - from parsers import patterns, project + from polytrackermidi.parsers import project # # todo: remove this and implement tests # p = patterns.PatternParser( diff --git a/polytracker2midi.py b/polytracker2midi.py index cac7502..62f951f 100644 --- a/polytracker2midi.py +++ b/polytracker2midi.py @@ -2,8 +2,8 @@ import sys from sys import argv -from parsers import patterns, project -from exporters import midi +from polytrackermidi.parsers import patterns, project +from polytrackermidi.exporters import midi def print_usage(message="", exit_program=True, exit_code=1): diff --git a/polytracker2text.py b/polytracker2text.py index d1a7bee..48348a3 100644 --- a/polytracker2text.py +++ b/polytracker2text.py @@ -2,8 +2,7 @@ import sys from sys import argv -from parsers import patterns -from exporters import midi +from polytrackermidi.parsers import patterns def print_usage(message="", exit_program=True, exit_code=1): diff --git a/polytrackermidi.py b/polytrackermidi.py deleted file mode 100644 index 6dac3fa..0000000 --- a/polytrackermidi.py +++ /dev/null @@ -1,6 +0,0 @@ -import exporters -import parsers - -__author__ = "Alexey 'DataGreed' Strelkov" - -__all__ = ['exporters', 'parsers', '__author__'] diff --git a/polytrackermidi/__init__.py b/polytrackermidi/__init__.py new file mode 100644 index 0000000..078ec53 --- /dev/null +++ b/polytrackermidi/__init__.py @@ -0,0 +1,2 @@ +__author__ = "Alexey 'DataGreed' Strelkov" +__all__ = ['exporters', 'parsers'] \ No newline at end of file diff --git a/exporters/__init__.py b/polytrackermidi/exporters/__init__.py similarity index 100% rename from exporters/__init__.py rename to polytrackermidi/exporters/__init__.py diff --git a/exporters/midi.py b/polytrackermidi/exporters/midi.py similarity index 99% rename from exporters/midi.py rename to polytrackermidi/exporters/midi.py index 8fbcd24..0658d83 100644 --- a/exporters/midi.py +++ b/polytrackermidi/exporters/midi.py @@ -1,11 +1,9 @@ from typing import Optional -from midiutil.MidiFile import NoteOff - -from parsers.patterns import Pattern, Note +from polytrackermidi.parsers.patterns import Pattern, Note from midiutil import MIDIFile -from parsers.project import Song +from polytrackermidi.parsers.project import Song class BaseMidiExporter: diff --git a/parsers/__init__.py b/polytrackermidi/parsers/__init__.py similarity index 100% rename from parsers/__init__.py rename to polytrackermidi/parsers/__init__.py diff --git a/parsers/arps.py b/polytrackermidi/parsers/arps.py similarity index 99% rename from parsers/arps.py rename to polytrackermidi/parsers/arps.py index cba9a3d..71b96e5 100644 --- a/parsers/arps.py +++ b/polytrackermidi/parsers/arps.py @@ -2,7 +2,7 @@ import random from enum import Enum -from parsers.chords import Chord +from polytrackermidi.parsers.chords import Chord class ArpDirection(Enum): raising = 1 diff --git a/parsers/chords.py b/polytrackermidi/parsers/chords.py similarity index 99% rename from parsers/chords.py rename to polytrackermidi/parsers/chords.py index 7a0948b..09e4ab2 100644 --- a/parsers/chords.py +++ b/polytrackermidi/parsers/chords.py @@ -1,7 +1,6 @@ -from copy import deepcopy from typing import List -from parsers.patterns import Note +from polytrackermidi.parsers.patterns import Note class Chord: diff --git a/parsers/constants.py b/polytrackermidi/parsers/constants.py similarity index 100% rename from parsers/constants.py rename to polytrackermidi/parsers/constants.py diff --git a/parsers/patterns.py b/polytrackermidi/parsers/patterns.py similarity index 100% rename from parsers/patterns.py rename to polytrackermidi/parsers/patterns.py diff --git a/parsers/project.py b/polytrackermidi/parsers/project.py similarity index 99% rename from parsers/project.py rename to polytrackermidi/parsers/project.py index 83dd5f7..cb491e2 100644 --- a/parsers/project.py +++ b/polytrackermidi/parsers/project.py @@ -6,7 +6,7 @@ import struct from typing import List, Dict -from parsers.patterns import Pattern +from polytrackermidi.parsers.patterns import Pattern class Song: diff --git a/setup.py b/setup.py index 7317a69..c8e9f2d 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ requirements = fh.read() setup( name = 'polyendtracker-midi-export', - version = '0.2.4', + version = '0.3.0', author = 'Alexey Strelkov', author_email = 'datagreed@gmail.com', license = 'MIT License', @@ -13,7 +13,7 @@ long_description = long_description, long_description_content_type = "text/markdown", url = 'https://github.com/DataGreed/polyendtracker-midi-export', - py_modules = ['polytrackermidi'], + # py_modules = ['polytrackermidi'], packages = find_packages(), install_requires = [requirements], python_requires='>=3.7',