Skip to content

Commit

Permalink
[TOOL] Migrate build backend from setuptools to hatchling (#146)
Browse files Browse the repository at this point in the history
* Move project config to pyproject.toml

* Avoid double maintenance of dependencies

* Pin minimal dependency versions

* Update gh workflows
  • Loading branch information
joweich authored Nov 1, 2024
1 parent f28e337 commit efe15df
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install mypy
pip install -r requirements.txt
pip install .
- name: Run MyPy
run: |
mypy chatminer/ --install-types --non-interactive --ignore-missing-imports
4 changes: 2 additions & 2 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install hatch
- name: Build package
run: python -m build
run: hatch build
- name: Publish package
uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install .
- name: Generate coverage report
run: |
pip install pytest
pip install pytest-cov
pytest --cov=chatminer --cov-config=setup.cfg --cov-report=xml test/
pytest --cov=chatminer --cov-report=xml test/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install .
- name: Test with pytest
run: |
pip install pytest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ If you're interested in contributing, running the latest source code, or just li
```sh
git clone https://github.com/joweich/chat-miner.git
cd chat-miner
pip install -r requirements.txt
pip install .
```

## 2. Exporting chat logs
Expand Down
2 changes: 1 addition & 1 deletion chatminer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
#
__version__ = "0.5.3"
__version__ = "0.5.4"
80 changes: 78 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "chat-miner"
dynamic = ["version"]
description = "Lean parsers and visualizations for chat data."
readme = "README.md"
license = "MIT"
requires-python = ">=3.8"
authors = [
{ name = "Jonas Weich", email = "[email protected]" },
]
maintainers = [
{ name = "Jonas Weich", email = "[email protected]" },
]
keywords = [
"chat",
"chatdata",
"messenger",
"parser",
"wordcloud",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"argparse",
"polars[pandas]>=1.0",
"numpy>=1.6.1",
"matplotlib>=3.4",
"wordcloud>=1.9.3",
"python-dateutil>=2.8.2",
"tqdm>=4.66.0",
]

[project.optional-dependencies]
nlp = [
"transformers>=4.40",
]

[project.scripts]
chatminer = "chatminer.cli:main"

[project.urls]
"Bug Tracker" = "https://github.com/joweich/chat-miner/issues"
"Source Code" = "https://github.com/joweich/chat-miner"

[tool.hatch.version]
path = "chatminer/__init__.py"

[tool.hatch.build.targets.sdist]
include = ["/chatminer"]

[tool.hatch.build.targets.wheel]
packages = ["/chatminer"]

[tool.coverage.run]
source = ["chatminer"]
omit = [
"chatminer/cli.py",
"chatminer/nlp.py",
"chatminer/visualizations.py",
"chatminer/__init__.py",
]
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

52 changes: 0 additions & 52 deletions setup.cfg

This file was deleted.

16 changes: 0 additions & 16 deletions setup.py

This file was deleted.

0 comments on commit efe15df

Please sign in to comment.