diff --git a/.github/workflows/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from .github/workflows/ISSUE_TEMPLATE/bug_report.md rename to .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/workflows/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from .github/workflows/ISSUE_TEMPLATE/feature_request.md rename to .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/workflows/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .github/workflows/PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 2bf8064..ba1adb7 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -34,7 +34,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Format top-level Markdown and YAML files with Prettier uses: creyD/prettier_action@v4.3 @@ -68,7 +68,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Format backend code with black uses: psf/black@stable diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f141446..34d5a6b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,17 +33,20 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.10" + # Install PyTorch and TensorFlow CPU versions manually to prevent installing CUDA - name: Install dependencies run: | python -m pip install --upgrade pip python -m pip install pylint + python -m pip install torch~=2.2.0 torchaudio~=2.2.0 torchvision~=0.17.0 --index-url https://download.pytorch.org/whl/cpu + python -m pip install tensorflow-cpu~=2.15.0 python -m pip install . - name: Lint backend code with Pylint diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..5db1f35 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,86 @@ +# @Copyright: CEA-LIST/DIASI/SIALV/LVA (2023) +# @Author: CEA-LIST/DIASI/SIALV/LVA +# @License: CECILL-C +# +# This software is a collaborative computer program whose purpose is to +# generate and explore labeled data for computer vision applications. +# This software is governed by the CeCILL-C license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-C +# license as circulated by CEA, CNRS and INRIA at the following URL +# +# http://www.cecill.info + +# This workflow will publish the new version of Pixano Inference to PyPI when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Publish + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + deploy_pypi: + name: Build and publish to PyPI + runs-on: ubuntu-latest + permissions: + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install hatch + + - name: Build package + run: hatch build + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + + deploy_docs: + name: Publish documentation website + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Configure git credentials + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Create cache_id for key creation + run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + + - name: Create cache key with cache_id + uses: actions/cache@v4 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + + - name: Install dependencies + run: pip install .[documentation] + + - name: Publish documentation website + run: mkdocs gh-deploy --force diff --git a/CHANGELOG.md b/CHANGELOG.md index 37d82ce..e12b3a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,24 +4,15 @@ All notable changes to Pixano will be documented in this file. ## [Unreleased] -## [0.3.0b2] - 2024-02-19 +## [0.3.0] - 2024-02-29 ### Added +- Publish **Pixano Inference on PyPI** - Add **new MobileSAM model** as a lighter alternative to SAM (pixano/pixano-inference#2) -- Add issue and pull request templates on GitHub repository - -### Fixed - -- Fix ignored members in linting CI configuration -- Specify black version in formatting CI configuration -- Fix GitHub version and documentation links in README - -## [0.3.0b1] - 2024-01-23 - -### Added - - Add GitHub actions to format and lint code +- Add GitHub action to publish docs and PyPI package (pixano/pixano-inference#9) +- Add issue and pull request templates on GitHub repository - Add CONTRIBUTING.md for installation information and contribution guidelines ### Changed @@ -30,14 +21,19 @@ All notable changes to Pixano will be documented in this file. - **Breaking:** Update InferenceModel `id` attribute to `model_id` to stop redefining built-in `id` - **Breaking:** Update submodule names to `pytorch` and `tensorflow` - Update README with a small header description listing main features and more detailed installation instructions -- Generate API reference automatically -- Update documentation website accent color to complementary color of the Pixano main accent color -- Add cross-references to Pixano, TensorFlow, and Hugging Face Transformers in the API reference of the documentation website +- Generate API reference on documentation website automatically +- Add cross-references to Pixano, TensorFlow, and Hugging Face Transformers in the API reference +- Update documentation deployment (pixano/pixano-inference#9) ### Fixed - Fix links to Pixano notebooks - Fix internal cross-references in the API reference of the documentation website +- Update deprecated GitHub actions (pixano/pixano-inference#11) +- Prevent CUDA installation in lint GitHub action action +- Fix ignored members in linting CI configuration +- Specify black version in formatting CI configuration +- Fix GitHub version and documentation links in README ## [0.2.1] - 2023-11-13 @@ -117,8 +113,7 @@ All notable changes to Pixano will be documented in this file. - Create first public release [Unreleased]: https://github.com/pixano/pixano/compare/main...develop -[0.3.0b2]: https://github.com/pixano/pixano-inference/compare/v0.3.0b1...v0.3.0b2 -[0.3.0b1]: https://github.com/pixano/pixano-inference/compare/v0.2.1...v0.3.0b1 +[0.3.0]: https://github.com/pixano/pixano-inference/compare/v0.2.1...v0.3.0 [0.2.1]: https://github.com/pixano/pixano-inference/compare/v0.2.0...v0.2.1 [0.2.0]: https://github.com/pixano/pixano-inference/compare/v0.1.6...v0.2.0 [0.1.6]: https://github.com/pixano/pixano-inference/compare/v0.1.5...v0.1.6 diff --git a/README.md b/README.md index 323d829..df81cfd 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ conda activate pixano_env Then, you can install Pixano Inference inside that environment with pip: ```shell -pip install pixano-inference@git+https://github.com/pixano/pixano-inference +pip install pixano-inference ``` As it is a requirement of Pixano Inference, Pixano will automatically be downloaded if it is not already installed. diff --git a/docs/code/index.md b/docs/api_reference/index.md similarity index 100% rename from docs/code/index.md rename to docs/api_reference/index.md diff --git a/docs/assets/extra.css b/docs/assets/extra.css index 9ef2222..460fcf4 100644 --- a/docs/assets/extra.css +++ b/docs/assets/extra.css @@ -1,3 +1,3 @@ :root { - --md-primary-fg-color: #1e7736; + --md-primary-fg-color: #771e5f; } diff --git a/docs/gen_ref_pages.py b/docs/gen_ref_pages.py index 346b492..a895a7c 100644 --- a/docs/gen_ref_pages.py +++ b/docs/gen_ref_pages.py @@ -8,7 +8,7 @@ import mkdocs_gen_files SRC_PATH = "pixano_inference" -REF_PATH = "code" +REF_PATH = "api_reference" IGNORED_FILES = ["__init__.py", "__version__.py"] nav = mkdocs_gen_files.Nav() diff --git a/docs/getting_started/index.md b/docs/getting_started/index.md new file mode 100644 index 0000000..2f1bc07 --- /dev/null +++ b/docs/getting_started/index.md @@ -0,0 +1,5 @@ +# Getting started with Pixano Inference + +- [Installing Pixano Inference](installing_pixano_inference.md) +- [Using pre-annotation models](pre_annotation.md) +- [Using interactive annotation models](interactive_annotation.md) diff --git a/docs/user/install.md b/docs/getting_started/installing_pixano_inference.md similarity index 86% rename from docs/user/install.md rename to docs/getting_started/installing_pixano_inference.md index 64c51a8..1770cc7 100644 --- a/docs/user/install.md +++ b/docs/getting_started/installing_pixano_inference.md @@ -11,5 +11,5 @@ Then, you can install the Pixano and Pixano Inference packages inside that envir ```shell pip install pixano -pip install pixano-inference@git+https://github.com/pixano/pixano-inference +pip install pixano-inference ``` diff --git a/docs/user/interactive_annotation.md b/docs/getting_started/interactive_annotation.md similarity index 100% rename from docs/user/interactive_annotation.md rename to docs/getting_started/interactive_annotation.md diff --git a/docs/user/pre_annotation.md b/docs/getting_started/pre_annotation.md similarity index 100% rename from docs/user/pre_annotation.md rename to docs/getting_started/pre_annotation.md diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index de22e13..0000000 --- a/docs/index.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -hide: - - navigation ---- - -# Welcome to the Pixano Inference Documentation! - -Pixano Inference is a library of inference models for Pixano. - -**[Get started](user/)** - -**[Check out the API reference](code/)** - -**[Check out the documentation for Pixano](https://pixano.github.io/)** diff --git a/docs/user/index.md b/docs/user/index.md deleted file mode 100644 index 9be6f9b..0000000 --- a/docs/user/index.md +++ /dev/null @@ -1,7 +0,0 @@ -# Getting started with Pixano Inference - -- [Get started with Pixano](https://pixano.github.io/user/) -- [Install Pixano Inference](install.md) -- Use Pixano Inference - - Check out this Jupyter notebook for using the Pixano Inference models for pre-annotation - - Check out this Jupyter notebook for using the Pixano Inference models for interactive annotation diff --git a/mkdocs.yml b/mkdocs.yml index 9848fdc..9b49f3d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Pixano Inference Documentation +site_name: Pixano Documentation theme: name: material logo: assets/pixano_white.png @@ -55,6 +55,9 @@ plugins: - docs/gen_ref_pages.py - literate-nav: nav_file: SUMMARY.md + - redirects: + redirect_maps: + "index.md": "getting_started/index.md" - mkdocstrings: enable_inventory: true handlers: @@ -68,7 +71,7 @@ plugins: - https://arrow.apache.org/docs/objects.inv - https://docs.pydantic.dev/2.4/objects.inv - https://ipython.readthedocs.io/en/8.13.2/objects.inv - - https://pixano.github.io/objects.inv + - https://pixano.github.io/pixano/objects.inv - https://pytorch.org/docs/master/objects.inv - url: https://github.com/GPflow/tensorflow-intersphinx/raw/master/tf2_py_objects.inv base_url: https://www.tensorflow.org/api_docs/python @@ -87,14 +90,14 @@ plugins: heading_level: 1 nav: - - "Home": index.md + - "Home": https://pixano.github.io/ - - "Getting started": - - user/index.md - - "Installing Pixano Inference": user/install.md - - "Pre-annotation": user/pre_annotation.md - - "Interactive annotation": user/interactive_annotation.md + - "Pixano": https://pixano.github.io/pixano/ - - "API reference": code/ - - - "Pixano": https://pixano.github.io + - "Pixano Inference": + - "Getting started": + - getting_started/index.md + - "Installing Pixano Inference": getting_started/installing_pixano_inference.md + - "Pre-annotation": getting_started/pre_annotation.md + - "Interactive annotation": getting_started/interactive_annotation.md + - "API reference": api_reference/ diff --git a/pixano_inference/__version__.py b/pixano_inference/__version__.py index 49085fd..59f7192 100644 --- a/pixano_inference/__version__.py +++ b/pixano_inference/__version__.py @@ -11,4 +11,4 @@ # # http://www.cecill.info -__version__ = "0.3.0b2" +__version__ = "0.3.0" diff --git a/pyproject.toml b/pyproject.toml index 7bca2dc..e0bb3b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,18 +24,18 @@ classifiers = [ ] dependencies = [ "pixano ~= 0.5.0b1", - "torch >= 2.0.0", - "torchaudio >= 2.0.0", - "torchvision >= 0.15.0", - "tensorflow >= 2.12.0", - "tensorflow-hub >= 0.13.0", + "torch ~= 2.2.0", + "torchaudio ~= 2.2.0", + "torchvision ~= 0.17.0", + "tensorflow ~= 2.15.0", + "tensorflow-hub ~= 0.15.0", "segment-anything@git+https://github.com/facebookresearch/segment-anything", "mobile-sam@git+https://github.com/ChaoningZhang/MobileSAM", "transformers >= 4.33.0", "timm >= 0.9.12", "gitpython >= 3.1.30", "matplotlib >= 3.3", - "psutil", + "psutil >= 5.9.5", "PyYAML >= 5.3.1", "requests >= 2.23.0", "seaborn >= 0.11.0", @@ -49,6 +49,7 @@ documentation = [ "mkdocstrings-python ~= 1.7.0", "mkdocs-gen-files ~= 0.5.0", "mkdocs-literate-nav ~= 0.6.0", + "mkdocs-redirects ~= 1.2.1", ] [project.urls]