Skip to content

Commit 8ef2c78

Browse files
convert to pyproject.toml from setup.py
1 parent 0a84f91 commit 8ef2c78

9 files changed

Lines changed: 114 additions & 3043 deletions

File tree

.github/workflows/python-package-conda.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
env:
2525
ANACONDA_CHANNEL_UPLOAD_TOKEN: ${{ secrets.ANACONDA_CHANNEL_UPLOAD_TOKEN }}
2626
run: |
27-
conda create -n test_vtools3 -y conda-build conda-verify numpy anaconda-client
27+
conda create -n test_vtools3 -y conda-build conda-verify numpy anaconda-client setuptools-scm
2828
source $CONDA/etc/profile.d/conda.sh
2929
conda activate test_vtools3
3030
conda config --set anaconda_upload yes
31-
conda build --user cadwr-dms --token "$ANACONDA_CHANNEL_UPLOAD_TOKEN" conda.recipe
31+
conda build -c cadwr-dms -c conda-forge --user cadwr-dms --token "$ANACONDA_CHANNEL_UPLOAD_TOKEN" conda.recipe
3232
conda activate
3333
conda remove -n test_vtools3 --all

conda.recipe/meta.yaml

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
{% set name = "vtools3" %}
2-
{% set data = load_setup_py_data() %}
1+
{# raw is for ignoring templating with cookiecutter, leaving it for use with conda-build -#}
2+
{% set pyproject = load_file_data('../pyproject.toml', from_recipe_dir=True) %}
3+
{% set project = pyproject['project'] %}
4+
{% set version = load_setup_py_data().get('version', '0.0.0') %}
35

46
package:
5-
name: "{{ name|lower }}"
6-
7-
version: {{ data['version'] }}
7+
name: vtools
8+
version: {{ version }}
89

910
source:
1011
path: ..
@@ -14,37 +15,49 @@ build:
1415
# separate bld.bat and build.sh files instead of this key. Add the line
1516
# "skip: True # [py<35]" (for example) to limit to Python 3.5 and newer, or
1617
# "skip: True # [not win]" to limit to Windows.
17-
script: {{ PYTHON }} -m pip install --no-deps --ignore-installed -vv .
18+
script: {{ PYTHON }} -m pip install --no-build-isolation --no-deps --ignore-installed -vv .
1819
noarch: python
20+
number: 0
1921
entry_points:
20-
{% for entry in data['entry_points']['console_scripts'] %}
21-
- {{ entry.split('=')[0].strip() }} = {{ entry.split('=')[1].strip() }}
22-
{% endfor %}
23-
22+
{% for name, reference in project['scripts'].items() %}
23+
- {{ name }} = {{ reference }}
24+
{% endfor %}
2425

2526
requirements:
27+
host:
28+
- python {{ project['requires-python'] }}
29+
- pip
30+
- numpy >=1.23
31+
{% for dep in pyproject['build-system']['requires'] %}
32+
- {{ dep.lower() }}
33+
{% endfor %}
2634
build:
2735
- python
2836
- setuptools
2937
- pandas >=0.23
38+
- numpy >=1.23
3039
run:
3140
- python
3241
- numpy >=1.11
3342
- pandas >=0.23
3443
- scipy >=1.2
3544
- beautifulsoup4 >=4.8
3645
- xlrd
37-
test:
38-
imports:
39-
- vtools
40-
source_files:
41-
- tests
42-
requires:
43-
- pytest
44-
- pytest-cov
45-
commands:
46-
- (setlocal && cd tests && pytest && endlocal) # [win]
47-
- (cd tests; pytest) # [unix]
46+
{% for dep in project.get('dependencies', []) %}
47+
- {{ dep.lower() }}
48+
{% endfor %}
49+
test:
50+
imports:
51+
- vtools
52+
source_files:
53+
- tests
54+
requires:
55+
{% for dep in project.get("optional-dependencies", {}).get('test', []) %}
56+
- {{ dep.lower() }}
57+
{% endfor %}
58+
commands:
59+
- (setlocal && cd tests && pytest && endlocal) # [win]
60+
- (cd tests; pytest) # [unix]
4861

4962
about:
5063
home: https://github.com/CADWRDeltaModeling/vtools3

pyproject.toml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[build-system]
2+
requires = ["setuptools>=61", "wheel", "setuptools-scm"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "vtools3"
7+
dynamic = ["version"] # Placeholder; versioneer will manage this
8+
description = "Timeseries analysis and processing tools using pandas/xarray"
9+
readme = "README.md"
10+
license = { file = "LICENSE" }
11+
authors = [
12+
{ name = "California Department of Water Resources", email = "Eli.Ateljevich@water.ca.gov"}
13+
]
14+
requires-python = ">=3.6"
15+
classifiers = [
16+
"Programming Language :: Python :: 3.6",
17+
"Programming Language :: Python :: 3.7",
18+
"Programming Language :: Python :: 3.8",
19+
"Programming Language :: Python :: 3.9"
20+
]
21+
keywords = ["vtools"]
22+
dependencies = [
23+
"numpy",
24+
"pandas",
25+
"xarray",
26+
"dask",
27+
"matplotlib",
28+
"scikit-learn",
29+
"scipy",
30+
"statsmodels>=0.13"
31+
]
32+
33+
[project.optional-dependencies]
34+
doc = [
35+
"sphinx",
36+
"sphinx-rtd-theme",
37+
"myst-parser",
38+
"numpydoc"
39+
]
40+
test = [
41+
"pytest>=3",
42+
"pytest-cov",
43+
"tox",
44+
"click"
45+
]
46+
[project.urls]
47+
Homepage = "https://github.com/CADWRDeltaModeling/vtools3"
48+
49+
[tool.setuptools]
50+
include-package-data = true
51+
52+
[tool.flake8]
53+
exclude = ["docs"]
54+
55+
[tool.pytest.ini_options]
56+
collect_ignore = ["setup.py"]
57+
58+
[tool.setuptools.packages.find]
59+
include = ["vtools"]
60+
exclude = ["docsrc"]
61+
62+
[tool.setuptools_scm]
63+
version_scheme = "post-release"
64+
local_scheme = "dirty-tag"
65+
66+
[project.scripts]

setup.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

setup.py

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,9 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import setup
22

3-
##------------------ VERSIONING BEST PRACTICES --------------------------##
4-
import versioneer
5-
6-
with open('README.md') as readme_file:
7-
readme = readme_file.read()
8-
9-
10-
requirements = ["numpy",
11-
"pandas",
12-
"xarray",
13-
"dask",
14-
"matplotlib",
15-
"scikit-learn",
16-
"scipy",
17-
"statsmodels>=0.13"]
18-
19-
20-
21-
extras = {"tests":"pytest",
22-
"docs": ["nbsphinx","sphinx-argparse","numpydoc"]}
3+
# setup.py only needed for conda to resolve versioning
4+
# DO NOT ADD ANYTHING ELSE HERE
235

246
setup(
25-
name='vtools3',
26-
version=versioneer.get_version(),
27-
cmdclass=versioneer.get_cmdclass(),
28-
description="Timeseries analysis and processing tools using pandas/xarray",
29-
license="Apache",
30-
long_description=readme,
31-
install_requires=requirements,
32-
extras_require=extras,
33-
include_package_data=True,
34-
keywords='vtools',
35-
packages=find_packages(),
36-
author="Eli Ateljevich",
37-
author_email='eli@water.ca.gov',
38-
url='https://github.com/CADWRDeltaModeling/vtools3',
39-
classifiers=[
40-
'Programming Language :: Python :: 3.6',
41-
'Programming Language :: Python :: 3.7',
42-
'Programming Language :: Python :: 3.8',
43-
'Programming Language :: Python :: 3.9',
44-
],
45-
entry_points = { 'console_scripts' : [] }
7+
name="vtools",
8+
use_scm_version=True,
469
)

setup_devenv.bat

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)