diff --git a/.github/workflows/macos-linux-pip.yml b/.github/workflows/macos-linux-pip.yml index f372a769..e755d8bd 100644 --- a/.github/workflows/macos-linux-pip.yml +++ b/.github/workflows/macos-linux-pip.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - os: ["ubuntu-latest", "macos-latest"] + os: ["ubuntu-latest"] # , "macos-latest"] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 00000000..52b45d9f --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,19 @@ +name: "CI - Nix" + +on: + push: + +jobs: + nix: + runs-on: "${{ matrix.os }}-latest" + strategy: + matrix: + os: [ubuntu, macos] + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + - uses: cachix/cachix-action@v15 + with: + name: gepetto + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - run: nix build -L diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 661f5051..684efb6f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ ci: autoupdate_branch: devel repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.5 + rev: v0.8.2 hooks: - id: ruff args: @@ -14,18 +14,19 @@ repos: hooks: - id: cmake-format - repo: https://github.com/pappasam/toml-sort - rev: v0.23.1 + rev: v0.24.2 hooks: - id: toml-sort-fix exclude: poetry.lock - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v18.1.3 + rev: v19.1.4 hooks: - id: clang-format args: - --style=Google + exclude: python/test/sandbox/test.ipynb - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: check-ast diff --git a/CHANGELOG.md b/CHANGELOG.md index ddd9de5f..665cc1cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.0.0] - 2024-12-05 + +- :warning: BREAKING: switch from boost smart pointers to std ones +- setup nix +- setup mergify + ## [1.4.1] - 2024-04-12 - tests: fix use of np.random in tests @@ -174,7 +180,8 @@ Changes since v0.2.0: - Initial release -[Unreleased]: https://github.com/loco-3d/ndcurves/compare/v1.4.1...HEAD +[Unreleased]: https://github.com/loco-3d/ndcurves/compare/v2.0.0...HEAD +[2.0.0]: https://github.com/loco-3d/ndcurves/compare/v1.4.1...v2.0.0 [1.4.1]: https://github.com/loco-3d/ndcurves/compare/v1.4.0...v1.4.1 [1.4.0]: https://github.com/loco-3d/ndcurves/compare/v1.3.1...v1.4.0 [1.3.1]: https://github.com/loco-3d/ndcurves/compare/v1.3.0...v1.3.1 diff --git a/cmake b/cmake index f4af8f79..29c0eb4e 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit f4af8f7988760c8695c5366ea83862f7e8756512 +Subproject commit 29c0eb4e659304f44d55a0389e2749812d858659 diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..14d6a05c --- /dev/null +++ b/flake.lock @@ -0,0 +1,58 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1733380312, + "narHash": "sha256-ywntxT10Om755wkB9tYgJwEwELQZKYAO5WcNuHv1vjI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a772498086eac57d97065a980a21fc0f304e3192", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1733096140, + "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..1e19e554 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + description = "Library for creating smooth cubic splines"; + + inputs = { + flake-parts.url = "github:hercules-ci/flake-parts"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = inputs.nixpkgs.lib.systems.flakeExposed; + perSystem = + { pkgs, self', ... }: + { + apps.default = { + type = "app"; + program = pkgs.python3.withPackages (_: [ self'.packages.default ]); + }; + devShells.default = pkgs.mkShell { inputsFrom = [ self'.packages.default ]; }; + packages = { + default = self'.packages.ndcurves; + ndcurves = pkgs.python3Packages.ndcurves.overrideAttrs (_: { + src = pkgs.lib.fileset.toSource { + root = ./.; + fileset = pkgs.lib.fileset.unions [ + ./CMakeLists.txt + ./doc + ./include + ./package.xml + ./python + ./tests + ]; + }; + }); + }; + }; + }; +} diff --git a/include/ndcurves/bernstein.h b/include/ndcurves/bernstein.h index fcab1df1..c8fedafe 100644 --- a/include/ndcurves/bernstein.h +++ b/include/ndcurves/bernstein.h @@ -49,7 +49,7 @@ struct Bern { if (!(u >= 0. && u <= 1.)) { throw std::invalid_argument("u needs to be betwen 0 and 1."); } - return bin_m_i_ * (pow(u, i_)) * pow((1 - u), m_minus_i); + return bin_m_i_ * (pow(u, i_))*pow((1 - u), m_minus_i); } /// \brief Check if actual Bernstein polynomial and other are approximately diff --git a/include/ndcurves/bezier_curve.h b/include/ndcurves/bezier_curve.h index 921269b4..d07ed7a9 100644 --- a/include/ndcurves/bezier_curve.h +++ b/include/ndcurves/bezier_curve.h @@ -38,7 +38,7 @@ struct bezier_curve : public curve_abc { typedef std::vector > t_point_t; typedef typename t_point_t::const_iterator cit_point_t; typedef bezier_curve bezier_curve_t; - typedef boost::shared_ptr bezier_curve_ptr_t; + typedef std::shared_ptr bezier_curve_ptr_t; typedef piecewise_curve piecewise_curve_t; typedef curve_abc curve_abc_t; // parent class diff --git a/include/ndcurves/curve_abc.h b/include/ndcurves/curve_abc.h index a0ab3843..616e6384 100644 --- a/include/ndcurves/curve_abc.h +++ b/include/ndcurves/curve_abc.h @@ -11,9 +11,8 @@ #ifndef _STRUCT_CURVE_ABC #define _STRUCT_CURVE_ABC -#include -#include #include +#include #include "MathDefs.h" #include "serialization/archive.hpp" @@ -43,7 +42,7 @@ struct curve_abc : public serialization::Serializable { curve_t; // parent class typedef curve_abc curve_derivate_t; // parent class - typedef boost::shared_ptr curve_ptr_t; + typedef std::shared_ptr curve_ptr_t; /* Constructors - destructors */ public: diff --git a/include/ndcurves/exact_cubic.h b/include/ndcurves/exact_cubic.h index e9302132..ea040891 100644 --- a/include/ndcurves/exact_cubic.h +++ b/include/ndcurves/exact_cubic.h @@ -116,8 +116,8 @@ struct exact_cubic : public piecewise_curve { std::size_t getNumberSplines() { return this->getNumberCurves(); } spline_t getSplineAt(std::size_t index) { - boost::shared_ptr s_ptr = - boost::dynamic_pointer_cast(this->curves_.at(index)); + std::shared_ptr s_ptr = + std::dynamic_pointer_cast(this->curves_.at(index)); if (s_ptr) return *s_ptr; else diff --git a/include/ndcurves/fwd.h b/include/ndcurves/fwd.h index fb4125e7..e2921a4a 100644 --- a/include/ndcurves/fwd.h +++ b/include/ndcurves/fwd.h @@ -10,7 +10,7 @@ #ifndef CURVES_FWD_H #define CURVES_FWD_H #include -#include +#include #include namespace ndcurves { @@ -94,11 +94,11 @@ typedef curve_abc // (return dimension are fixed) // shared pointer to abstract types: -typedef boost::shared_ptr curve_ptr_t; -typedef boost::shared_ptr curve3_ptr_t; -typedef boost::shared_ptr curve_rotation_ptr_t; -typedef boost::shared_ptr curve_translation_ptr_t; -typedef boost::shared_ptr curve_SE3_ptr_t; +typedef std::shared_ptr curve_ptr_t; +typedef std::shared_ptr curve3_ptr_t; +typedef std::shared_ptr curve_rotation_ptr_t; +typedef std::shared_ptr curve_translation_ptr_t; +typedef std::shared_ptr curve_SE3_ptr_t; // definition of all curves class with pointX as return type: typedef polynomial polynomial_t; diff --git a/include/ndcurves/piecewise_curve.h b/include/ndcurves/piecewise_curve.h index 42d130fd..7c14f1a4 100644 --- a/include/ndcurves/piecewise_curve.h +++ b/include/ndcurves/piecewise_curve.h @@ -9,8 +9,8 @@ #define _CLASS_PIECEWISE_CURVE #include -#include #include +#include #include #include "curve_abc.h" @@ -46,7 +46,7 @@ struct piecewise_curve typedef curve_abc base_curve_t; // parent class typedef CurveType curve_t; // contained curves base class - typedef boost::shared_ptr curve_ptr_t; + typedef std::shared_ptr curve_ptr_t; typedef typename std::vector t_curve_ptr_t; typedef typename std::vector