Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#316 - Switch to using plain pyproject.toml #317

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[run]
source=cassis
omit=
setup.py
cassis/__init__.py
cassis/__version__.py
tests/*
docs/*
8 changes: 3 additions & 5 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ jobs:
python-version: '3.11'
- name: Install dependencies
run: |
pip install --upgrade -e .[test]
make dependencies
- name: Run tests
run: |
pytest
run: make unit-tests
- name: Build package
run: |
python setup.py sdist
run: make build
- name: Publish package to TestPyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v4
Expand All @@ -22,17 +22,13 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade -e .[test]
pip install flake8
make dependencies

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
run: make lint

- name: Run tests
run: |
pytest --cov=./ --cov-report=xml
run: make coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
45 changes: 38 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
.PHONY: docs tests
PYTHON_FILES = cassis tests

test:
python -m pytest -m "not performance" tests/
clean:
rm -Rf build dkpro_cassis.egg-info dist

# Dependencies
pin:
rm requirements.txt requirements-dev.txt requirements-doc.txt
pip-compile -o requirements.txt pyproject.toml
pip-compile --extra dev -o requirements-dev.txt pyproject.toml
pip-compile --extra doc -o requirements-doc.txt pyproject.toml

dependencies:
pip install pip-tools
pip-sync requirements.txt requirements-dev.txt

# Tests
unit-tests:
python -m pytest --cov=cassis --cov-branch --cov-fail-under=90 tests

tests: unit-tests integ-tests

coverage:
python -m pytest --cov=cassis --cov-branch --cov-fail-under=90 --cov-report=xml:coverage.xml -m "not performance" tests

# Static analysis/linting
format:
black -l 120 cassis/
black -l 120 tests/
isort --profile black $(PYTHON_FILES) --multi-line=3 --trailing-comma --force-grid-wrap=0 --use-parentheses --line-width=120
ruff format $(PYTHON_FILES)

lint:
# stop the build if there are Python syntax errors or undefined names
ruff check --select=E9,F63,F7,F82 --output-format=full $(PYTHON_FILES)
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
ruff check --exit-zero $(PYTHON_FILES)

# Docs
docs:
cd docs && make html

html:
cd docs && make html
# Building and publishing
build: unit-tests lint
python -m build
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,8 @@ Release

- Make sure all issues for the milestone are completed, otherwise move them to the next
- Checkout the ``main`` branch
- Bump the version in ``cassis/__version__.py`` to a stable one, e.g. ``__version__ = "0.6.0"``, commit and push, wait until the build completed. An example commit message would be ``No issue. Release 0.6.0``
- Bump the version in ``pyproject.toml`` to a stable one, e.g. ``__version__ = "0.6.0"``, commit and push, wait until the build completed. An example commit message would be ``No issue. Release 0.6.0``
- Create a tag for that version via e.g. ``git tag v0.6.0`` and push the tags via ``git push --tags``. Pushing a tag triggers the release to pypi
- Bump the version in ``cassis/__version__.py`` to the next development version, e.g. ``0.7.0-dev``, commit and push that. An example commit message would be ``No issue. Bump version after release``
- Bump the version in ``pyproject.toml`` to the next development version, e.g. ``0.7.0-dev``, commit and push that. An example commit message would be ``No issue. Bump version after release``
- Once the build has completed and pypi accepted the new version, go to the Github release and write the changelog based on the issues in the respective milestone
- Create a new milestone for the next version

1 change: 0 additions & 1 deletion cassis/__version__.py

This file was deleted.

69 changes: 69 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "dkpro-cassis"
version = "0.10.0-dev"
requires-python = ">=3.8"
authors = [ { name = "The DKPro cassis team" } ]
maintainers = [ { name = "Richard Eckart de Castilho" } ]
description = "UIMA CAS processing library in Python"
readme = "README.rst"
license = {file = "LICENSE"}
keywords = []
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"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",
"Topic :: Software Development :: Libraries",
"Topic :: Scientific/Engineering :: Human Machine Interfaces",
"Topic :: Text Processing :: Linguistic"
]
dependencies = [
"lxml~=4.9.1",
"attrs>=21.2,<24",
"sortedcontainers~=2.4",
"toposort~=1.7",
"more-itertools~=8.12",
"deprecation~=2.1",
"importlib_resources~=5.4"
]

[project.optional-dependencies]
dev = [
"pytest~=7.2",
"tox~=3.24",
"lxml-asserts~=0.1",
"pytest-lazy-fixture~=0.6",
"pytest-cov~=3.0",
"codecov~=2.1",
"rstcheck~=3.3",
"docutils~=0.20,!=0.21.*",
"ruff~=0.4.3",
"pip-tools~=7.4.1"
]
doc = [
"sphinx",
"sphinx-autodoc-typehints",
"sphinx-rtd-theme",
"docutils~=0.20,!=0.21.*"
]

[project.urls]
Homepage = "https://dkpro.github.io"
Documentation = "https://cassis.readthedocs.io"
Repository = "https://github.com/dkpro/dkpro-cassis"

[tool.ruff]
line-length = 120
target-version = "py38"

[tool.ruff.lint.per-file-ignores]
"**/{tests,docs,tools}/*" = [ "F403", "F405" ]
116 changes: 116 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --extra=dev --output-file=requirements-dev.txt pyproject.toml
#
attrs==23.2.0
# via dkpro-cassis (pyproject.toml)
build==1.2.1
# via pip-tools
certifi==2024.2.2
# via requests
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via pip-tools
codecov==2.1.13
# via dkpro-cassis (pyproject.toml)
coverage[toml]==7.5.1
# via
# codecov
# pytest-cov
deprecation==2.1.0
# via dkpro-cassis (pyproject.toml)
distlib==0.3.8
# via virtualenv
docutils==0.20.1
# via
# dkpro-cassis (pyproject.toml)
# rstcheck
exceptiongroup==1.2.1
# via pytest
filelock==3.14.0
# via
# tox
# virtualenv
idna==3.7
# via requests
importlib-metadata==7.1.0
# via build
importlib-resources==5.13.0
# via dkpro-cassis (pyproject.toml)
iniconfig==2.0.0
# via pytest
lxml==4.9.4
# via
# dkpro-cassis (pyproject.toml)
# lxml-asserts
lxml-asserts==0.1.2
# via dkpro-cassis (pyproject.toml)
more-itertools==8.14.0
# via dkpro-cassis (pyproject.toml)
packaging==24.0
# via
# build
# deprecation
# pytest
# tox
pip-tools==7.4.1
# via dkpro-cassis (pyproject.toml)
platformdirs==4.2.1
# via virtualenv
pluggy==1.5.0
# via
# pytest
# tox
py==1.11.0
# via tox
pyproject-hooks==1.1.0
# via
# build
# pip-tools
pytest==7.4.4
# via
# dkpro-cassis (pyproject.toml)
# pytest-cov
# pytest-lazy-fixture
pytest-cov==3.0.0
# via dkpro-cassis (pyproject.toml)
pytest-lazy-fixture==0.6.3
# via dkpro-cassis (pyproject.toml)
requests==2.31.0
# via codecov
rstcheck==3.5.0
# via dkpro-cassis (pyproject.toml)
ruff==0.4.3
# via dkpro-cassis (pyproject.toml)
six==1.16.0
# via tox
sortedcontainers==2.4.0
# via dkpro-cassis (pyproject.toml)
tomli==2.0.1
# via
# build
# coverage
# pip-tools
# pytest
# tox
toposort==1.10
# via dkpro-cassis (pyproject.toml)
tox==3.28.0
# via dkpro-cassis (pyproject.toml)
urllib3==2.2.1
# via requests
virtualenv==20.26.1
# via tox
wheel==0.43.0
# via pip-tools
zipp==3.18.1
# via
# importlib-metadata
# importlib-resources

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
85 changes: 85 additions & 0 deletions requirements-doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --extra=doc --output-file=requirements-doc.txt pyproject.toml
#
alabaster==0.7.16
# via sphinx
attrs==23.2.0
# via dkpro-cassis (pyproject.toml)
babel==2.15.0
# via sphinx
certifi==2024.2.2
# via requests
charset-normalizer==3.3.2
# via requests
deprecation==2.1.0
# via dkpro-cassis (pyproject.toml)
docutils==0.20.1
# via
# dkpro-cassis (pyproject.toml)
# sphinx
# sphinx-rtd-theme
idna==3.7
# via requests
imagesize==1.4.1
# via sphinx
importlib-metadata==7.1.0
# via sphinx
importlib-resources==5.13.0
# via dkpro-cassis (pyproject.toml)
jinja2==3.1.4
# via sphinx
lxml==4.9.4
# via dkpro-cassis (pyproject.toml)
markupsafe==2.1.5
# via jinja2
more-itertools==8.14.0
# via dkpro-cassis (pyproject.toml)
packaging==24.0
# via
# deprecation
# sphinx
pygments==2.18.0
# via sphinx
requests==2.31.0
# via sphinx
snowballstemmer==2.2.0
# via sphinx
sortedcontainers==2.4.0
# via dkpro-cassis (pyproject.toml)
sphinx==7.3.7
# via
# dkpro-cassis (pyproject.toml)
# sphinx-autodoc-typehints
# sphinx-rtd-theme
# sphinxcontrib-jquery
sphinx-autodoc-typehints==2.1.0
# via dkpro-cassis (pyproject.toml)
sphinx-rtd-theme==2.0.0
# via dkpro-cassis (pyproject.toml)
sphinxcontrib-applehelp==1.0.8
# via sphinx
sphinxcontrib-devhelp==1.0.6
# via sphinx
sphinxcontrib-htmlhelp==2.0.5
# via sphinx
sphinxcontrib-jquery==4.1
# via sphinx-rtd-theme
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.7
# via sphinx
sphinxcontrib-serializinghtml==1.1.10
# via sphinx
tomli==2.0.1
# via sphinx
toposort==1.10
# via dkpro-cassis (pyproject.toml)
urllib3==2.2.1
# via requests
zipp==3.18.1
# via
# importlib-metadata
# importlib-resources
Loading