diff --git a/.github/workflows/docs-build-deploy.yml b/.github/workflows/docs-build-deploy.yml index 7cc8d78..9c1023b 100644 --- a/.github/workflows/docs-build-deploy.yml +++ b/.github/workflows/docs-build-deploy.yml @@ -11,10 +11,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 - - name: Install cats - run: python3 -m pip install . - - run: | - pip install -r docs/docs-requirements.txt + - name: Install cats with documentation helpers + run: python3 -m pip install '.[docs]' - name: Build sphinx docs run: make -C docs html - name: Deploy sphinx docs diff --git a/cats/__init__.py b/cats/__init__.py index 75eb189..6045781 100644 --- a/cats/__init__.py +++ b/cats/__init__.py @@ -15,6 +15,8 @@ from .forecast import CarbonIntensityAverageEstimate from .optimise_starttime import get_avg_estimates # noqa: F401 +__version__ = "1.0.0" + # To add a scheduler, add a date format here # and create a scheduler_(...) function SCHEDULER_DATE_FORMAT = {"at": "%Y%m%d%H%M"} @@ -29,7 +31,9 @@ def parse_arguments(): Parse command line arguments :return: [dict] parsed arguments """ - description_text = """ + description_text = f""" + Climate-Aware Task Scheduler (version {__version__}) + -------------------------------------------------------------------------- The Climate-Aware Task Scheduler (cats) command line program helps you run your calculations in a way that minimises their impact on the climate by delaying computation until a time when the ammount of CO2 produced to @@ -75,13 +79,14 @@ def parse_arguments(): cats -d 90 --loc OX1 -s at -c 'mycommand' To report carbon footprint, pass the `--config` option to select a - configuration file and the `--profile` option to select a profile. An + configuration file and the `--profile` option to select a profile. + The configuration file is documented in the Quickstart section of the online + documentation. An example config file is given below: -{config_text} +.. code-block:: yaml - The configuration file is documented in the Quickstart section of the online - documentation. +{config_text} """ parser = ArgumentParser( @@ -226,7 +231,7 @@ def schedule_at( """ proc = subprocess.Popen(args, stdout=subprocess.PIPE) try: - proc_output = subprocess.check_output( + subprocess.check_output( ( at_command, "-t", diff --git a/docs/docs-requirements.txt b/docs/docs-requirements.txt deleted file mode 100644 index c5197c9..0000000 --- a/docs/docs-requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -sphinx -sphinx-argparse -ghp-import -renku-sphinx-theme -sphinx_copybutton diff --git a/docs/source/api-reference.rst b/docs/source/api-reference.rst index 562e1ba..53c6697 100644 --- a/docs/source/api-reference.rst +++ b/docs/source/api-reference.rst @@ -11,16 +11,10 @@ please see :ref:`cli-reference`. Modules ------- -``cats.__init__`` +``cats`` ^^^^^^^^^^^^^^^^^ -.. automodule:: cats.__init__ - :members: - -``cats.__main__`` -^^^^^^^^^^^^^^^^^ - -.. automodule:: cats.__main__ +.. automodule:: cats :members: ``cats.configure`` diff --git a/docs/source/conf.py b/docs/source/conf.py index d899a5e..15d5cc9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -12,6 +12,8 @@ import os import sys +import cats + sys.path.insert(0, os.path.abspath("../..")) # cats repo root directory @@ -26,7 +28,7 @@ author = authors copyright = f"2023, {authors}" # The full version, including alpha/beta/rc tags -release = "0.1.0" +release = cats.__version__ # Add media: image for logo and a favicon for the browser tab html_logo = "_static/cats_dalle_img_200x200px_for_logo.png" diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 14f1796..24916c4 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -8,4 +8,10 @@ Install CATS via pip as follows: .. code-block:: console :caption: *Command to install CATS with pip.* + $ pip install climate-aware-task-scheduler + +To install the development version + +.. code-block:: console + $ pip install git+https://github.com/GreenScheduler/cats diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index ccf552d..a5d97c8 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -76,7 +76,7 @@ quantity of hardware the job using. This information is provided by adding a section ``profiles`` to the :ref:`cats YAML configuration file `. -You can define an arbitraty number of profiles as subsection of the +You can define an arbitrary number of profiles as subsection of the top-level ``profiles`` section: .. literalinclude :: ../../cats/config.yml @@ -106,6 +106,6 @@ at the command line: --profile my_gpu_profile --gpu 4 --cpu 1 .. warning:: - The ``--profile`` option is optional. Is not provided, ``cats`` uses the + The ``--profile`` option is optional. If not provided, ``cats`` uses the first profile defined in the configuration file as the default profile. diff --git a/pyproject.toml b/pyproject.toml index 6d03e88..f973fa3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] - requires = ['setuptools>=40.8.0'] + requires = ['setuptools>=61.0.0'] build-backend = 'setuptools.build_meta' [tool.setuptools] @@ -8,7 +8,7 @@ [project] name = "climate-aware-task-scheduler" - version = "1.0rc1" + dynamic = ["version"] description = "Climate aware task scheduler" authors = [ { name = "Colin Sauze" }, @@ -25,12 +25,23 @@ license = { file = "LICENSE" } requires-python = ">=3.9" readme = "README.md" - classifiers = ["License :: OSI Approved :: MIT License"] + classifiers = [ + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Science/Research", + "Intended Audience :: System Administrators", + ] dependencies = ["requests-cache>=1.0", "PyYAML>=6.0"] + [tool.setuptools.dynamic] + version = {attr = "cats.__version__"} + [project.optional-dependencies] test = ["pytest", "numpy>=1.5.0", "pytest-subprocess==1.5.0", "pytest-cov"] types = ["mypy", "types-PyYAML", "types-redis", "types-requests", "types-ujson"] + docs = ["sphinx", "sphinx-argparse", "ghp-import", "renku-sphinx-theme", "sphinx_copybutton"] [project.urls] Home = "https://github.com/GreenScheduler/cats"