Skip to content

Commit

Permalink
Merge pull request #121 from tobias-urdin/pep517
Browse files Browse the repository at this point in the history
Change build system
  • Loading branch information
tobias-urdin committed Aug 1, 2022
2 parents 000aad5 + afcf990 commit e2075f0
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 52 deletions.
1 change: 1 addition & 0 deletions .github/workflows/python-gnocchiclient.yml
Expand Up @@ -12,6 +12,7 @@ jobs:
matrix:
env:
- docs-gnocchi-web
- build
- pep8
- py36
- py38
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Expand Up @@ -20,10 +20,6 @@ pip-log.txt
# Sphinx
doc/build

# pbr generates these
AUTHORS
ChangeLog

# generated docs
doc/source/api
doc/source/gnocchi.rst
Expand Down
2 changes: 2 additions & 0 deletions .mergify.yml
Expand Up @@ -2,6 +2,7 @@ queue_rules:
- name: default
conditions:
- check-success=test (docs-gnocchi-web)
- check-success=test (build)
- check-success=test (pep8)
- check-success=test (py36)
- check-success=test (py38)
Expand All @@ -17,6 +18,7 @@ pull_request_rules:
- label!=work-in-progress
- '#approved-reviews-by>=1'
- check-success=test (docs-gnocchi-web)
- check-success=test (build)
- check-success=test (pep8)
- check-success=test (py36)
- check-success=test (py38)
Expand Down
7 changes: 3 additions & 4 deletions doc/source/conf.py
Expand Up @@ -11,7 +11,7 @@
# serve to show the default.

import datetime
import subprocess
import pkg_resources

# 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 @@ -51,9 +51,8 @@
# built documents.
#
# The short X.Y version.
version = subprocess.Popen(['sh', '-c', 'cd ../..; python setup.py --version'],
stdout=subprocess.PIPE).stdout.read()
version = version.strip()
version = pkg_resources.get_distribution('gnocchiclient').version

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

Expand Down
8 changes: 6 additions & 2 deletions gnocchiclient/version.py
Expand Up @@ -12,7 +12,11 @@
# under the License.
#

import pbr.version
import pkg_resources


__version__ = pbr.version.VersionInfo('gnocchiclient').version_string()
try:
__version__ = pkg_resources.get_distribution('gnocchiclient').version
except pkg_resources.DistributionNotFound:
# package is not installed
pass
5 changes: 5 additions & 0 deletions pyproject.toml
@@ -0,0 +1,5 @@
[build-system]
requires = ["setuptools", "setuptools_scm", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
13 changes: 0 additions & 13 deletions requirements.txt

This file was deleted.

51 changes: 30 additions & 21 deletions setup.cfg
Expand Up @@ -5,20 +5,47 @@ description_file =
README.rst
author = Gnocchi
home_page = http://gnocchi.osci.io/gnocchiclient
python_requires = >=3.6
classifier =
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9

[files]
[options]
packages =
gnocchiclient

[entry_points]
install_requires =
cliff>=2.10 # Apache-2.0
ujson
keystoneauth1>=2.0.0
six
futurist
iso8601
python-dateutil
debtcollector

[options.extras_require]
test =
python-openstackclient
pytest
pytest-xdist

doc =
sphinx
sphinx_rtd_theme

openstack =
osc-lib>=0.3.0 # Apache-2.0

[options.entry_points]
console_scripts =
gnocchi = gnocchiclient.shell:main

Expand Down Expand Up @@ -71,19 +98,6 @@ openstack.metric.v1 =
metric_benchmark measures add = gnocchiclient.benchmark:CliBenchmarkMeasuresAdd
metric_benchmark measures show = gnocchiclient.benchmark:CliBenchmarkMeasuresShow

[extras]
test =
python-openstackclient
pytest
pytest-xdist

doc =
sphinx!=1.2.0,!=1.3b1,>=1.1.2
sphinx_rtd_theme

openstack =
osc-lib>=0.3.0 # Apache-2.0

[build_sphinx]
source-dir = doc/source
build-dir = doc/build
Expand All @@ -92,10 +106,5 @@ all_files = 1
[upload_sphinx]
upload-dir = doc/build/html

[pbr]
autodoc_index_modules = true
autodoc_exclude_modules =
gnocchiclient.tests.*

[wheel]
universal = 1
16 changes: 9 additions & 7 deletions setup.py
Expand Up @@ -13,17 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools

# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215

cmdclass = {}

try:
import multiprocessing # noqa
from sphinx import setup_command
cmdclass['build_sphinx'] = setup_command.BuildDoc
except ImportError:
pass


setuptools.setup(
setup_requires=['pbr'],
pbr=True)
cmdclass=cmdclass,
py_modules=[],
)
10 changes: 9 additions & 1 deletion tox.ini
Expand Up @@ -4,7 +4,10 @@ envlist = py36,py38,py39,pep8,docs-gnocchi-web
skipsdist = True

[testenv]
basepython = python3
basepython =
py36: {env:TOXPYTHON:python3.6}
py38: {env:TOXPYTHON:python3.8}
py39: {env:TOXPYTHON:python3.9}
usedevelop = True
setenv =
VIRTUAL_ENV={envdir}
Expand All @@ -18,6 +21,11 @@ deps = .[test,openstack]
# TODO(tobias-urdin): Skip benchmark tests since they just hang right now.
commands = pifpaf run gnocchi -- pytest -k 'not test_benchmark_' {posargs:gnocchiclient/tests}

[testenv:build]
basepython = python3.8
deps = build
commands = python3 -m build

[testenv:pep8]
basepython = python3
deps = flake8
Expand Down

0 comments on commit e2075f0

Please sign in to comment.