Skip to content

Commit

Permalink
poetry to setuptools; min py38 (#361)
Browse files Browse the repository at this point in the history
* Update pyproject.toml

* Update CI.yaml

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Update CI.yaml

* Update CI.yaml

* Update pyproject.toml

* Update Lint.yml

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Update CI.yaml

* Update README.md

* Update test.sh

* Update format.sh

* Update build_docs.sh

* Update changelog.rst

* Update PULL_REQUEST_TEMPLATE.md

* Update CONTRIBUTING.md

* Update .github/workflows/CI.yaml
  • Loading branch information
loriab authored Nov 26, 2024
1 parent 44556c0 commit c38fa3c
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<!-- Provide a brief single sentence for the changelog. -->

## Status
<!-- Please `poetry install; bash scripts/format.sh` in the base folder. -->
<!-- Please `bash scripts/format.sh` in the base folder or use pre-commit. -->
- [ ] Code base linted
- [ ] Ready to go
24 changes: 10 additions & 14 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
pydantic-version: ["2"]
runs-on: [ubuntu-latest, windows-latest]
name: "🐍 ${{ matrix.python-version }} • ${{ matrix.pydantic-version }} • ${{ matrix.runs-on }}"
Expand All @@ -30,16 +30,14 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Checkout Code
uses: actions/checkout@v3
- name: Install poetry
run: pip install poetry
- name: Install repo with poetry (full deps)
if: matrix.python-version != '3.9'
run: poetry install --no-interaction --no-ansi --all-extras
- name: Install repo with poetry (min deps)
if: matrix.python-version == '3.9'
run: poetry install --no-interaction --no-ansi --extras test
- name: Install QCElemental (full deps)
if: matrix.python-version != '3.8' && matrix.python-version != '3.10'
run: pip install '.[test,viz,align,standard]'
- name: Install QCElemental (min deps)
if: matrix.python-version == '3.8' || matrix.python-version == '3.10'
run: pip install '.[test]'
- name: Run tests
run: poetry run pytest -rws -v --cov=qcelemental --color=yes --cov-report=xml #-k "not pubchem_multiout_g"
run: pytest -rws -v --cov=qcelemental --color=yes --cov-report=xml #-k "not pubchem_multiout_g"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3 # NEEDS UPDATE TO v3 https://github.com/codecov/codecov-action
- name: QCSchema Examples Deploy
Expand All @@ -64,12 +62,10 @@ jobs:
python-version: "3.10"
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Install poetry
run: pip install poetry
- name: Install repo
run: poetry install --no-interaction --no-ansi
run: pip install '.[docs]'
- name: Build Documentation
run: bash scripts/build_docs.sh
run: sphinx-build docs/ build/docs
- name: GitHub Pages Deploy
uses: JamesIves/[email protected]
if: github.event_name == 'push' && github.repository == 'MolSSI/QCElemental' && ( startsWith( github.ref, 'refs/tags/' ) || github.ref == 'refs/heads/master' )
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/Lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.7"
python-version: "3.8"
- name: Install black
run: pip install "black>=22.1.0,<23.0a0"
- name: Check code formatting with black
Expand All @@ -23,26 +23,24 @@ jobs:
isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.7"
- name: Install poetry
run: pip install poetry
python-version: "3.8"
- name: Install repo
run: poetry install --no-interaction --no-ansi
run: pip install '.[lint]'
- name: Check import formatting with isort
run: poetry run isort --check-only --diff .
run: isort --check-only --diff .
# TODO: Support flake8 when the repo is ready :)
# flake8:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.7"
# python-version: "3.8"
# - name: Install flake8
# run: pip install flake8
# - name: Flake8
Expand All @@ -52,7 +50,7 @@ jobs:
# mypy:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
Expand Down
10 changes: 7 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,25 @@ We welcome contributions from external contributors, and this document describes
git clone https://github.com/{YOUR-GITHUB-USERNAME}/QCElemental.git
cd QCElemental
```
<!--
- Install [poetry](https://python-poetry.org/) if you do not have it on your system. Poetry will manage package dependencies and virtual environments for you.
```sh
curl -sSL https://install.python-poetry.org | python3 -
```
-->
- Install QCElemental.

```sh
poetry install
pip install .
```

<!--
- Activate your new virtual environment. Many editors--like VS Code--will do this for you automatically when you open a directory that has been installed with `poetry`.

```sh
poetry shell
```
-->

- Check your installation by running the tests.

Expand Down Expand Up @@ -84,12 +88,12 @@ We welcome contributions from external contributors, and this document describes
- Build packages for distribution. Build artifacts will be in `dist/`:

```sh
poetry build
python -m build
```

- Distribute built packages to PyPi:
```sh
poetry publish --username {pypi_username} --password {pypi_password}
python -m twine upload dist/*
```

## Additional Resources
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![codecov](https://img.shields.io/codecov/c/github/MolSSI/QCElemental.svg?logo=Codecov&logoColor=white)](https://codecov.io/gh/MolSSI/QCElemental)
[![Documentation Status](https://img.shields.io/github/actions/workflow/status/MolSSI/QCElemental/CI.yaml?label=docs&logo=readthedocs&logoColor=white)](https://molssi.github.io/QCElemental/)
[![Chat on Slack](https://img.shields.io/badge/chat-on_slack-green.svg?longCache=true&style=flat&logo=slack)](https://join.slack.com/t/qcarchive/shared_invite/enQtNDIzNTQ2OTExODk0LTE3MWI0YzBjNzVhNzczNDM0ZTA5MmQ1ODcxYTc0YTA1ZDQ2MTk1NDhlMjhjMmQ0YWYwOGMzYzJkZTM2NDlmOGM)
![python](https://img.shields.io/badge/python-3.7+-blue.svg)
![python](https://img.shields.io/badge/python-3.8+-blue.svg)

**Documentation:** [GitHub Pages](https://molssi.github.io/QCElemental/)

Expand All @@ -16,7 +16,7 @@ This project also contains a generator, validator, and translator for [Molecule

## ✨ Getting Started

- Installation. QCElemental supports Python 3.7+. We reserve the right to move to Python 3.9+ at no notice for new releases.
- Installation. QCElemental supports Python 3.8+. We reserve the right to move to Python 3.9+ at no notice for new releases.

```sh
python -m pip install qcelemental
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ New Features
++++++++++++
* Downstream code should ``from qcelemental.models.v1 import Molecule, AtomicResult`` etc. to assure medium-term availability of existing models.
* New pydantic v2 models available as ``from qcelemental.models.v2 import Molecule, AtomicResult`` etc.
- (:pr:`361`) Switch from poetry to setuptools build backend.

Enhancements
++++++++++++
Expand Down
167 changes: 77 additions & 90 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,126 +1,103 @@
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["setuptools>=61.0", "setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"

[project.urls]
homepage = "https://github.com/MolSSI/QCElemental"
changelog = "https://github.com/MolSSI/QCElemental/docs/changelog.rst"
documentation = "http://docs.qcarchive.molssi.org/projects/qcelemental/en/latest/"
issues = "https://github.com/MolSSI/QCElemental/issues"

[tool.poetry]
[project]
name = "qcelemental"
version = "0.28.0"
#version = "0.28.0"
dynamic = ["version"]
requires-python = ">=3.8"
description = "Core data structures for Quantum Chemistry."
authors = ["The QCArchive Development Team <[email protected]>"]
license = "BSD-3-Clause"
authors = [
{ name="The QCArchive Development Team", email="[email protected]" },
]
license = { file="LICENSE" }
readme = "README.md"
homepage = "https://github.com/MolSSI/QCElemental"
documentation = "http://docs.qcarchive.molssi.org/projects/qcelemental/en/latest/"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3 :: Only",
"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",
"Programming Language :: Python :: 3.13",
"Framework :: Pydantic",
"Framework :: Pydantic :: 2",
]

[tool.poetry.dependencies]
numpy = [
{ version = ">=1.12.0", python = "3.8" },
{ version = ">=1.26.1,<2.0", python = ">=3.9,<3.10" },
{ version = ">=1.26.1", python = ">=3.9,<3.13" },
]
packaging = [
{ version = ">=24.0", python = ">=3.7,<3.8" },
{ version = ">=24.1", python = ">=3.8" },
]
# qcel is compatible with most any numpy, v1 or v2, but numpy v2 only works with pint >=0.24, which is only available for py >=3.10
python = "^3.7.1"
pint = [
{ version = ">=0.10", python = ">=3.7,<3.9" },
{ version = ">=0.23", python = ">=3.9,<3.10" },
{ version = ">=0.24", python = ">=3.10,<3.13" },
dependencies = [
"numpy >=1.12.0; python_version=='3.8'",
"numpy >=1.26.1; python_version>='3.9'",
"pint >=0.10; python_version=='3.8'",
"pint >=0.24; python_version>='3.9'",
"pydantic >=2.0",
]
pydantic = ">=2.0"
nglview = { version = "^3.0.3", optional = true }
ipykernel = { version = "<6.0.0", optional = true }
importlib-metadata = { version = ">=4.8", python = "<3.8" }
networkx = { version = "<3.0", optional = true }
scipy = [
{ version = ">=1.6.0", python = "<3.9", optional = true },
{ version = ">=1.9.0", python = ">=3.9,<3.13", optional = true },
]
pytest = { version = "^7.2.2", optional = true }

[tool.poetry.extras]
viz = ["nglview", "ipykernel"]
align = ["networkx", "scipy"]
test = ["pytest"]

# Note that all the versions below are a farce for poetry's benefit.
# One needs a fairly recent sphinx, pydantic, and autodoc-pydantic for a
# successful docs build, and that likely requires py 3.9."

[tool.poetry.group.dev.dependencies]
black = ">=22.1.0,<23.0a0"
mypy = "^1.1.1"
isort = "5.11.5"
flake8 = [
{ version = "<6.0.0", python = "<3.8.1" },
{ version = "6.0.0", python = ">=3.8.1,<4.0.0" }
]
pre-commit = [
{ version = "<3.2.0", python = "<3.9" },
{ version = "^3.8.0", python = ">=3.9,<4.0.0" }
]
pytest-cov = "^4.0.0"
autoflake = "^2.0.2"
jsonschema = { version = "^4.23.0", python = ">=3.8,<4.0.0" }
msgpack = { version = "^1.0.8", python = ">=3.8,<4.0.0" }
numpydoc = [
{ version = "^1.5.0", python = "<3.9" },
{ version = "^1.8.0", python = ">=3.9,<4.0.0" }
[project.optional-dependencies]
standard = [
"msgpack",
"jsonschema",
]
docutils = [
{ version = "<0.19", python = "<3.9" },
{ version = "0.20.1", python = ">=3.9,<4.0.0" }
viz = [
"nglview", # !py38 # insufficient on pypi as also need `dot`. python-graphviz sufficient in conda.
"setuptools; python_version>='3.12'", # nglview needs pkg_resources
"ipykernel <6.0",
]
sphinx = [
{ version = "<6.0.0", python = "<3.9" },
{ version = "^7.0.0", python = ">=3.9,<4.0.0" }
align = [
"networkx <3.0",
"scipy",
]
sphinxcontrib-napoleon = "^0.7"
sphinx-rtd-theme = [
{ version = "^1.2.0", python = "<3.9" },
{ version = "^2.0.0", python = ">=3.9,<4.0.0" }
test = [
"pytest",
"pytest-cov",
"codecov",
]
autodoc-pydantic = [
{ version = "^2.0.0", python = "<3.8" },
{ version = "^2.1.0", python = ">=3.8,<4.0" }
lint = [
"pre-commit",
"black >=22.1.0,<23.0a0", # if running outside of pre-commit
"isort ==5.11.5", # if running outside of pre-commit
# "mypy",
# "autoflake",
# "flake8",
]
sphinx-automodapi = [
{ version = "^0.15.0", python = "<3.8" },
{ version = "^0.17.0", python = ">=3.8,<4.0.0" }
docs = [ # probably >=py39
"numpydoc",
"docutils",
"sphinx >=7.0.0",
"sphinxcontrib-napoleon",
"sphinx-rtd-theme",
"autodoc-pydantic",
"sphinx-automodapi",
"sphinx-autodoc-typehints",
"pydantic ==2.5.0", # for now
"pydantic-settings ==2.2.0", # for now
]
sphinx-autodoc-typehints = [
{ version = "^1.22", python = "<3.10" },
{ version = "^2.3", python = ">=3.10,<4.0.0" }
]
graphviz = "^0.20.0" # insufficient on pypi as also need `dot`. python-graphviz sufficient in conda.

#[tool.poetry.dependencies]
#packaging = ">=24.1"
#pytest = { version = "^7.2.2", optional = true }

#[tool.poetry.group.dev.dependencies]
#msgpack = "^1.0.8"
# { version = "^1.22", python = "<3.10" },
# { version = "^2.3", python = ">=3.10,<4.0.0" }
#]

[tool.black]
line-length = 120
target-version = ['py37']
target-version = ['py38']

[tool.isort]
force_grid_wrap = 0
include_trailing_comma = true
profile = "black"
line_length = 120
multi_line_output = 3
use_parentheses = true

[tool.coverage.run]
branch = true
Expand All @@ -135,3 +112,13 @@ init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true

[tool.setuptools]
packages = ["qcelemental"]

[tool.setuptools.package-data]

[tool.setuptools_scm]

[tool.versioningit.vcs]
default-tag = "0.0.99" # useful for CI/shallow clones
2 changes: 1 addition & 1 deletion scripts/build_docs.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
set -xe
# Run tests
poetry run sphinx-build docs/ build/docs
sphinx-build docs/ build/docs
Loading

0 comments on commit c38fa3c

Please sign in to comment.