Skip to content

Commit

Permalink
Merge pull request #13 from csdms/mdpiper/use-pyproject.toml
Browse files Browse the repository at this point in the history
Move project metadata to pyproject.toml
  • Loading branch information
mdpiper committed Dec 14, 2023
2 parents 201c21c + 1248f33 commit f3575eb
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 92 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: psf/black@stable
with:
args: ". --check"

- name: Format
run: |
pip install black
black .
10 changes: 3 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ jobs:
miniforge-version: latest
auto-update-conda: true

- name: Install dependencies
- name: Install package and testing dependencies
run: |
pip install -r requirements.txt
- name: Install package
run: |
pip install -e .
pip install .[test]
- name: Test
run: |
pytest -vvv
make test
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ clean-test: ## remove test and coverage artifacts
rm -fr .pytest_cache

lint: ## check style with flake8
flake8 standard_names standard_names/tests
flake8 .

pretty: ## reformat files to make them look pretty
find standard_names -name '*.py' | xargs isort
black setup.py standard_names
black .

test: ## run tests quickly with the default Python
py.test
pytest -vvv

test-all: ## run tests on every Python version with tox
tox
Expand All @@ -73,7 +73,7 @@ docs: ## generate Sphinx HTML documentation, including API docs
sphinx-apidoc --force -o docs/api standard_names *tests
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html
$(BROWSER) docs/build/html/index.html

changelog:
changelog --force --batch
Expand All @@ -85,9 +85,9 @@ release: dist ## package and upload a release
twine upload dist/*

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
python -m build
ls -l dist
twine check dist/*

install: clean ## install the package to the active Python's site-packages
python setup.py install
pip install -e .
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[![Build Status](https://travis-ci.org/csdms/standard_names.svg?branch=master)](https://travis-ci.org/csdms/standard_names)
[![Build status](https://ci.appveyor.com/api/projects/status/xb4lalkn0603ac1o/branch/master?svg=true)](https://ci.appveyor.com/project/mcflugen/standard-names/branch/master)
[![Test](https://github.com/csdms/standard_names/actions/workflows/test.yml/badge.svg)](https://github.com/csdms/standard_names/actions/workflows/test.yml)
[![Documentation Status](https://readthedocs.org/projects/standard-names/badge/?version=latest)](http://standard-names.readthedocs.io/en/latest/?badge=latest)
[![Coverage Status](https://coveralls.io/repos/github/csdms/standard_names/badge.svg?branch=master)](https://coveralls.io/github/csdms/standard_names?branch=master)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/standard_names/badges/version.svg)](https://anaconda.org/conda-forge/standard_names)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/standard_names/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/standard_names/badges/downloads.svg)](https://anaconda.org/conda-forge/standard_names)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/standard_names.svg)](https://anaconda.org/conda-forge/standard_names)
[![PyPI](https://img.shields.io/pypi/v/standard_names)](https://pypi.org/project/standard_names)


standard_names
Expand Down
115 changes: 115 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "standard_names"
description = "Python utilities for working with CSDMS Standard Names"
version = "0.2.7.dev0"
authors = [
{name = "Eric Hutton"},
{email = "eric.hutton@colorado.edu"},
]
maintainers = [
{name = "Eric Hutton"},
{email = "eric.hutton@colorado.edu"},
{name = "Mark Piper"},
{email = "mark.piper@colorado.edu"},
{name = "The CSDMS team"},
{email = "csdms@colorado.edu"},
]
readme = "README.md"
keywords = [
"python",
"utilities",
"csdms",
"standard names",
]
license = {text = "MIT License"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Physics",
]
requires-python = ">=3.9"
dependencies = [
"pyyaml",
"six",
"packaging",
"jinja2",
"py-scripting",
"binaryornot",
]

[project.urls]
Homepage = "https://csdms.colorado.edu"
Documentation = "https://standard-names.readthedocs.io/"
Repository = "https://github.com/csdms/standard_names"
Issues = "https://github.com/csdms/standard_names/issues"

[project.optional-dependencies]
dev = [
"black",
"isort",
"flake8",
"zest.releaser",
]
build = [
"build",
"twine",
]
test = [
"pytest",
"pytest-cov",
"coverage",
]
docs = [
"sphinx",
]

[project.scripts]
snbuild = "standard_names.cmd.snbuild:run"
sndump = "standard_names.cmd.sndump:run"
snscrape = "standard_names.cmd.snscrape:run"
snsql = "standard_names.cmd.snsql:run"
snvalidate = "standard_names.cmd.snvalidate:run"

[tool.setuptools.packages.find]
where = ["."]
namespaces = true
include = ["standard_names*"]

[tool.pytest.ini_options]
minversion = "6.0"
testpaths = ["standard_names"]
norecursedirs = [".*", "*.egg*", "build", "dist"]
addopts = """
--tb native
--strict-markers
--durations 16
--doctest-modules
-vvv
"""
doctest_optionflags = [
"NORMALIZE_WHITESPACE",
"IGNORE_EXCEPTION_DETAIL",
"ALLOW_UNICODE"
]

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
combine_as_imports = true
line_length = 88

[tool.zest-releaser]
tag-format = "v{version}"
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

18 changes: 0 additions & 18 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,3 @@ ignore = C901, E203, E266, E501, W503, B905
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9

[tool:pytest]
minversion = 3.0
testpaths = standard_names
norecursedirs = .* *.egg* build dist
addopts =
--ignore setup.py
--tb native
--strict-markers
--durations 16
--doctest-modules
doctest_optionflags =
NORMALIZE_WHITESPACE
IGNORE_EXCEPTION_DETAIL
ALLOW_UNICODE

[zest.releaser]
tag-format = v{version}
48 changes: 0 additions & 48 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions standard_names/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""The CSDMS Standard Names"""
from importlib.metadata import version

from .error import BadNameError, BadRegistryError
from .registry import NamesRegistry
from .standardname import StandardName, is_valid_name
Expand Down
2 changes: 1 addition & 1 deletion standard_names/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def load_names_from_txt(file_like, onerror="raise"):


def _strict_version_or_raise(version_str):
from packaging.version import Version, InvalidVersion
from packaging.version import InvalidVersion, Version

try:
return Version(version_str)
Expand Down

0 comments on commit f3575eb

Please sign in to comment.