From 8aa1cce86676aef6aa38a874b7bf41287a72c0a8 Mon Sep 17 00:00:00 2001 From: Kenneth Enevoldsen Date: Fri, 30 Dec 2022 15:01:46 +0100 Subject: [PATCH] build: transitioned to pyproject.toml --- .github/workflows/documentation.yml | 3 +- .github/workflows/test_and_release.yml | 8 +- MANIFEST.in | 1 - pyproject.toml | 130 +++++++++++++++++++++++++ requirements.txt | 32 ------ setup.cfg | 83 ---------------- setup.py | 9 -- 7 files changed, 137 insertions(+), 129 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 7c43fa26..33da0e8a 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -17,8 +17,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -e . + pip install ".[docs]" - name: Build and Commit uses: sphinx-notes/pages@2.1 with: diff --git a/.github/workflows/test_and_release.yml b/.github/workflows/test_and_release.yml index d0bcbe24..78610c90 100644 --- a/.github/workflows/test_and_release.yml +++ b/.github/workflows/test_and_release.yml @@ -31,8 +31,7 @@ jobs: shell: bash run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install . + pip install ".[tests]" - name: Run and write pytest shell: bash @@ -40,6 +39,11 @@ jobs: set -o pipefail pytest --cov=textdescriptives --cov-report term-missing | tee pytest-coverage.txt + - name: Install dependencies for notebooks + shell: bash + run: | + pip install ".[tutorials]" + - name: Convert and run notebooks shell: bash run: | diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 59badbe4..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include src/textdescriptives/data/spam.csv \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..446b5462 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,130 @@ +[project] +name = "textdescriptives" +version = "2.0.0" +description = "A library for calculating a variety of features from text using spaCy" +authors = [{name = "Lasse Hansen", email = "lasseh0310@gmail.com"}, + {name = "Kenneth Enevoldsen"}] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", +] + +keywords = [ + "NLP", + "spaCy", + "text analysis", + "natural language processing", + "text features", + "text statistics", + "text descriptives", + "text analytics", + "text mining", +] + +dependencies = [ + "spacy>=3.1.0<3.3.0", + "numpy>=1.20.0,<1.24.0", + "pandas>=1.0.0,<1.6.0", + "pyphen>=0.11.0,<0.12.0", + "ftfy>=6.0.3,<6.1.0", +] + +requires-python = ">=3.7" + +[project.urls] +homepage = "https://hlasse.github.io/TextDescriptives/" +repository = "https://github.com/HLasse/textdescriptives" +documentation = "https://hlasse.github.io/TextDescriptives/" + +[project.optional-dependencies] +style = [ + "black==22.8.0", + "pre-commit==2.20.0", + "ruff==0.0.191", + "mypy==0.991" +] +tests = [ + "pytest>=7.1.3,<7.3.0", + "pytest-cov>=3.0.0,<3.0.1", + # the @ allows installing using a link + "en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.2.0/en_core_web_sm-3.2.0.tar.gz", + "en_core_web_sm==3.2.0", +] +docs = [ + "sphinx>=5.3.0,<5.4.0", + "furo==2022.12.7", + "sphinx-copybutton>=0.5.1,<0.5.2", + "sphinxext-opengraph>=0.7.3,<0.7.4", + "myst-nb>=0.6.0,<1.17.0", + "sphinx_design>=0.3.0,<0.3.1", + "autodoc_pydantic>=1.1.0,<1.9.0", +] +tutorials = [ + "jupyter", + "seaborn", + "matplotlib", +] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.license] +file = "LICENSE" +name = "Apache License 2.0" + +[tool.setuptools.package-data] +"*" = ["*/spam.csv"] + +[tool.setuptools.packages.find] +where = ["src"] + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.coverage.run] +omit = [ + "**/tests/*", + "**/_vendorized/*", + "**/about.py", +] + + +exclude_lines = [ + "pragma: no cover", + # Don't complain about missing debug-only code: + "def __unicode__", + "def __repr__", + "if self.debug", + # Don't complain if tests don't hit defensive assertion code: + "raise AssertionError", + "raise NotImplementedError", + # Don't complain if non-runnable code isn't run: + "if 0:", + "if __name__ == .__main__.:", +] + +[tool.semantic_release] +version_variable = [ + "pyproject.toml:version" +] + +[tool.ruff] +exclude = [ + ".venv", + ".env", + ".git", + "__pycache__", +] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 50b430c1..00000000 --- a/requirements.txt +++ /dev/null @@ -1,32 +0,0 @@ -spacy>=3.1.0<3.5.0 -numpy>=1.20.0,<1.24.0 # >1.23.0 needed for Python 3.10 -pandas>=1.0.0,<1.6.0 -pyphen>=0.11.0,<0.12.0 -ftfy>=6.0.3,<6.2.0 - -# for tests -pytest>=7.1.3,<7.3.0 -pytest-cov -https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.2.0/en_core_web_sm-3.2.0.tar.gz -en_core_web_sm==3.2.0 - -# for test of notebooks -jupyter -seaborn -matplotlib - - -# style, development -black==22.8.0 -pre-commit==2.20.0 -ruff==0.0.191 -mypy==0.991 - -# documentation -sphinx>=5.3.0,<5.4.0 -furo==2022.12.7 -sphinx-copybutton>=0.5.1,<0.5.2 -sphinxext-opengraph>=0.7.3,<0.7.4 -myst-nb>=0.6.0,<1.17.0 -sphinx_design>=0.3.0,<0.3.1 -autodoc_pydantic>=1.1.0,<1.9.0 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 8892f5e4..00000000 --- a/setup.cfg +++ /dev/null @@ -1,83 +0,0 @@ -[metadata] -name = textdescriptives -version = 2.0.0 -description = A library for calculating a variety of features from text using spaCy -author = Lasse Hansen -author_email = lasseh0310@gmail.com -url = https://github.com/HLasse/textdescriptives -license = Apache License 2.0 -long_description = file: README.md -long_description_content_type = text/markdown -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Console - Intended Audience :: Developers - Intended Audience :: Science/Research - Topic :: Scientific/Engineering - Topic :: Scientific/Engineering :: Artificial Intelligence - License :: OSI Approved :: MIT License - Operating System :: POSIX :: Linux - Operating System :: MacOS :: MacOS X - Operating System :: Microsoft :: Windows - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 -keywords = - NLP -[options] -package_dir= - =src -packages=find: -include_package_data = true -python_requires = >=3.7 -zip_safe = false -install_requires = - spacy>=3.1.0<3.3.0 - numpy>=1.20.0,<1.24.0 - pandas>=1.0.0,<1.6.0 - pyphen>=0.11.0,<0.12.0 - ftfy>=6.0.3,<6.1.0 -setup_requires = - setuptools - -[options.packages.find] -where=src - -[bdist_wheel] -universal = true - -[sdist] -formats = gztar - -[mypy] -ignore_missing_imports = True -no_implicit_optional = True - -[semantic_release] -branch = "main" -version_variable = "setup.cfg:version" -upload_to_pypi = True -upload_to_release = True - -[coverage:run] - -[coverage:report] -omit = - **/tests/* - **/_vendorized/* - **/about.py -exclude_lines = - pragma: no cover - # Don't complain about missing debug-only code: - def __unicode__ - def __repr__ - if self\.debug - # Don't complain if tests don't hit defensive assertion code: - raise AssertionError - raise NotImplementedError - # Don't complain if non-runnable code isn't run: - if 0: - if __name__ == .__main__.: -show_missing = True - diff --git a/setup.py b/setup.py deleted file mode 100644 index 9f7fa046..00000000 --- a/setup.py +++ /dev/null @@ -1,9 +0,0 @@ -from setuptools import setup - - -def setup_package(): - setup() - - -if __name__ == "__main__": - setup_package()