Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home-assistant: support ista_ecotrend component #326492

Merged
merged 3 commits into from
Jul 14, 2024

Conversation

oynqr
Copy link
Contributor

@oynqr oynqr commented Jul 12, 2024

Description of changes

This adds all relevant packages for supporting the ista EcoTrend Home Assistant integration. Since this is my first contribution, I have also added myself as a maintainer.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Copy link
Member

@mweinelt mweinelt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reformat all new python-packages with nixfmt-rfc-style.

Comment on lines 12 to 18
src = fetchzip {
url = "https://github.com/leeyoshinari/Small_Tool/releases/download/${version}/pyjson-${version}.tar.gz";
sha256 = "sha256-KF03x5O8hJICdd2RNMmTCEVl19tcVSR4fYta3Sue9e8=";
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use fetchFromGitHub and sourceRoot instead. That way we get a fetcher that supports automatic updates.

Comment on lines 19 to 26
];

pythonImportsCheck = [ "pyjson" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
];
pythonImportsCheck = [ "pyjson" ];
];
doCheck = false; # no tests
pythonImportsCheck = [ "pyjson" ];

owner = "Ludy87";
repo = "pyecotrend-ista";
rev = "refs/tags/${version}";
sha256 = "sha256-NAJ3/37dlwOiP1cilxfADUcuUt1VKF+eo/3JKgSUo3M=";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sha256 = "sha256-NAJ3/37dlwOiP1cilxfADUcuUt1VKF+eo/3JKgSUo3M=";
hash = "sha256-NAJ3/37dlwOiP1cilxfADUcuUt1VKF+eo/3JKgSUo3M=";


nativeCheckInputs = [
pytestCheckHook
pytest-cov
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't care about test coverage. Remove the dependency and patch it out

  src = {
    ...
  };

  postPatch = ''
    sed -i "/addopts =/d" pyproject.toml
  '';

https://github.com/Ludy87/pyecotrend-ista/blob/main/pyproject.toml#L24

Comment on lines 35 to 36
];

pythonImportsCheck = [ "pytest_dataset" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
];
pythonImportsCheck = [ "pytest_dataset" ];
];
doCheck = false; # no tests
pythonImportsCheck = [ "pytest_dataset" ];

Copy link
Member

@dotlambda dotlambda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit messages should be e.g. python312Packages.pyjson: init at 1.4.5.


postPatch = ''
substituteInPlace setup.py \
--replace-warn "setuptools_scm ~= 6.0" "setuptools_scm >= 6.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
--replace-warn "setuptools_scm ~= 6.0" "setuptools_scm >= 6.0"
--replace-fail "setuptools_scm ~= 6.0" "setuptools_scm >= 6.0"

'';

build-system = [
setuptools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
setuptools

redundant

@dotlambda dotlambda added this to Incoming in Home Assistant via automation Jul 12, 2024
@oynqr oynqr force-pushed the python3Packages.pyecotrend-ista branch 2 times, most recently from 9d25372 to 6a0844f Compare July 13, 2024 07:55
meta = {
changelog = "https://github.com/leeyoshinari/Small_Tool/releases/tag/${version}";
description = "Compare the similarities between two JSONs";
homepage = "https://github.com/leeyoshinari/Small_Tool";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be

Suggested change
homepage = "https://github.com/leeyoshinari/Small_Tool";
homepage = "https://github.com/leeyoshinari/Small_Tool/tree/master/pyjson";

but that's optional.

version = "0.3.2";
pyproject = true;

src = fetchPypi {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want you can ask upstream to tag their releases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently looking into how hard it would be to get pyecotrend-ista to use pytest-datadir instead of pytest-dataset.

@oynqr oynqr force-pushed the python3Packages.pyecotrend-ista branch from 6a0844f to 56e519f Compare July 13, 2024 08:38
@oynqr
Copy link
Contributor Author

oynqr commented Jul 13, 2024

I opened a PR upstream to remove the dependency on pytest-dataset. Let's wait until that is merged or closed.

@oynqr oynqr force-pushed the python3Packages.pyecotrend-ista branch from 56e519f to 80dd59f Compare July 14, 2024 20:25
@oynqr
Copy link
Contributor Author

oynqr commented Jul 14, 2024

Alright, the PR is through and upstream has cut a new release, completely removing the dependency.

@mweinelt mweinelt merged commit 4dcf1da into NixOS:master Jul 14, 2024
25 of 27 checks passed
Home Assistant automation moved this from Incoming to Done Jul 14, 2024
@oynqr oynqr deleted the python3Packages.pyecotrend-ista branch July 15, 2024 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants