Skip to content

Commit

Permalink
Move to a fully pyproject.toml based build (#878)
Browse files Browse the repository at this point in the history
* Move pydocstyle config to pyproject.toml.

* Move mypy config to pyproject.toml.

* Remove unnecessary metadata section, see https://stackoverflow.com/questions/60084128/does-description-file-in-setup-cfg-section-metadata-have-any-effect

* Remove now unnecessary bdist_wheel section.

* Move pytest configuration to pyproject.toml.

* Move coverage config to pyproject.toml.

* Move flake8 and bumpversion configs to separate files.

* Move all project config to pyproject.toml.

* Specify build backend.

* Remove TODO.

* Remove editable install in CI.

* Revert "Remove editable install in CI."

This reverts commit 9e03309.

* Add minimum setuptools version.

* Update changelog.

* Make sure namespace packages aren't installed and try again.

* Explicitly disallow test installation and add an __init__.py for _vendor.

* Go back to an editable install for CI.

* Specify pydocstyle convention.

* Convert keywords to a proper list.

* Remove zip-safe.

* Point bumpversion to pyproject.toml.

* Update contributing docs.

* Apply suggestions from code review

Co-authored-by: Kelly Wang <47036428+klywang@users.noreply.github.com>
Co-authored-by: Bradley Dice <bdice@bradleydice.com>

* Update pyproject.toml

Co-authored-by: Kelly Wang <47036428+klywang@users.noreply.github.com>
Co-authored-by: Bradley Dice <bdice@bradleydice.com>
Co-authored-by: Brandon Butler <butlerbr@umich.edu>
  • Loading branch information
4 people committed Jan 4, 2023
1 parent fc48619 commit cfe6b6f
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 120 deletions.
15 changes: 15 additions & 0 deletions .bumpversion
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[bumpversion]
current_version = 1.8.0
commit = True
tag = False
message = Bump up to version {new_version}.

[bumpversion:file:pyproject.toml]

[bumpversion:file:signac/version.py]

[bumpversion:file:doc/conf.py]

[bumpversion:file:CITATION.cff]

[bumpversion:file:.zenodo.json]
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
max-line-length = 100
exclude = _vendor
select = E,F,W
ignore = E123,E126,E203,E226,E241,E704,W503,W504
2 changes: 1 addition & 1 deletion .github/workflows/run-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' && matrix.config.dependencies != 'minimal' }}
- name: Test with pytest
run: |
pytest --cov=signac --cov-config=setup.cfg --cov-report=xml tests/ -v
pytest --cov=signac --cov-config=pyproject.toml --cov-report=xml tests/ -v
- uses: codecov/codecov-action@v2
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ repos:
rev: 'v4.3.0'
hooks:
- id: end-of-file-fixer
exclude: 'setup.cfg'
- id: trailing-whitespace
exclude: 'setup.cfg'
- id: check-builtin-literals
- id: check-executables-have-shebangs
- id: check-json
Expand Down Expand Up @@ -45,6 +43,8 @@ repos:
^doc/|
^tests/|
)
additional_dependencies:
- toml
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.981'
hooks:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ All contributors must agree to the Contributor Agreement ([ContributorAgreement.
* Use the [OneFlow](https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow) model of development:
- Both new features and bug fixes should be developed in branches based on `master`.
- Hotfixes (critical bugs that need to be released *fast*) should be developed in a branch based on the latest tagged release.
* Write code that is compatible with all supported versions of Python (listed in [setup.py](https://github.com/glotzerlab/signac/blob/master/setup.py)).
* Write code that is compatible with all supported versions of Python (listed in [pyproject.toml](https://github.com/glotzerlab/signac/blob/master/pyproject.toml)).
* Avoid introducing dependencies -- especially those that might be harder to install in high-performance computing environments.
* Create [unit tests](https://en.wikipedia.org/wiki/Unit_testing) and [integration tests](https://en.wikipedia.org/wiki/Integration_testing) that cover the common cases and the corner cases of the code.
* Preserve backwards-compatibility whenever possible, and make clear if something must change.
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Changed
- The ``calc_id`` function has been moved from the ``hashing`` module to the ``job`` module (#873).
- Tests are run with all warnings treated as errors (#871).
- The contents of the ``syncutil`` module have been moved into ``sync`` (#869).
- The project now leverages a fully pyproject.toml-driven build (#878).

Removed
+++++++
Expand Down
9 changes: 7 additions & 2 deletions doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,18 @@ Consider installing :ref:`optional dependencies <optional_dependencies>`.
Source Code Installation
========================

Alternatively you can clone the `git repository <https://github.com/glotzerlab/signac>`_ and execute the ``setup.py`` script to install the package.
Alternatively you can clone the `git repository <https://github.com/glotzerlab/signac>`_ and pip install it directly (Option 1), or install directly from git (Option 2).

.. code:: bash
# Option 1
git clone https://github.com/glotzerlab/signac.git
cd signac
python setup.py install --user
pip install .
# Option 2
pip install git+https://github.com/glotzerlab/signac.git
Consider installing :ref:`optional dependencies <optional_dependencies>`.

Expand Down
78 changes: 78 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
# Copyright (c) 2020 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=64.0.0"]

[project]
name = "signac"
version = "1.8.0"
description = "Manage large and heterogeneous data spaces on the file system."
readme = "README.md"
# Supported versions are determined according to NEP 29.
# https://numpy.org/neps/nep-0029-deprecation_policy.html
requires-python = ">=3.8"
license = { file = "LICENSE.txt" }
maintainers = [{ name = "signac Developers", email = "signac-support@umich.edu" }]
authors = [{ name = "Carl Simon Adorf et al.", email = "csadorf@umich.edu" }]
keywords = ["simulation", "database", "index", "collaboration", "workflow"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Topic :: Database",
"Topic :: Scientific/Engineering :: Physics",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
# Platform-independent file locking
"filelock>=3.0",
# Used for version parsing and comparison
"packaging>=15.0",
# Progress bars
"tqdm>=4.10.0",
]

[project.optional-dependencies]
h5 = ["h5py"]

[project.scripts]
signac = "signac.__main__:main"

[project.urls]
Homepage = "https://signac.io"
Documentation = "https://docs.signac.io"
Download = "https://pypi.org/project/signac/"
Source = "https://github.com/glotzerlab/signac"
Issues = "https://github.com/glotzerlab/signac/issues"

[tools.setuptools.packages.find]
namespaces = false
exclude = ["tests*", "benchmarks*"]

[tool.black]
target-version = ['py38']
include = '\.pyi?$'
Expand All @@ -19,3 +76,24 @@ force-exclude = '''
[tool.isort]
profile = 'black'
skip_glob = 'signac/_vendor/*'

[tool.pydocstyle]
convention = "numpy"
match = "^((?!\\.sync-zenodo-metadata|setup).)*\\.py$"
match-dir = "^((?!\\.|tests|_vendor).)*$"
ignore-decorators = "deprecated"
add-ignore = "D105, D107, D203, D204, D213"

[tool.mypy]
ignore_missing_imports = true

[tool.pytest.ini_options]
xfail_strict = true
filterwarnings = "error"

[tool.coverage.run]
branch = true
concurrency = ["thread", "multiprocessing"]
parallel = true
source = [ "signac" ]
omit = [ "*/signac/_vendor/*" ]
48 changes: 0 additions & 48 deletions setup.cfg

This file was deleted.

66 changes: 0 additions & 66 deletions setup.py

This file was deleted.

4 changes: 4 additions & 0 deletions signac/_vendor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2022 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
"""Vendored packages."""

0 comments on commit cfe6b6f

Please sign in to comment.