diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4bf53dcf..53c4e1b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,3 +19,4 @@ jobs: # brew_install: "proj geos librttopo" os_list: '["ubuntu-latest"]' python-version: "['3.10', '3.11']" + extra_commands: "pip3 install -e '.[all]'" diff --git a/README.md b/README.md index e83f18d7..0762bfd4 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Some slightly more structured notes on deliberate experiments we have performed ```bash git clone https://github.com/openclimatefix/PVNet.git cd PVNet -pip install -r requirements.txt +pip install . ``` The commit history is extensive. To save download time, use a depth of 1: @@ -49,7 +49,7 @@ pip install -e . ### Additional development dependencies ```bash -pip install -r requirements-dev.txt +pip install ".[dev]" ``` @@ -101,7 +101,7 @@ conda create -n ocf_datapipes python=3.10 Then go inside the ocf_datapipes repo to add packages ```bash -pip install -r requirements.txt -r requirements-dev.txt +pip install ".[dev]" ``` Then exit this environment, and enter back into the pvnet conda environment and install ocf_datapies in editable mode (-e). This means the package is directly linked to the source code in the ocf_datapies repo. diff --git a/pyproject.toml b/pyproject.toml index 92600c34..369e26ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,63 @@ +[project] +name="PVNet" +description = "PVNet" +authors = [{name="Peter Dudfield", email="info@openclimatefix.org"}] +dynamic = ["version", "readme"] +license={file="LICENCE"} + +dependencies = [ + "ocf_datapipes>=3.3.6", + "ocf_ml_metrics>=0.0.11", + "numpy", + "pandas", + "matplotlib", + "xarray", + "ipykernel", + "h5netcdf", + "torch>=2.0.0", + "lightning>=2.0.1", + "torchvision", + "pytest", + "pytest-cov", + "typer", + "sqlalchemy", + "fsspec[s3]", + "wandb", + "huggingface-hub", + "tensorboard", + "tqdm", + "omegaconf", + "hydra-core", + "python-dotenv", + "hydra-optuna-sweeper", + "rich", + "gcsfs",# gcsfs is only needed when getting data from Google Cloud Storage +] + +[tool.setuptools.dynamic] +version = {attr = "pvnet.__version__"} +readme = {file = "README.md"} + +[tool.setuptools.package-dir] +"PVNet" = "pvnet" + +[project.optional-dependencies] +dev=[ + "pvlive-api @ git+https://github.com/SheffieldSolar/PV_Live-API", + "black", + "flake8", + "isort", + "mypy", + "pre-commit", + "pytest", + "pytest-cov", +] +all_models=[ + "pytorch-tabnet", + "efficientnet_pytorch" +] +all=["PVNet[dev,all_models]"] + [tool.mypy] exclude = [ "^tests/", diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 85851b35..00000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,8 +0,0 @@ -pvlive-api @ git+https://github.com/SheffieldSolar/PV_Live-API -black -flake8 -isort -mypy -pre-commit -pytest -pytest-cov diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index ad354016..00000000 --- a/requirements.txt +++ /dev/null @@ -1,27 +0,0 @@ -ocf_datapipes>=3.3.6 -ocf_ml_metrics>=0.0.11 -numpy -pandas -matplotlib -xarray -ipykernel -h5netcdf -torch>=2.0.0 -lightning>=2.0.1 -torchvision -pytest -pytest-cov -typer -sqlalchemy -fsspec[s3] -wandb -huggingface-hub -tensorboard -tqdm -omegaconf -hydra-core -python-dotenv -hydra-optuna-sweeper -rich -# gcsfs is only needed when getting data from Google Cloud Storage -gcsfs diff --git a/setup.py b/setup.py deleted file mode 100644 index dd15b3a5..00000000 --- a/setup.py +++ /dev/null @@ -1,33 +0,0 @@ -""" Usual setup file for package """ -# read the contents of your README file -from pathlib import Path - -from setuptools import find_packages, setup - -this_directory = Path(__file__).parent -long_description = (this_directory / "README.md").read_text() -install_requires = (this_directory / "requirements.txt").read_text().splitlines() -extras_require = {"all_models": ["pytorch-tabnet", "efficientnet_pytorch"]} - -with open("pvnet/__init__.py") as f: - for line in f: - if line.startswith("__version__"): - _, _, version = line.replace("'", "").split() - version = version.replace('"', "") - - -setup( - name="PVNet", - version=version, - license="MIT", - description="PVNet", - author="Peter Dudfield", - author_email="info@openclimatefix.org", - company="Open Climate Fix Ltd", - install_requires=install_requires, - extras_require=extras_require, - long_description=long_description, - long_description_content_type="text/markdown", - include_package_data=True, - packages=find_packages(), -)