Skip to content

Commit

Permalink
fix: simplify package structure and version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewcasale committed Dec 14, 2024
1 parent de225fa commit 218c396
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@
import re

def get_version():
# Try both the source directory and the package directory
possible_paths = [
os.path.join("repominify", "__init__.py"),
os.path.join("repominify", "repominify", "__init__.py"),
]
init_path = os.path.join("repominify", "__init__.py")
try:
with open(init_path, "r") as f:
content = f.read()
version_match = re.search(r'^__version__ = ["\']([^"\']*)["\']', content, re.M)
if version_match:
return version_match.group(1)
except FileNotFoundError:
pass

for init_path in possible_paths:
try:
with open(init_path, "r") as f:
content = f.read()
version_match = re.search(r'^__version__ = ["\']([^"\']*)["\']', content, re.M)
if version_match:
return version_match.group(1)
except FileNotFoundError:
continue

raise RuntimeError("Cannot find version string in __init__.py")
# Fallback to hardcoded version if file not found
return "0.1.3"

setup(
name="repominify",
Expand All @@ -30,16 +25,15 @@ def get_version():
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
url="https://github.com/mikewcasale/repominify",
package_dir={"": "repominify"},
packages=find_namespace_packages(where="repominify", include=["*"]),
packages=find_namespace_packages(include=["repominify", "repominify.*"]),
python_requires=">=3.7",
install_requires=[
"networkx>=2.6.0",
"pyyaml>=5.1.0",
],
entry_points={
"console_scripts": [
"repominify=core.cli:main",
"repominify=repominify.core.cli:main",
],
},
package_data={
Expand Down

0 comments on commit 218c396

Please sign in to comment.