ome / scc

OME tools for managing the Git(Hub) workflow
https://pypi.org/project/scc/
GNU General Public License v2.0
0 stars 15 forks source link

Conda Bump version #273

Closed jburel closed 2 years ago

jburel commented 2 years ago

This PR introduces a new command scc bump-version-conda to update the version and sha256 in the meta.yaml files in the conda- repositories. The command will be run in a GitHub action using a scheduled job in the conda- repositories i.e. similar to a bot. If changes are detected, the meta files are modified, committed and a PR is created. Note that the method bump-version-conda does not create the PR, this done via GitHub action in order to reduce the boiler plate required to create a PR

What does this PR do?

To test this PR:

Test 1:

Test 2:

Test 3:

Workflow in action https://github.com/jburel/conda-omero-py/pull/4

cc @joshmoore @sbesson

jburel commented 2 years ago

A minor formatting issue is that the YAML file is written with different indentation style, making the diff longer than it should be.

The BF conda file does not follow any of the conventions used in the other repositories, leading to the indentation style difference

jburel commented 2 years ago

In addition to the various inline comment, the primary issue for repositories with multiple packages like conda-raw2ometiff or conda-bftools is that the transformation works for one of the packages but the other package is completely overwritten with the same YAML.

Ha, the change I made to fix the writing introduced a bug for repositories with multiple meta files. Thanks for checking that.

sbesson commented 2 years ago

The BF conda file does not follow any of the conventions used in the other repositories, leading to the indentation style difference

This is unrelated to the style of the conda-bftools YAML file to the best of my knowledge, running the command against conda-omero-py set to the 5.9.1-0 tag gives me

diff --git a/meta.yaml b/meta.yaml
index e38e08d..787dca5 100644
--- a/meta.yaml
+++ b/meta.yaml
@@ -1,13 +1,14 @@
 {% set name = "omero-py" %}
-{% set version = "5.9.1" %}
+{% set version = 5.10.0 %}

 package:
   name: "{{ name|lower }}"
   version: "{{ version }}{{ environ.get('VERSION_SUFFIX', '') }}"

 source:
-  url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
-  sha256: 173b09411b45e4f728b54fd8203c246e2e114d0cc75fa083c5eecee76456cb21
+  url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version
+    }}.tar.gz
+  sha256: b9e8d71ca56131367045e976c490e6c0913525e0331a504d639a6d10f771e42d

 build:
   # Can't use noarch because Windows requirements are different
@@ -16,46 +17,46 @@ build:
   number: 1
   script: "{{ PYTHON }} -m pip install . --no-deps --ignore-installed -vv "
   script_env:
-    - VERSION_SUFFIX
+  - VERSION_SUFFIX
   entry_points:
-    - omero = omero.main:main
+  - omero = omero.main:main

 requirements:
   host:
-    - pip
-    - python
+  - pip
+  - python
   run:
-    - appdirs
-    - future
-    - numpy
-    - pillow
-    - python
-    - pywin32  # [win]
-    - requests
-    - pyyaml
-    - zeroc-ice36-python
+  - appdirs
+  - future
+  - numpy
+  - pillow
+  - python
+  - pywin32    # [win]
+  - requests
+  - pyyaml
+  - zeroc-ice36-python

 test:
   commands:
-    - omero --help
-    - omero version
+  - omero --help
+  - omero version
   imports:
-    - omero
-    - omero.api
-    - omero.clients
-    - omero.cmd
-    - omero.constants
-    - omero.fs
-    - omero.gateway
-    - omero.grid
-    - omero.install
-    - omero.metadatastore
-    - omero.model
-    - omero.plugins
-    - omero.romio
-    - omero.sys
-    - omero.util
-    - omero_ext
+  - omero
+  - omero.api
+  - omero.clients
+  - omero.cmd
+  - omero.constants
+  - omero.fs
+  - omero.gateway
+  - omero.grid
+  - omero.install
+  - omero.metadatastore
+  - omero.model
+  - omero.plugins
+  - omero.romio
+  - omero.sys
+  - omero.util
+  - omero_ext

 about:
   home: https://www.openmicroscopy.org/
@@ -67,4 +68,4 @@ about:

 extra:
   recipe-maintainers:
-    - ome
+  - ome
jburel commented 2 years ago

aha, my file must have been already "correctly" formatted during my tests

jburel commented 2 years ago

The BF conda file does not follow any of the conventions used in the other repositories, leading to the indentation style difference

This is unrelated to the style of the conda-bftools YAML file to the best of my knowledge, running the command against conda-omero-py set to the 5.9.1-0 tag gives me

The package ruamel.yaml will force your output to be consistent with regards to indentation. So we will have to add some custom code to keep specific indentation for lines starting with -, # etc. I think it will be preferable to unify the files, set on the indentation (yaml.indent(mapping=2) by default)

