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

DM-27354: Enable pip installation using pyproject.toml / PEP 517 #30

Merged
merged 6 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ jobs:
with:
python-version: 3.7

- name: Install dependencies
run: pip install -r requirements.txt

- name: Build and install
run: pip install -v .
run: |
python -m pip install --upgrade pip setuptools
python -m pip install .[yaml,test]

- name: Run tests
run: pytest -r a -v
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ tests/.cache/*
ups/*.cfgc
build/
.eggs/
*.egg-info/
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include LICENSE
include README.md
recursive-include include *.h
recursive-include src *.h
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools >= 46.6.0",
"wheel",
"pybind11 >= 2.5.0",
"numpy >= 1.18",
]
8 changes: 0 additions & 8 deletions requirements.txt

This file was deleted.

23 changes: 8 additions & 15 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
[metadata]
name = lsst_sphgeom
description = A Spherical Geometry Library
description = A spherical geometry library.
author = LSST Data Management
author_email = support@lsst.org
license = GPLv3
url = https://github.com/lsst/sphgeom
classifiers =
Intended Audience :: Science/Research
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Topic :: Scientific/Engineering :: Astronomy

[options]
zip_safe = False
package_dir=
=python
packages=find:
setup_requires =
setuptools >=46.0
wheel
pybind11 >=2.5.0
numpy >=1.17
setuptools_cpp >=0.0.1
install_requires =
numpy >=1.17
tests_require =
pytest >= 3.2
flake8 >= 3.7.5
pytest-flake8 >= 1.0.4
numpy >=1.18

[options.extras_require]
yaml = pyyaml>=5.1
test =
pytest >= 3.2
flake8 >= 3.7.5
pytest-flake8 >= 1.0.4

[options.packages.find]
where=python
where = python

[flake8]
max-line-length = 110
Expand Down
14 changes: 3 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
interface.
"""

from setuptools import setup
from setuptools_cpp import ExtensionBuilder, Pybind11Extension
import os
import glob

# Importing this automatically enables parallelized builds
import numpy.distutils.ccompiler # noqa: F401
from setuptools import setup
from pybind11.setup_helpers import Pybind11Extension, build_ext

# Currently a fake version for testing
version = '0.0.1'
Expand All @@ -28,11 +27,6 @@
__version__ = '{version}'""", file=f)


# read the contents of the README file
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, "README.md"), encoding='utf-8') as f:
long_description = f.read()

# Find the source code -- we can combine it into a single module
pybind_src = sorted(glob.glob("python/lsst/sphgeom/*.cc"))
cpp_src = sorted(glob.glob("src/*.cc"))
Expand All @@ -45,8 +39,6 @@

setup(
version=version,
long_description=long_description,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is long_description no longer something that is used then? I thought it was how you got the readme onto the PyPI page?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timj This is handled by the file: directive in the setup.cfg file for code-less import of the README into the package metadata.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see file in setup.cfg...

ext_modules=ext_modules,
long_description_content_type="text/markdown",
cmdclass={'build_ext': ExtensionBuilder},
cmdclass={'build_ext': build_ext},
)