Skip to content

Commit

Permalink
Merge pull request #342 from MSeifert04/pyproject
Browse files Browse the repository at this point in the history
Use pyproject.toml instead of setup.cfg
  • Loading branch information
MSeifert04 authored Oct 12, 2023
2 parents c2803a2 + 66f3c92 commit fdd4b7f
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 90 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cpython-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:
python -m pip install pip setuptools --upgrade
- name: Install package
run: |
CFLAGS="-coverage" python setup.py install # TODO: Check if there's a way with pip install
CFLAGS="-coverage" python -m pip install .
- name: Install test dependencies
run: |
python -m pip install pytest pytest-cov
- name: Run tests
run: |
python -m pytest tests/ --cov=iteration_utilities --cov-report=xml --cov-config=./setup.cfg
python -m pytest tests/ --cov=iteration_utilities --cov-report=xml --cov-config=./pyproject.toml
- name: Upload Coverage report
# It would probably be better to use the codecov-action but that's very slow:
# https://github.com/codecov/codecov-action/issues/21
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/cpython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,16 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install pip setuptools wheel --upgrade
python -m pip install pip setuptools wheel build --upgrade
- name: Create source distribution
run: |
python setup.py sdist
python -m build
- name: Delete wheel
run: |
rm ./dist/*.whl
- name: Install package
run: |
python -m pip install --no-index --find-links=./dist/ iteration_utilities -vv
python -m pip install ./dist/iteration_utilities-0.11.0.tar.gz -vv
- name: Import package
run: |
python -c "import iteration_utilities"
Expand Down
5 changes: 5 additions & 0 deletions docs/CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ Version 0.12.0 (unreleased)

- Python 3.12 compatibility

- Dropped Python 3.5 and 3.6 compatibility.

- The top level ``__version__`` property was removed. ``importlib.metadata.version`` from the
Python standard library should be used if you need the version of ``iteration_utilities``.


Version 0.11.0 (2020-11-19)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
14 changes: 4 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

import sys
import os
import shlex

import importlib.metadata

# #############################################################################
# Get version of the package from the package itself.
Expand All @@ -12,13 +13,6 @@
project = 'iteration_utilities'


def get_version():
with open('../src/{}/__init__.py'.format(project)) as f:
for line in f:
if line.startswith('__version__'):
return line.split(r"'")[1]


# #############################################################################
# Custom stuff
# #############################################################################
Expand Down Expand Up @@ -68,8 +62,8 @@ def get_version():

project = 'iteration_utilities'
copyright = project_startyear + ', ' + author
version = get_version()
release = get_version()
version = importlib.metadata.version("iteration_utilities")
release = importlib.metadata.version("iteration_utilities")
# today
# today_fmt
# highlight_language
Expand Down
61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "iteration_utilities"
version = "0.11.0"
description = "Utilities based on Pythons iterators and generators."
readme = "README.rst"
requires-python = ">=3.7"
authors = [
{name = "Michael Seifert", email = "[email protected]"},
]
license = {text = "Apache License Version 2.0"}

classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"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",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Utilities",
]
keywords = ["functional", "functools", "generator", "itertools", "iteration", "iterator", "operators", "performance", "reduce", "utility"]

[project.urls]
Homepage = "https://github.com/MSeifert04/iteration_utilities"
Documentation = "https://iteration-utilities.readthedocs.io/en/latest/"
Repository = "https://github.com/MSeifert04/iteration_utilities.git"
Changelog = "https://github.com/MSeifert04/iteration_utilities/blob/master/docs/CHANGES.rst"

[project.optional-dependencies]
test = ["pytest"]
documentation = ["sphinx", "numpydoc",]

[tool.pytest.ini_options]
addopts = "--doctest-glob='docs/*.rst' --ignore='setup.py'"
testpaths = [
"tests",
"docs"
]

[tool.coverage.run]
branch = true
omit = [
"setup.py",
"tests/*",
"*_iteration_utilities*"
]

[tool.coverage.report]
show_missing = true
precision = "2"
52 changes: 0 additions & 52 deletions setup.cfg

This file was deleted.

28 changes: 7 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
from setuptools import setup, Extension, find_packages
from setuptools import setup, Extension

from glob import glob
from os import path

import sys


def version():
with open('src/iteration_utilities/__init__.py') as f:
for line in f:
if line.startswith('__version__'):
return line.split(r"'")[1]


files = [
'accumulate.c',
'alldistinct.c',
Expand Down Expand Up @@ -64,16 +55,11 @@ def version():
'_iteration_utilities.c'
]


_iteration_utilities_module = Extension(
'iteration_utilities._iteration_utilities',
sources=[path.join('src', 'iteration_utilities', '_iteration_utilities', filename) for filename in files]
)

setup(
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[path.splitext(path.basename(p))[0] for p in glob('src/*.py')],
version=version(),
ext_modules=[_iteration_utilities_module],
ext_modules=[
Extension(
'iteration_utilities._iteration_utilities',
sources=[path.join('src', 'iteration_utilities', '_iteration_utilities', filename) for filename in files]
)
]
)
2 changes: 0 additions & 2 deletions src/iteration_utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@
from ._recipes import *
from ._additional_recipes import *
from ._classes import *

__version__ = '0.11.0'

0 comments on commit fdd4b7f

Please sign in to comment.