sbesson commented 2 years ago

:+1: for YAML consistency across all files and hacing it enforced by the writing tool.

I was just surprised by the indentation of the block list item mostly because other places like the Ansible roles use yamllint which by default expect the 2 spaces indentation. Reading further I discovered that both forms (non indented and indented) seem to be valid according to the spec especially The “-”, “?” and “:” characters used to denote block collection entries are perceived by people to be part of the indentation.

jburel commented 2 years ago

All the points have now been fixed (I think). Comment https://github.com/ome/scc/pull/273#discussion_r716610015, the code could be removed after changing the logic in the yaml files across the various repositories

sbesson commented 2 years ago

Retested on the various repository

diff --git a/bftools-libs/meta.yaml b/bftools-libs/meta.yaml
index 568c893..9b30479 100644
--- a/bftools-libs/meta.yaml
+++ b/bftools-libs/meta.yaml
@@ -1,6 +1,6 @@
 package:
   name: "bftools-libs"
-  version: "6.6.0"
+  version: "6.7.0"

 build:
   number: 0
@@ -8,7 +8,7 @@ build:

 source:
   url: https://downloads.openmicroscopy.org/bio-formats/{{ PKG_VERSION }}/artifacts/bftools.zip
-  sha256: d13553047ac552327107e029a077e32b48a7e0f7e028cf4c04d81539f2f56a21
+  sha256: 31a4200f7c5271bd11640743244b15ecb5166214

 extra:
   recipe-maintainers:
diff --git a/bftools/meta.yaml b/bftools/meta.yaml
index 1801170..8f18f73 100644
--- a/bftools/meta.yaml
+++ b/bftools/meta.yaml
@@ -1,13 +1,13 @@
 package:
   name: "bftools"
-  version: "6.6.0"
+  version: "6.7.0"

 build:
   number: 0

 source:
   url: https://downloads.openmicroscopy.org/bio-formats/{{ PKG_VERSION }}/artifacts/bftools.zip
-  sha256: d13553047ac552327107e029a077e32b48a7e0f7e028cf4c04d81539f2f56a21
+  sha256: 31a4200f7c5271bd11640743244b15ecb5166214

 requirements:
   run:

All non-whitespace diff are related to the formatting style discussed earlier. Two outstanding issue:

jburel commented 2 years ago

sorry forgot about the sha1 vs sha256

jburel commented 2 years ago

the lack of consistency between the repositories makes the handling of the various cases very tricky.

sbesson commented 2 years ago

the lack of consistency between the repositories makes the handling of the various cases very tricky.

I agree. As this PR is trying to handle all these cases, the two options I can think of would be:

Is there a shortlist of the divergences that need to be reviewed?

jburel commented 2 years ago

Differences

We may also want to add the repo i.e. ome/omero-py for example so we do not have to pass the parameter

The problems reported for conda-raw2ometiff and conda-bftools have now been fixed. Looking at the usage of quotes for jinja2

jburel commented 2 years ago

@sbesson the problems described in https://github.com/ome/scc/pull/273#issuecomment-930049266 should now be fixed

jburel commented 2 years ago

We already use the about/home for example https://github.com/ome/conda-bftools/blob/master/bftools/meta.yaml#L34 with a different purpose The dev_url could be used e.g. https://github.com/ome/bioformats

jburel commented 2 years ago

Actually I am going to push another commit using the about/dev_url since it is set in all the repositories. This means that we won't have to pass any parameter

sbesson commented 2 years ago

:+1: dev_url is definitely be a viable option - it is one of the accepted keys of the about section - as per https://docs.conda.io/projects/conda-build/en/latest/resources/package-spec.html#info-about-json and is linked from the Conda page https://anaconda.org/ome/omero-py/.

A separate issue is that these terms are fairly undefined. And at least I feel defining https://ww.openmicroscopy.org/ as the home of https://anaconda.org/ome/bioformats2raw is a bit of a stretch for instance.

jburel commented 2 years ago

With 75e59d2ef63b4939ed9670758f89f93b234a4c09, it is no longer necessary to use --repo. The parameter is no longer supported

jburel commented 2 years ago

A separate issue is that these terms are fairly undefined. And at least I feel defining https://ww.openmicroscopy.org/ as the home of https://anaconda.org/ome/bioformats2raw is a bit of a stretch for instance.

Yes, this should be changed.

sbesson commented 2 years ago

Briefly discussed with @jburel. The only addition I would suggest would be to have some logic to also reset the build.number to 0 when the version has been detected as different.

jburel commented 2 years ago

The fact that the changes were made even if the version was the same has now be fixed i.e. running scc on the latest conda-omero-py should stop at the version check

jburel commented 2 years ago

The first step:

jburel commented 2 years ago

No more commits. Reformatting will occur when the version is changed