Skip to content

Commit

Permalink
setup: migrate steup.py to setup.cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorrell committed Mar 21, 2024
1 parent 2483c83 commit 1a7fe9c
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 123 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- name: Generate dependencies
run: |
python -m pip install --upgrade pip setuptools py wheel requirements-builder
pip install wheel requirements-builder
requirements-builder -e all --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt
- name: Cache pip
Expand Down
3 changes: 2 additions & 1 deletion datacite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from .client import DataCiteMDSClient
from .rest_client import DataCiteRESTClient
from .version import __version__

__version__ = "1.1.4"

__all__ = ('DataCiteMDSClient', 'DataCiteRESTClient', '__version__')
23 changes: 0 additions & 23 deletions datacite/version.py

This file was deleted.

15 changes: 2 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

"""Sphinx configuration."""

import os
import sphinx.environment
from docutils.utils import get_source_line
from datacite import __version__

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -54,19 +54,8 @@
project = u'datacite'
copyright = u'2015-2016, CERN'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.

g = {}
with open(os.path.join('..', 'datacite', 'version.py'), 'rt') as fp:
exec(fp.read(), g)
version = g['__version__']

# The full version, including alpha/beta/rc tags.
release = version
release = __version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

13 changes: 0 additions & 13 deletions pytest.ini

This file was deleted.

2 changes: 1 addition & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set -o errexit
# Quit on unbound symbols
set -o nounset

python -m check_manifest --ignore ".*-requirements.txt"
python -m check_manifest
python -m sphinx.cmd.build -qnNW docs docs/_build/html
python -m pytest
python -m sphinx.cmd.build -qnNW -b doctest docs docs/_build/doctest
49 changes: 47 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
# This file is part of DataCite.
#
# Copyright (C) 2015, 2016 CERN.
# Copyright (C) 2024, California Institute of Technology
#
# DataCite is free software; you can redistribute it and/or modify it
# under the terms of the Revised BSD License; see LICENSE file for
# more details.

[aliases]
test = pytest
[metadata]
name = datacite
license= BSD
version = attr: datacite.__version__
description = "A Python client for DataCite MDS and REST APIs."
long_description = file: README.rst, CHANGES.rst
keywords = datacite doi
author = Invenio Collaboration
author_email = info@inveniosoftware.org
url = https://github.com/inveniosoftware/datacite
classifiers =
Programming Language :: Python :: 3
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Topic :: Utilities

[options]
include_package_data = True
packages = find:
zip_safe = False
install_requires =
jsonschema>=3.0.0
lxml>=4.5.2
requests>=2.12.2
idutils>=1.0.0

[options.extras_require]
tests =
responses>=0.10.6
mock>=1.3.0
pytest-invenio>=1.4.0
pytest-black-ng>=0.4.0
datacite[docs]
docs = Sphinx>=4.5.0
all = datacite[tests]

[build_sphinx]
source-dir = docs/
Expand All @@ -19,3 +55,12 @@ universal = 1

[pydocstyle]
add_ignore = D401

[isort]
profile=black

[tool:pytest]
addopts = --black --isort --pydocstyle --doctest-glob="*.rst" --doctest-modules --cov=datacite --cov-report=term-missing
testpaths = docs tests datacite
norecursedirs = tests/example
markers = pw: tests that require a password (will only run with '--runpw' option)
73 changes: 4 additions & 69 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,15 @@
# This file is part of DataCite.
#
# Copyright (C) 2015, 2016 CERN.
# Copyright (C) 2024, California Institute of Technology.
#
# DataCite is free software; you can redistribute it and/or modify it
# under the terms of the Revised BSD License; see LICENSE file for
# more details.

"""Python API wrapper for the DataCite Metadata Store API."""
"""Python API wrapper for the DataCite Metadata Store and REST APIs."""

import os

from setuptools import find_packages, setup
from setuptools import setup

readme = open('README.rst').read()
history = open('CHANGES.rst').read()

tests_require = [
'responses>=0.10.6',
'mock>=1.3.0',
'pytest-invenio>=1.4.0',
]

extras_require = {
'docs': [
'Sphinx>=4.5.0',
],
'tests': tests_require,
}

extras_require['all'] = []
for reqs in extras_require.values():
extras_require['all'].extend(reqs)

setup_requires = [
'pytest-runner>=2.6.2',
]

install_requires = [
'jsonschema>=3.0.0',
'lxml>=4.5.2',
'requests>=2.12.2',
'idutils>=1.0.0'
]

packages = find_packages()

# Get the version string. Cannot be done with import!
g = {}
with open(os.path.join('datacite', 'version.py'), 'rt') as fp:
exec(fp.read(), g)
version = g['__version__']

setup(
name='datacite',
license='BSD',
version=version,
description=__doc__,
long_description=readme + '\n\n' + history,
author='Invenio Collaboration',
author_email='info@inveniosoftware.org',
url='https://github.com/inveniosoftware/datacite',
include_package_data=True,
packages=packages,
zip_safe=False,
extras_require=extras_require,
install_requires=install_requires,
setup_requires=setup_requires,
tests_require=tests_require,
classifiers=[
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Topic :: Utilities',
],
)
setup()

0 comments on commit 1a7fe9c

Please sign in to comment.