Skip to content

Commit

Permalink
packaging: setup.cfg, pyproject.toml, setuptools_scm
Browse files Browse the repository at this point in the history
  • Loading branch information
dhimmel committed Apr 4, 2021
1 parent 90d7fab commit 2d1ea87
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 50 deletions.
17 changes: 16 additions & 1 deletion obonet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
from .read import read_obo

__version__ = "0.2.6"
__all__ = [
"read_obo",
]


def _get_version():
# https://github.com/pypa/setuptools_scm#retrieving-package-version-at-runtime
from pkg_resources import DistributionNotFound, get_distribution

try:
return get_distribution("obonet").version
except DistributionNotFound:
return None


__version__ = _get_version()
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
# including this section enables version inference
64 changes: 64 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[metadata]
name = obonet
author = Daniel Himmelstein
author_email = daniel.himmelstein@gmail.com
license = BSD-2-Clause-Patent
license_file = LICENSE.md
description = Parse OBO formatted ontologies into networkx
long_description = file: README.md
long_description_content_type = text/markdown; charset=UTF-8
url = https://github.com/dhimmel/obonet
project_urls =
Source = https://github.com/dhimmel/obonet
Tracker = https://github.com/dhimmel/obonet/issues
classifiers =
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
# "License :: OSI Approved :: BSD 2-Clause Plus Patent License (BSD-2-Clause-Patent)",
# not a valid classifier. see https://github.com/pypa/trove-classifiers/issues/17
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Topic :: Scientific/Engineering :: Bio-Informatics
Topic :: Scientific/Engineering :: Information Analysis
keywords =
obo
ontology
networkx
parser
network

[options]
packages = obonet
zip_safe = False
include_package_data = True
python_requires = >=3
install_requires =
networkx

[options.extras_require]
dev =
pre-commit
pytest

[flake8]
ignore =
E203
E402
E501
E731
W503

[isort]
profile = black
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
line_length = 88

[mypy-networkx.*,setuptools.*,pytest.*,_pytest.*]
ignore_missing_imports = True
[mypy-*.tests.*]
disallow_untyped_defs = False
disallow_untyped_decorators = False
51 changes: 2 additions & 49 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,3 @@
import pathlib
import re
from setuptools import setup

import setuptools

directory = pathlib.Path(__file__).parent.absolute()

# version
init_path = directory.joinpath("obonet", "__init__.py")
with init_path.open() as read_file:
text = read_file.read()
pattern = re.compile(r"^__version__ = ['\"]([^'\"]*)['\"]", re.MULTILINE)
version = pattern.search(text).group(1)

# long_description
readme_path = directory.joinpath("README.md")
with readme_path.open() as read_file:
long_description = read_file.read()

setuptools.setup(
name="obonet",
version=version,
author="Daniel Himmelstein",
author_email="daniel.himmelstein@gmail.com",
url="https://github.com/dhimmel/obonet",
project_urls={
"Source": "https://github.com/dhimmel/obonet",
"Tracker": "https://github.com/dhimmel/obonet/issues",
},
description="Parse OBO formatted ontologies into networkx",
long_description_content_type="text/markdown",
long_description=long_description,
license="BSD-2-Clause-Patent",
packages=["obonet"],
keywords="obo ontology networkx parser network",
classifiers=[
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Information Analysis",
"License :: OSI Approved :: BSD License",
# not a valid classifier. see https://github.com/pypa/trove-classifiers/issues/17
# "License :: OSI Approved :: BSD 2-Clause Plus Patent License (BSD-2-Clause-Patent)",
"Programming Language :: Python :: 3",
],
# Dependencies
python_requires=">=3",
install_requires=[
"networkx",
],
)
setup()

0 comments on commit 2d1ea87

Please sign in to comment.