Repository: canonical/operator (language: python)

Issue:
Remove copyright years from source files
Per team discussion, we're going to remove the copyright year (or year range in some cases) from the top of each source file, but leave the copyright notice itself, so the first line just says `# Copyright Canonical Ltd.`.

[This blog post](https://hynek.me/til/copyright-years/) notes that various large projects and companies have started doing this ([curl](https://daniel.haxx.se/blog/2023/01/08/copyright-without-years/), [React](https://github.com/facebook/react/pull/13593), [Amazon](https://chatter.quux.world/@mark/109621622761353381)), so there's a good precedent.

As mentioned in the [Curl commit])(https://github.com/curl/curl/commit/2bc1d775f510196154283374284f98d3eae03544), there's no legal need:

> - they are mostly pointless in all major jurisdictions
> - many big corporations and projects already don't use them
> - saves us from pointless churn
> - git keeps history for us



Discussion / hints:
FYI, this is the [ruff rule](https://docs.astral.sh/ruff/rules/#flake8-copyright-cpy) I mentioned. I have the feeling we may need to turn it off, because the regex expects a year and can't be customised in ruff. Not 100% sure on that, though.
Hmm, apparently our legal team recommends keeping just the creation year. And as @james-garner-canonical found, the appendix in the Apache license says to use the format "Copyright [yyyy] [name of copyright owner]" with the year. Oh well, let's be safe and change all the files to just the year the file was created (and no ranges).

Fix patch:
diff --git a/HACKING.md b/HACKING.md
index e9218b6c8..a61932c0d 100644
--- a/HACKING.md
+++ b/HACKING.md
@@ -190,6 +190,12 @@ Note that the commit messages to the PR's branch do not need to follow the
 conventional commit format, as these will be squashed into a single commit to `main`
 using the PR title as the commit message.
 
+## Copyright
+
+The format for copyright notices is documented in the [LICENSE.txt](LICENSE.txt).
+New files should begin with a copyright line with the current year (e.g. Copyright 2024 Canonical Ltd.) and include the full boilerplate (see APPENDIX of [LICENSE.txt](LICENSE.txt)).
+The copyright information in existing files does not need to be updated when those files are modified -- only the initial creation year is required.
+
 # Documentation
 
 In general, new functionality
diff --git a/docs/custom_conf.py b/docs/custom_conf.py
index 492ad571c..e22d7e4ce 100644
--- a/docs/custom_conf.py
+++ b/docs/custom_conf.py
@@ -1,3 +1,17 @@
+# Copyright 2019 Canonical Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 # ruff: noqa
 import datetime
 import pathlib
diff --git a/ops/_private/__init__.py b/ops/_private/__init__.py
index 6fb08ccd4..846ff8c81 100644
--- a/ops/_private/__init__.py
+++ b/ops/_private/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/ops/charm.py b/ops/charm.py
index 664cbc687..5862b3947 100644
--- a/ops/charm.py
+++ b/ops/charm.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2021 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/ops/framework.py b/ops/framework.py
index e5caf0d8c..ef1c298eb 100644
--- a/ops/framework.py
+++ b/ops/framework.py
@@ -1,4 +1,4 @@
-# Copyright 2020-2021 Canonical Ltd.
+# Copyright 2020 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/ops/main.py b/ops/main.py
index dcb3f2578..c67249ed8 100644
--- a/ops/main.py
+++ b/ops/main.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/ops/model.py b/ops/model.py
index b5cc355ac..cc099715c 100644
--- a/ops/model.py
+++ b/ops/model.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2021 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/ops/storage.py b/ops/storage.py
index ccbebd007..5024e5331 100644
--- a/ops/storage.py
+++ b/ops/storage.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/tox.ini b/tox.ini
index ecadde087..68acc7e2a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,17 @@
 # Copyright 2021 Canonical Ltd.
-# See LICENSE file for licensing details.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 [tox]
 skipsdist=True
 skip_missing_interpreters = True


Test patch:
diff --git a/test/__init__.py b/test/__init__.py
index 6fb08ccd4..846ff8c81 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/test/charms/test_main/actions.yaml b/test/charms/test_main/actions.yaml
index 1eca1b7ed..fa4d3cc79 100644
--- a/test/charms/test_main/actions.yaml
+++ b/test/charms/test_main/actions.yaml
@@ -1,3 +1,17 @@
+# Copyright 2019 Canonical Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 foo-bar:
   description: Foos the bar.
   title: foo-bar
diff --git a/test/charms/test_main/config.yaml b/test/charms/test_main/config.yaml
index ffc018600..26e3ec3c3 100644
--- a/test/charms/test_main/config.yaml
+++ b/test/charms/test_main/config.yaml
@@ -1,1 +1,15 @@
+# Copyright 2019 Canonical Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 "options": {}
diff --git a/test/charms/test_main/lib/__init__.py b/test/charms/test_main/lib/__init__.py
index 6fb08ccd4..846ff8c81 100644
--- a/test/charms/test_main/lib/__init__.py
+++ b/test/charms/test_main/lib/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2024 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/test/charms/test_main/metadata.yaml b/test/charms/test_main/metadata.yaml
index a3bda3ce4..7deebc609 100644
--- a/test/charms/test_main/metadata.yaml
+++ b/test/charms/test_main/metadata.yaml
@@ -1,3 +1,17 @@
+# Copyright 2019 Canonical Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 name: main
 summary: A charm used for testing the basic operation of the entrypoint code.
 maintainer: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
diff --git a/test/charms/test_smoke/metadata.yaml b/test/charms/test_smoke/metadata.yaml
index 917eaf038..b07ff1138 100644
--- a/test/charms/test_smoke/metadata.yaml
+++ b/test/charms/test_smoke/metadata.yaml
@@ -1,5 +1,16 @@
-# Copyright 2022 Penelope Valentine Gale
-# See LICENSE file for licensing details.
+# Copyright 2022 Canonical Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 
 # For a complete list of supported options, see:
 # https://juju.is/docs/sdk/metadata-reference
diff --git a/test/test_charm.py b/test/test_charm.py
index 0b825a6ac..b6879b151 100644
--- a/test/test_charm.py
+++ b/test/test_charm.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/test/test_framework.py b/test/test_framework.py
index 7be174a09..5a63fdd19 100644
--- a/test/test_framework.py
+++ b/test/test_framework.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/test/test_helpers.py b/test/test_helpers.py
index 84f9b20f6..5a1a967e2 100644
--- a/test/test_helpers.py
+++ b/test/test_helpers.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2021 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/test/test_infra.py b/test/test_infra.py
index 6efab1806..445bbce2d 100644
--- a/test/test_infra.py
+++ b/test/test_infra.py
@@ -1,4 +1,4 @@
-# Copyright 2020-2021 Canonical Ltd.
+# Copyright 2020 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/test/test_main.py b/test/test_main.py
index a4765b288..2893504fe 100644
--- a/test/test_main.py
+++ b/test/test_main.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2021 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/test/test_storage.py b/test/test_storage.py
index 44091f6b1..55a9181c6 100644
--- a/test/test_storage.py
+++ b/test/test_storage.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/test/test_testing.py b/test/test_testing.py
index 0ae1b46df..bf6bc7a38 100644
--- a/test/test_testing.py
+++ b/test/test_testing.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 Canonical Ltd.
+# Copyright 2019 Canonical Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.