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

Updated install to pyproject.toml #324

Merged
merged 19 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 43 additions & 17 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,56 @@
name: CI


name: CI
on:
push:
branches:
- main
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # Weekly “At 00:00”

# concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Note: This CI used to run off of the image:
# carbonplan/cmip6-downscaling-single-user:2022.06.19

jobs:
test:
name: build-and-test
if: github.repository == 'carbonplan/cmip6_downscaling'
name: ${{ matrix.python-version }}-build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10'] #TODO: add 3.11 once sparse/numba support it
timeout-minutes: 20
container:
image: carbonplan/cmip6-downscaling-single-user:2022.06.19
options: --user root
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Install
- name: Checkout
uses: actions/checkout@v4

- name: Install Conda environment from environment.yml
uses: mamba-org/setup-micromamba@v1
with:
# environment-file is not assumed anymore
environment-file: ci/environment.yml
create-args: >-
python=${{ matrix.python-version }}
# now called cache-environment
cache-environment: true

- name: Install package
run: |
python -m pip install -e . --no-deps
- name: Conda list information
run: |
git config --global --add safe.directory /__w/cmip6-downscaling/cmip6-downscaling
python -m pip install -e .
python -m pip list
- name: Running Tests
conda env list
conda list
- name: Run tests
run: |
python -m pytest --verbose
python -m pytest
8 changes: 1 addition & 7 deletions cmip6_downscaling/_version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
from importlib.metadata import PackageNotFoundError, version

try:
__version__ = version("cmip6-downscaling")
except PackageNotFoundError:
# package is not installed
__version__ = 'unknown'
__version__ = "1.0.post19+g9693dd4.d20240131"
4 changes: 0 additions & 4 deletions dev-requirements.txt

This file was deleted.

121 changes: 116 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,125 @@
[build-system]
requires = ["setuptools>=64", "setuptools-scm[toml]>=6.2", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = 'cmip6-downscaling'
name = "cmip6-downscaling"
version = '0.1.11'
description = 'README.md'
description = "Climate downscaling using cmip6 data"
readme = "README.md"
license = { text = "MIT" }
authors = [{ name = "CarbonPlan", email = "[email protected]" }]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering",
]
# dynamic = ["version"]

dependencies = [
"adlfs >= 2022.2.0",
"carbonplan_data",
"carbonplan[styles]",
"cf-xarray>=0.7.3",
"cmip6_preprocessing",
"dask[complete]",
"dask-kubernetes",
"donfig >= 0.7.0",
"fsspec",
"intake",
"intake-esm >= 2022.9.18",
"intake-xarray",
"ndpyramid == 0.0.6",
"pandas",
"prefect == 0.15.13",
"rechunker",
"regionmask",
"scikit-downscale >= 0.1.2",
"scikit-learn",
"scipy",
"universal-pathlib >= 0.0.12",
"xarray >= 2022.3.0",
"xarray-datatree == 0.0.6",
"xarray_schema >= 0.0.3",
"xclim",
"zarr >= 2.11.3"
]

[project.optional-dependencies]
dev = ["pytest","pytest-sugar","pytest-cov"]
deepsd = ["tensorflow", "tensorflow-io"]
analysis = ["cartopy", "seaborn", "carbonplan[styles]"]


[project.urls]
repository = "https://github.com/carbonplan/cmip6-downscaling"

[tool.setuptools.packages.find]
include = ["cmip6_downscaling*"]

[tool.black]
line-length = 100
target-version = ['py38']
target-version = ['py39']
skip-string-normalization = true

[tool.ruff]
line-length = 100
target-version = "py39"
builtins = ["ellipsis"]

[build-system]
requires = ["setuptools>=30.3.0", "wheel", "setuptools_scm"]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
per-file-ignores = {}
# E402: module level import not at top of file
# E501: line too long - let black worry about that
# E731: do not assign a lambda expression, use a def
ignore = ["E402", "E501", "E731"]
select = [
# Pyflakes
"F",
# Pycodestyle
"E",
"W",
# isort
"I",
# Pyupgrade
"UP",
]


[tool.ruff.mccabe]
max-complexity = 18

[tool.ruff.isort]
known-first-party = ["cmip6_downscaling"]

[tool.pytest.ini_options]
console_output_style = "count"
addopts = "--cov=./ --cov-report=xml --verbose"
26 changes: 0 additions & 26 deletions requirements.txt

This file was deleted.

15 changes: 0 additions & 15 deletions setup.cfg

This file was deleted.

42 changes: 0 additions & 42 deletions setup.py

This file was deleted.