Skip to content

Commit

Permalink
Closes #318.
Browse files Browse the repository at this point in the history
  • Loading branch information
xehu committed Dec 4, 2024
1 parent 0a1b1c6 commit 2ffb9a0
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
src/team_comm_tools/_version.py

# IntelliJ
.idea/
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ recursive-include src/team_comm_tools/features/lexicons *
include src/mypackage/features/assets/*
include README.md
include LICENSE
include requirements.txt
include requirements.txt
include pyproject.toml
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"setuptools >= 42", "wheel"
"setuptools >= 42", "wheel", "toml"
]
build-backend = "setuptools.build_meta"

Expand All @@ -13,6 +13,7 @@ dependencies = [
"convokit==3.0.0",
"emoji==1.7.0",
"flask==3.0.3",
"fuzzywuzzy==0.18.0",
"gensim>=4.3.3",
"matplotlib>=3.0.0",
"nltk==3.9.1",
Expand All @@ -39,8 +40,7 @@ dependencies = [
"transformers==4.44.0",
"tqdm>=4.66.5",
"tzdata>=2023.3",
"tzlocal==5.2",
"fuzzywuzzy==0.18.0"
"tzlocal==5.2"
]
authors = [
{name = "Xinlan Emily Hu", email = "[email protected]"},
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ chardet>=3.0.4
convokit==3.0.0
emoji==1.7.0
flask==3.0.3
fuzzywuzzy==0.18.0
gensim>=4.3.3
matplotlib>=3.0.0
nltk==3.9.1
Expand All @@ -28,5 +29,4 @@ torchvision==0.19.1
transformers==4.44.0
tqdm>=4.66.5
tzdata>=2023.3
tzlocal==5.2
fuzzywuzzy==0.18.0
tzlocal==5.2
31 changes: 31 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from setuptools import setup
from setuptools.command.build_py import build_py
import toml
import os

def get_version_from_pyproject():
with open("pyproject.toml", "r") as f:
pyproject_data = toml.load(f)
return pyproject_data["project"]["version"]

version = get_version_from_pyproject()
version_file = os.path.join(os.path.dirname(__file__), "src/team_comm_tools", "_version.py")
if not os.path.exists(version_file):
with open(version_file, "w") as f:
f.write(f'__version__ = "{version}"\n')

class BuildPyCommand(build_py):
def run(self):
# Generate _version.py before building, which helps automatically update the .__version__ parameter
version = get_version_from_pyproject()
version_path = os.path.join(self.build_lib, "src/team_comm_tools", "_version.py")
os.makedirs(os.path.dirname(version_path), exist_ok=True)
with open(version_path, "w") as f:
f.write(f'__version__ = "{version}"\n')
super().run()

setup(
cmdclass={
'build_py': BuildPyCommand,
}
)
3 changes: 2 additions & 1 deletion src/team_comm_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .feature_builder import FeatureBuilder
from .feature_builder import FeatureBuilder
from ._version import __version__

0 comments on commit 2ffb9a0

Please sign in to comment.