From d238c63739b8d6d72b9568d78cce448135af22d6 Mon Sep 17 00:00:00 2001 From: ayeankit Date: Tue, 25 Jul 2023 12:21:34 +0530 Subject: [PATCH 01/24] Added maturin as build-system for template --- README.md | 1 + docs/guide.md | 2 +- src/scicookie/cookiecutter.json | 3 +- src/scicookie/hooks/post_gen_project.py | 9 +- src/scicookie/profiles/base.yaml | 1 + .../{{cookiecutter.project_slug}}/Makefile | 2 + .../build-system/flit-pyproject.toml | 4 +- .../build-system/maturin-pyproject.toml | 132 ++++++++++++++++++ .../conda/dev.yaml | 2 + .../docs/contributing.md | 6 +- tests/smoke/base.sh | 3 +- tests/smoke/build-system.sh | 1 + 12 files changed, 159 insertions(+), 7 deletions(-) create mode 100644 src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml diff --git a/README.md b/README.md index f5afffa8..31526b16 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ for a Python package. [Setuptools](https://setuptools.pypa.io/en/latest/), [PDM](https://pdm.fming.dev/) or [Hatch](https://hatch.pypa.io) + [Maturin](https://pypi.org/project/maturin/0.8.2/) based on your preference. - The structure of the project can use the *src layout* or *flat layout*. The “src layout” moving the code that is intended to be diff --git a/docs/guide.md b/docs/guide.md index 41b2001d..c74442bf 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -231,7 +231,7 @@ packages. SciCookie support the following: can be confident that they will always produce the same results. It also helps you manage your Python environments, so you can be sure that your projects have the correct dependencies. - +- [**Maturin**](https://pypi.org/project/maturin/0.8.2/):It's build system designed to create Python bindings from Rust projects. It allows Rust code to be seamlessly integrated into Python applications, providing efficient builds and cross-platform support for various Python versions. Maturin automates the generation of Python modules that directly access Rust functions, harnessing Rust's high performance and low-level capabilities within Python. Its user-friendly interface and compatibility with setuptools and Cargo make it an easy-to-use tool, offering developers a simple solution to combine the strengths of Python and Rust within a unified project. The idea behind the options in SciCookie is that you can choose from some of the most popular system compilers to suit your needs and preferences for developing Python packages. If you think we should add more options, you can submit your diff --git a/src/scicookie/cookiecutter.json b/src/scicookie/cookiecutter.json index cf8c0d35..1e7a88ad 100644 --- a/src/scicookie/cookiecutter.json +++ b/src/scicookie/cookiecutter.json @@ -49,7 +49,8 @@ "mesonpy", "setuptools", "pdm", - "hatch" + "hatch", + "maturin" ], "use_bandit": "yes", "use_black": "no", diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index ff2f39c8..0378bb33 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -62,6 +62,8 @@ BUILD_SYSTEM = "pdm" {% elif cookiecutter.build_system == "hatch" -%} BUILD_SYSTEM = "hatch" +{% elif cookiecutter.build_system == "maturin" -%} +BUILD_SYSTEM = "maturin" {%- else %} BUILD_SYSTEM = None {%- endif %} @@ -186,7 +188,12 @@ def clean_up_build_system(): shutil.move( build_system_dir / "hatch-pyproject.toml", PROJECT_DIRECTORY / 'pyproject.toml' - ) + ) + elif BUILD_SYSTEM == "maturin": + shutil.move( + build_system_dir / "maturin-pyproject.toml", + PROJECT_DIRECTORY / 'pyproject.toml' + ) else: shutil.move( build_system_dir / "base-pyproject.toml", diff --git a/src/scicookie/profiles/base.yaml b/src/scicookie/profiles/base.yaml index 682fae6e..a6d1439d 100644 --- a/src/scicookie/profiles/base.yaml +++ b/src/scicookie/profiles/base.yaml @@ -87,6 +87,7 @@ build_system: - setuptools - pdm - hatch + - maturin enabled: false command_line_interface: diff --git a/src/scicookie/{{cookiecutter.project_slug}}/Makefile b/src/scicookie/{{cookiecutter.project_slug}}/Makefile index 470da97a..adc9c2d9 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/Makefile +++ b/src/scicookie/{{cookiecutter.project_slug}}/Makefile @@ -113,6 +113,8 @@ build: pdm build {%- elif cookiecutter.build_system == "hatch" %} hatch build +{%- elif cookiecutter.build_system == "maturin" %} + maturin build {%- endif %} .PHONY:release-ci diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml index dff59fc7..6fc70f8b 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["flit_core >=3.4"] -build-backend = "flit_core.buildapi" +requires = ["maturin"] +build-backend = "maturin" [project] diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml new file mode 100644 index 00000000..dff59fc7 --- /dev/null +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml @@ -0,0 +1,132 @@ +[build-system] +requires = ["flit_core >=3.4"] +build-backend = "flit_core.buildapi" + + +[project] +name = "{{ cookiecutter.project_slug }}" +authors = [ + { name = "{{ cookiecutter.author_full_name }}", email = "{{ cookiecutter.author_email }}" }, +] +description = "{{ cookiecutter.project_short_description }}" +{% if cookiecutter.project_layout == "src" -%} +packages = [ + {include = "{{ cookiecutter.package_slug }}", from="src"}, +] +{% else -%} +packages = [ + {include = "{{ cookiecutter.package_slug }}"}, +] +{% endif -%} +readme = "README.md" +classifiers = [ + "Development Status :: 1 - Planning", + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", +{%- if cookiecutter.project_license == "MIT" %} + "License :: OSI Approved :: MIT License", +{%- elif cookiecutter.project_license == "BSD 3 Clause" %} + "License :: OSI Approved :: BSD License", +{%- elif cookiecutter.project_license == "Apache Software License 2.0" %} + "License :: OSI Approved :: Apache Software License", +{%- elif cookiecutter.project_license == "GNU General Public License v3" %} + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", +{%- endif %} + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering", + "Typing :: Typed", +] +dynamic = ["version"] +requires-python = ">=3.8.1" +dependencies = [ +{# keep this line here #} +{%- if cookiecutter.use_pytest == "yes" -%} + "pytest >= 7.3.2", +{% if cookiecutter.use_coverage == "yes" -%} + "pytest-cov >= 4.1.0", +{% endif %} +{%- endif -%}{#- end of use_pytest -#} +{%- if cookiecutter.use_hypothesis == "yes" -%} + "hypothesis >= 6.0", +{% endif %} +{%- if cookiecutter.use_coverage == "yes" -%} + "coverage >= 7.2.7", +{% endif %} +{%- if cookiecutter.use_blue == "yes" -%} + "blue >= 0.9.1", +{% endif %} +{%- if cookiecutter.use_black == "yes" -%} + "black >= 23.3.0", +{% endif %} +{%- if cookiecutter.use_isort == "yes" -%} + "isort >= 5.12.0", +{% endif %} +{%- if cookiecutter.use_pre_commit -%} + "pre-commit >= 3.3.2", +{% endif %} +{%- if cookiecutter.use_flake8 == "yes" -%} + "flake8 >= 4.0.1, < 7", +{% endif %} +{%- if cookiecutter.use_ruff == "yes" -%} + "ruff >= 0.0.272", +{% endif %} +{%- if cookiecutter.use_mypy == "yes" -%} + "mypy >= 1.3.0", +{% endif %} +{%- if cookiecutter.use_bandit == "yes" -%} + "bandit >= 1.7.5", +{% endif %} +{%- if cookiecutter.use_pydocstyle == "yes" -%} + "pydocstyle >= 6.3.0", +{% endif %} +{%- if cookiecutter.use_vulture == "yes" -%} + "vulture >= 2.7", +{% endif %} +{%- if cookiecutter.use_mccabe == "yes" -%} + "mccabe >= 0.6.1", +{% endif %} +{%- if cookiecutter.use_containers in ['Docker', 'Podman'] -%} +# if you want to use docker-compose from your system, remove compose-go here + "compose-go >= 2.18.1", +{% endif %} + "ipython < 8", + "ipykernel >=6.0.0", +{%- if cookiecutter.documentation_engine == 'mkdocs' %} + "Jinja2 >= 3.1.2", + "mkdocs >= 1.4.3", + "mkdocs-exclude >= 1.0.2", + "mkdocs-jupyter >= 0.24.1", + "mkdocs-literate-nav >= 0.6.0", + "mkdocs-macros-plugin >= 0.7.0, < 1", + "mkdocs-material >= 9.1.15", + "mkdocstrings >= 0.21.2", + "mkdocstrings-python >= 1.1.2", +{% elif cookiecutter.documentation_engine == 'sphinx' -%} + "Sphinx >= 6.2.1", + "sphinx-rtd-theme >= 1.2.2", + "importlib-metadata >= 6.5.1", + "myst-parser >= 0.19.2", + "nbsphinx >= 0.9.2", + "pandoc >= 2.3", +{% elif cookiecutter.documentation_engine == 'jupyter-book' -%} + "jupyter-book >= 0.15.1", + "myst-parser >= 0.18.1", +{% endif %} +] + +[project.urls] +Homepage = "{{ cookiecutter.project_url }}" +"Bug Tracker" = "{{ cookiecutter.project_url }}/issues" +Discussions = "{{ cookiecutter.project_url }}/discussions" +Changelog = "{{ cookiecutter.project_url }}/releases" + +{% include "build-system/base-pyproject.toml" %} +{#- keep this line at the end of the file -#} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml b/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml index fe7cadf1..f1a9b494 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml +++ b/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml @@ -17,6 +17,8 @@ dependencies: - pdm {%- elif cookiecutter.build_system == "hatch" %} - hatch +{%- elif cookiecutter.build_system == "pdm" %} + - pdm {%- endif %} - nodejs # used by semantic-release - shellcheck diff --git a/src/scicookie/{{cookiecutter.project_slug}}/docs/contributing.md b/src/scicookie/{{cookiecutter.project_slug}}/docs/contributing.md index a9348d05..03b75854 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/docs/contributing.md +++ b/src/scicookie/{{cookiecutter.project_slug}}/docs/contributing.md @@ -50,8 +50,12 @@ It provides an efficient and fast way to manage project dependencies, as well as build and distribute code. It is fast to install, has built-in virtualenv, offers support for different package sources, and provides an easy way to distribute code. +{%- elif cookiecutter.build_system == "hatch" -%} +In addition, you should know that to build our package we use [Hatch](https://hatch.pypa.io): It's a Python Package that is compatible build backend used by Hatch, a modern, extensible Python project manager. It provides a standardized build system with reproducible builds by default, robust environment management with support for custom scripts, easy publishing to PyPI or other indexes, version management, and configurable project generation with sane defaults. Hatchling might support multiple programming languages and offer language-specific options for building projects in different languages. It could also provide customization and extensibility options, allowing you to incorporate plugins or scripts for tailored build processes. - +{%- elif cookiecutter.build_system == "maturin" -%} +In addition, you should know that to build our package we use +[Maturin](https://pypi.org/project/maturin/0.8.2/):It's a Python packaging tool and build system for creating Python bindings from Rust projects. It enables seamless integration of Rust code into Python applications, offering efficient builds, cross-platform support, and compatibility with different Python versions. Maturin automates the process of generating Python modules that directly call Rust functions, leveraging Rust's performance and low-level capabilities in Python. With its easy-to-use interface and integration with setuptools and Cargo, Maturin provides a straightforward solution for developers seeking to combine the strengths of Python and Rust in a single project. {%- endif %} Contributions are welcome, and they are greatly appreciated! Every little bit diff --git a/tests/smoke/base.sh b/tests/smoke/base.sh index f80aa5e2..1da58d21 100755 --- a/tests/smoke/base.sh +++ b/tests/smoke/base.sh @@ -51,7 +51,8 @@ elif command -v pdm &> /dev/null; then pdm install elif command -v hatch &> /dev/null; then COMMAND_PREFIX="hatch run" - +elif command -v maturin &> /dev/null; then + pip install . else # use setuptools pip install --editable . diff --git a/tests/smoke/build-system.sh b/tests/smoke/build-system.sh index 48b78208..fee7677c 100755 --- a/tests/smoke/build-system.sh +++ b/tests/smoke/build-system.sh @@ -8,3 +8,4 @@ SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" . ${SMOKE_DIR}/base.sh "build_system=setuptools" . ${SMOKE_DIR}/base.sh "build_system=pdm" . ${SMOKE_DIR}/base.sh "build_system=hatch" +. ${SMOKE_DIR}/base.sh "build_system=maturin" From ead563ffbe8812946a43a011ac446cb22bf85398 Mon Sep 17 00:00:00 2001 From: ayeankit Date: Tue, 25 Jul 2023 12:39:54 +0530 Subject: [PATCH 02/24] Added maturin as build-system for template --- .../build-system/flit-pyproject.toml | 4 ++-- .../build-system/maturin-pyproject.toml | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml index 6fc70f8b..dff59fc7 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/flit-pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["maturin"] -build-backend = "maturin" +requires = ["flit_core >=3.4"] +build-backend = "flit_core.buildapi" [project] diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml index dff59fc7..2426bb45 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml @@ -1,6 +1,5 @@ -[build-system] -requires = ["flit_core >=3.4"] -build-backend = "flit_core.buildapi" +requires = ["maturin"] +build-backend = "maturin" [project] From 0258228f27f990bc297122a7380cc48db5cd727a Mon Sep 17 00:00:00 2001 From: ayeankit Date: Tue, 25 Jul 2023 15:37:22 +0530 Subject: [PATCH 03/24] added cargo file --- src/scicookie/hooks/post_gen_project.py | 4 + .../build-system/Cargo.toml | 20 +++++ .../build-system/maturin-pyproject.toml | 85 ++++++++++--------- 3 files changed, 69 insertions(+), 40 deletions(-) create mode 100644 src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index 0378bb33..d68c8888 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -193,6 +193,10 @@ def clean_up_build_system(): shutil.move( build_system_dir / "maturin-pyproject.toml", PROJECT_DIRECTORY / 'pyproject.toml' + ) + shutil.move( + build_system_dir / "Cargo.toml", + PROJECT_DIRECTORY / 'Cargo.toml' ) else: shutil.move( diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml new file mode 100644 index 00000000..244f5a23 --- /dev/null +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "{{ cookiecutter.project_slug }}" +version = "0.1.0" +authors = [ + { name = "{{ cookiecutter.author_full_name }}", email = "{{ cookiecutter.author_email }}" }, +] +edition = "2021" + +[lib] +name = "{{ cookiecutter.project_slug }}" +# "cdylib" is necessary to produce a shared library for Python to import from. +crate-type = ["cdylib"] + +[dependencies] +rand = "0.8.4" + +[dependencies.pyo3] +version = "0.18.0" +# "abi3-py37" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.7 +features = ["abi3-py37"] diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml index 2426bb45..02d93bb8 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/maturin-pyproject.toml @@ -1,13 +1,14 @@ -requires = ["maturin"] +[build-system] +requires = ["maturin>=1.0,<2.0"] build-backend = "maturin" [project] name = "{{ cookiecutter.project_slug }}" +description = "{{ cookiecutter.project_short_description }}" authors = [ { name = "{{ cookiecutter.author_full_name }}", email = "{{ cookiecutter.author_email }}" }, ] -description = "{{ cookiecutter.project_short_description }}" {% if cookiecutter.project_layout == "src" -%} packages = [ {include = "{{ cookiecutter.package_slug }}", from="src"}, @@ -44,80 +45,80 @@ classifiers = [ "Typing :: Typed", ] dynamic = ["version"] -requires-python = ">=3.8.1" +requires-python = ">=3.8" dependencies = [ {# keep this line here #} {%- if cookiecutter.use_pytest == "yes" -%} - "pytest >= 7.3.2", + "pytest>=7.3.2", {% if cookiecutter.use_coverage == "yes" -%} - "pytest-cov >= 4.1.0", + "pytest-cov>=4.1.0", {% endif %} {%- endif -%}{#- end of use_pytest -#} {%- if cookiecutter.use_hypothesis == "yes" -%} - "hypothesis >= 6.0", + "hypothesis>=6.0", {% endif %} {%- if cookiecutter.use_coverage == "yes" -%} - "coverage >= 7.2.7", + "coverage>=7.2.7", {% endif %} {%- if cookiecutter.use_blue == "yes" -%} - "blue >= 0.9.1", + "blue>=0.9.1", {% endif %} {%- if cookiecutter.use_black == "yes" -%} - "black >= 23.3.0", + "black>=23.3.0", {% endif %} {%- if cookiecutter.use_isort == "yes" -%} - "isort >= 5.12.0", + "isort>=5.12.0", {% endif %} {%- if cookiecutter.use_pre_commit -%} - "pre-commit >= 3.3.2", + "pre-commit>=3.3.2", {% endif %} {%- if cookiecutter.use_flake8 == "yes" -%} - "flake8 >= 4.0.1, < 7", + "flake8>=4.0.1, <7", {% endif %} {%- if cookiecutter.use_ruff == "yes" -%} - "ruff >= 0.0.272", + "ruff>=0.0.272", {% endif %} {%- if cookiecutter.use_mypy == "yes" -%} - "mypy >= 1.3.0", + "mypy>=1.3.0", {% endif %} {%- if cookiecutter.use_bandit == "yes" -%} - "bandit >= 1.7.5", + "bandit>=1.7.5", {% endif %} {%- if cookiecutter.use_pydocstyle == "yes" -%} - "pydocstyle >= 6.3.0", + "pydocstyle>=6.3.0", {% endif %} {%- if cookiecutter.use_vulture == "yes" -%} - "vulture >= 2.7", + "vulture>=2.7", {% endif %} {%- if cookiecutter.use_mccabe == "yes" -%} - "mccabe >= 0.6.1", + "mccabe>=0.6.1", {% endif %} {%- if cookiecutter.use_containers in ['Docker', 'Podman'] -%} # if you want to use docker-compose from your system, remove compose-go here - "compose-go >= 2.18.1", -{% endif %} - "ipython < 8", - "ipykernel >=6.0.0", -{%- if cookiecutter.documentation_engine == 'mkdocs' %} - "Jinja2 >= 3.1.2", - "mkdocs >= 1.4.3", - "mkdocs-exclude >= 1.0.2", - "mkdocs-jupyter >= 0.24.1", - "mkdocs-literate-nav >= 0.6.0", - "mkdocs-macros-plugin >= 0.7.0, < 1", - "mkdocs-material >= 9.1.15", - "mkdocstrings >= 0.21.2", - "mkdocstrings-python >= 1.1.2", + "compose-go>=2.18.1", +{% endif %} + "ipython<8", + "ipykernel>=6.0.0", +{%- if cookiecutter.documentation_engine == 'mkdocs' -%} + "Jinja2>=3.1.2", + "mkdocs>=1.4.3", + "mkdocs-exclude>=1.0.2", + "mkdocs-jupyter>=0.24.1", + "mkdocs-literate-nav>=0.6.0", + "mkdocs-macros-plugin>=0.7.0, <1", + "mkdocs-material>=9.1.15", + "mkdocstrings>=0.21.2", + "mkdocstrings-python>=1.1.2", {% elif cookiecutter.documentation_engine == 'sphinx' -%} - "Sphinx >= 6.2.1", - "sphinx-rtd-theme >= 1.2.2", - "importlib-metadata >= 6.5.1", - "myst-parser >= 0.19.2", - "nbsphinx >= 0.9.2", - "pandoc >= 2.3", + "Sphinx>=6.2.1", + "sphinx-rtd-theme>=1.2.2", + "importlib-metadata>=6.5.1", + "myst-parser>=0.19.2", + "nbsphinx>=0.9.2", + "pandoc>=2.3", {% elif cookiecutter.documentation_engine == 'jupyter-book' -%} - "jupyter-book >= 0.15.1", - "myst-parser >= 0.18.1", + "jupyter-book>=0.15.1", + "myst-parser>=0.18.1", {% endif %} ] @@ -127,5 +128,9 @@ Homepage = "{{ cookiecutter.project_url }}" Discussions = "{{ cookiecutter.project_url }}/discussions" Changelog = "{{ cookiecutter.project_url }}/releases" +[tool.maturin] +manifest-path = "Cargo.toml" + + {% include "build-system/base-pyproject.toml" %} {#- keep this line at the end of the file -#} From 1d68f3d4a8d9f4f99e64103144b748add55cc421 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Tue, 25 Jul 2023 15:38:52 +0530 Subject: [PATCH 04/24] Update guide.md --- docs/guide.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/guide.md b/docs/guide.md index c74442bf..c930a624 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -231,7 +231,15 @@ packages. SciCookie support the following: can be confident that they will always produce the same results. It also helps you manage your Python environments, so you can be sure that your projects have the correct dependencies. -- [**Maturin**](https://pypi.org/project/maturin/0.8.2/):It's build system designed to create Python bindings from Rust projects. It allows Rust code to be seamlessly integrated into Python applications, providing efficient builds and cross-platform support for various Python versions. Maturin automates the generation of Python modules that directly access Rust functions, harnessing Rust's high performance and low-level capabilities within Python. Its user-friendly interface and compatibility with setuptools and Cargo make it an easy-to-use tool, offering developers a simple solution to combine the strengths of Python and Rust within a unified project. +- [**Maturin**](https://pypi.org/project/maturin/0.8.2/):It's build system designed + to create Python bindings from Rust projects. It allows Rust code to be seamlessly + integrated into Python applications, providing efficient builds and cross-platform + support for various Python versions. Maturin automates the generation of Python + modules that directly access Rust functions, harnessing Rust's high performance + and low-level capabilities within Python. Its user-friendly interface and + compatibility with setuptools and Cargo make it an easy-to-use tool, offering + developers a simple solution to combine the strengths of Python and Rust within + a unified project. The idea behind the options in SciCookie is that you can choose from some of the most popular system compilers to suit your needs and preferences for developing Python packages. If you think we should add more options, you can submit your From ffc666f5c0f936d772ba390763f6befe96ed0253 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Tue, 25 Jul 2023 16:12:24 +0530 Subject: [PATCH 05/24] Update Cargo.toml --- .../{{cookiecutter.project_slug}}/build-system/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml index 244f5a23..100d2531 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = [ { name = "{{ cookiecutter.author_full_name }}", email = "{{ cookiecutter.author_email }}" }, ] -edition = "2021" + [lib] name = "{{ cookiecutter.project_slug }}" From d7986616d85d413d4083426ed2445ec1adc4c78d Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Tue, 25 Jul 2023 17:56:54 +0530 Subject: [PATCH 06/24] added Maturin option here --- src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml b/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml index f1a9b494..80f50082 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml +++ b/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml @@ -17,8 +17,8 @@ dependencies: - pdm {%- elif cookiecutter.build_system == "hatch" %} - hatch -{%- elif cookiecutter.build_system == "pdm" %} - - pdm +{%- elif cookiecutter.build_system == "maturin" %} + - maturin {%- endif %} - nodejs # used by semantic-release - shellcheck From 0afa86a044568a09667a6f90166213b4e1b44908 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Tue, 25 Jul 2023 21:20:03 +0530 Subject: [PATCH 07/24] Update Cargo.toml --- .../{{cookiecutter.project_slug}}/build-system/Cargo.toml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml index 100d2531..1ede4384 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml @@ -1,10 +1,8 @@ [package] name = "{{ cookiecutter.project_slug }}" version = "0.1.0" -authors = [ - { name = "{{ cookiecutter.author_full_name }}", email = "{{ cookiecutter.author_email }}" }, -] - +authors = +["{{ cookiecutter.author_full_name }} <{{ cookiecutter.author_email }}>"] [lib] name = "{{ cookiecutter.project_slug }}" From f45de8dc8108136fcdc0f65475da971f541b70b8 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Tue, 25 Jul 2023 21:20:50 +0530 Subject: [PATCH 08/24] Update Cargo.toml --- .../{{cookiecutter.project_slug}}/build-system/Cargo.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml index 1ede4384..515e1529 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml @@ -1,8 +1,7 @@ [package] name = "{{ cookiecutter.project_slug }}" version = "0.1.0" -authors = -["{{ cookiecutter.author_full_name }} <{{ cookiecutter.author_email }}>"] +authors = ["{{ cookiecutter.author_full_name }} <{{ cookiecutter.author_email }}>"] [lib] name = "{{ cookiecutter.project_slug }}" From fd21a16fe7929ff26fed248f2aa17564da737fb6 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Tue, 25 Jul 2023 22:16:52 +0530 Subject: [PATCH 09/24] Update Cargo.toml --- .../{{cookiecutter.project_slug}}/build-system/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml index 515e1529..70b3928f 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "{{ cookiecutter.project_slug }}" +name = "{{ cookiecutter.package_slug }}" version = "0.1.0" authors = ["{{ cookiecutter.author_full_name }} <{{ cookiecutter.author_email }}>"] [lib] -name = "{{ cookiecutter.project_slug }}" +name = "{{ cookiecutter.package_slug }}" # "cdylib" is necessary to produce a shared library for Python to import from. crate-type = ["cdylib"] From 9d9c8f0641182306dfef8c424dac80671846cd19 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Tue, 25 Jul 2023 22:42:40 +0530 Subject: [PATCH 10/24] Update Package_slug --- .../{{cookiecutter.project_slug}}/build-system/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml index 70b3928f..fd7fd726 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "{{ cookiecutter.package_slug }}" +name = "{{ cookiecutter.project_slug }}" version = "0.1.0" authors = ["{{ cookiecutter.author_full_name }} <{{ cookiecutter.author_email }}>"] From 716c75797c943645dcdc987a75e6177c1ed1b035 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Wed, 26 Jul 2023 22:53:20 +0530 Subject: [PATCH 11/24] Added src folder for lib.rs --- src/scicookie/hooks/post_gen_project.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index d68c8888..ed544fef 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -250,14 +250,24 @@ def prepare_git(): print("=" * 80) print("NOTE: Run `git rebase -i upstream/{{ cookiecutter.git_main_branch }}`") print("=" * 80) - +def keep_src(): + if BUILD_SYSTEM == "maturin": + build_system_dir = PROJECT_DIRECTORY / "build-system" + src_system_dir = PROJECT_DIRECTORY/ "src" + if USE_SRC_LAYOUT : + shutil.move(build_system_dir/"lib.rs",'src') + else: + os.makedir(src_system_dir) + shutil.move(build_system_dir/"lib.rs",src_system_dir) + else : + pass def post_gen(): validation() # keep this one first, because it changes the package folder clean_up_project_layout() - + keep_src() clean_up_cli() clean_up_code_of_conduct() clean_up_conda() From 87f7bccff0adc37ccd2596afd44b0d31a9c0793f Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Wed, 26 Jul 2023 22:54:56 +0530 Subject: [PATCH 12/24] Created lib.rs --- .../build-system/lib.rs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/scicookie/{{cookiecutter.project_slug}}/build-system/lib.rs diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/lib.rs b/src/scicookie/{{cookiecutter.project_slug}}/build-system/lib.rs new file mode 100644 index 00000000..314fedc8 --- /dev/null +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/lib.rs @@ -0,0 +1,23 @@ +use pyo3::prelude::*; + +#[pyfunction] +fn add(x: i64, y: i64) -> i64 { + x + y +} + +#[pyfunction] +fn subtract(x: i64, y: i64) -> i64 { + x - y +} + +/// A Python module implemented in Rust. The name of this function must match +/// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to +/// import the module. +#[pymodule] +fn _core(_py: Python, m: &PyModule) -> PyResult<()> { + m.add_function(wrap_pyfunction!(add, m)?)?; + m.add_function(wrap_pyfunction!(subtract, m)?)?; + m.add("__version__", env!("CARGO_PKG_VERSION"))?; + + Ok(()) +} From 8a1039bbac9031d60c2c24b60e226ce3f8dae405 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Wed, 26 Jul 2023 23:41:03 +0530 Subject: [PATCH 13/24] added "_core" function to lib module --- .../{{cookiecutter.project_slug}}/build-system/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml index fd7fd726..4aea8914 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["{{ cookiecutter.author_full_name }} <{{ cookiecutter.author_email }}>"] [lib] -name = "{{ cookiecutter.package_slug }}" +name = "_core" # "cdylib" is necessary to produce a shared library for Python to import from. crate-type = ["cdylib"] From 316407b78b145b552cfdde9a2e392a7a8d0dd084 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Thu, 27 Jul 2023 00:03:06 +0530 Subject: [PATCH 14/24] Update dependency for py03 --- .../{{cookiecutter.project_slug}}/build-system/Cargo.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml index 4aea8914..b8e05436 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml @@ -12,6 +12,7 @@ crate-type = ["cdylib"] rand = "0.8.4" [dependencies.pyo3] -version = "0.18.0" -# "abi3-py37" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.7 -features = ["abi3-py37"] +version = "0.19.1" +# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so) +# "abi3-py38" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.8 +features = ["extension-module", "abi3-py38"] From 4bed5a06b457d82c5c25e005aff8a4e696e882ec Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Fri, 28 Jul 2023 01:08:29 +0530 Subject: [PATCH 15/24] added "use pyo3::wrap_pyfunction;" --- src/scicookie/{{cookiecutter.project_slug}}/build-system/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/lib.rs b/src/scicookie/{{cookiecutter.project_slug}}/build-system/lib.rs index 314fedc8..1aed67ef 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/lib.rs +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/lib.rs @@ -1,4 +1,5 @@ use pyo3::prelude::*; +use pyo3::wrap_pyfunction; #[pyfunction] fn add(x: i64, y: i64) -> i64 { From d6018cf458be56ee4be84fe7db3e14cf1183ee60 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Fri, 28 Jul 2023 01:41:00 +0530 Subject: [PATCH 16/24] added edition = "2021" to cargo.toml --- .../{{cookiecutter.project_slug}}/build-system/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml index b8e05436..bd932c8e 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/build-system/Cargo.toml @@ -2,6 +2,7 @@ name = "{{ cookiecutter.project_slug }}" version = "0.1.0" authors = ["{{ cookiecutter.author_full_name }} <{{ cookiecutter.author_email }}>"] +edition = "2021" [lib] name = "_core" From b76910bc330ece525a5e32651fc219dac0b05417 Mon Sep 17 00:00:00 2001 From: Ankit Kumar <72691866+ayeankit@users.noreply.github.com> Date: Fri, 28 Jul 2023 02:03:13 +0530 Subject: [PATCH 17/24] added rust as dependency --- src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml b/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml index 80f50082..cf313282 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml +++ b/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml @@ -18,7 +18,8 @@ dependencies: {%- elif cookiecutter.build_system == "hatch" %} - hatch {%- elif cookiecutter.build_system == "maturin" %} - - maturin + - maturin + - rust {%- endif %} - nodejs # used by semantic-release - shellcheck From 1ccdf24a1815bf9038c16921406fa9087c262eab Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 27 Jul 2023 16:42:43 -0400 Subject: [PATCH 18/24] Update src/scicookie/hooks/post_gen_project.py --- src/scicookie/hooks/post_gen_project.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index ed544fef..c7f55894 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -250,6 +250,8 @@ def prepare_git(): print("=" * 80) print("NOTE: Run `git rebase -i upstream/{{ cookiecutter.git_main_branch }}`") print("=" * 80) + + def keep_src(): if BUILD_SYSTEM == "maturin": build_system_dir = PROJECT_DIRECTORY / "build-system" From 2e5538f0c0ecbed3bf3b718c8e8e45e9e915bfd7 Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 27 Jul 2023 16:43:46 -0400 Subject: [PATCH 19/24] Update src/scicookie/hooks/post_gen_project.py --- src/scicookie/hooks/post_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index c7f55894..7721fb4c 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -257,7 +257,7 @@ def keep_src(): build_system_dir = PROJECT_DIRECTORY / "build-system" src_system_dir = PROJECT_DIRECTORY/ "src" if USE_SRC_LAYOUT : - shutil.move(build_system_dir/"lib.rs",'src') + shutil.move(build_system_dir/"lib.rs", "src") else: os.makedir(src_system_dir) shutil.move(build_system_dir/"lib.rs",src_system_dir) From 6119afdb89f6afdcd373c1f08f688e87d1db6cd8 Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 27 Jul 2023 16:44:28 -0400 Subject: [PATCH 20/24] Update src/scicookie/hooks/post_gen_project.py --- src/scicookie/hooks/post_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index 7721fb4c..0124e6fe 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -260,7 +260,7 @@ def keep_src(): shutil.move(build_system_dir/"lib.rs", "src") else: os.makedir(src_system_dir) - shutil.move(build_system_dir/"lib.rs",src_system_dir) + shutil.move(build_system_dir / "lib.rs", src_system_dir) else : pass From 495e48f180995b70362ec810fbbcfeae41b2e8d3 Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 27 Jul 2023 16:53:52 -0400 Subject: [PATCH 21/24] Update src/scicookie/hooks/post_gen_project.py --- src/scicookie/hooks/post_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index 0124e6fe..775c54fa 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -252,7 +252,7 @@ def prepare_git(): print("=" * 80) -def keep_src(): +def add_binding_source_files(): if BUILD_SYSTEM == "maturin": build_system_dir = PROJECT_DIRECTORY / "build-system" src_system_dir = PROJECT_DIRECTORY/ "src" From 2533e37b7d526c9b32ade9dcc77a9a94c5e13783 Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 27 Jul 2023 16:54:17 -0400 Subject: [PATCH 22/24] Update src/scicookie/hooks/post_gen_project.py --- src/scicookie/hooks/post_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index 775c54fa..8c3f9ca7 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -269,7 +269,7 @@ def post_gen(): # keep this one first, because it changes the package folder clean_up_project_layout() - keep_src() + add_binding_source_files() clean_up_cli() clean_up_code_of_conduct() clean_up_conda() From af060015fcd3a71ae4a687d1deace515ddd6b347 Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 27 Jul 2023 16:55:21 -0400 Subject: [PATCH 23/24] Update src/scicookie/hooks/post_gen_project.py --- src/scicookie/hooks/post_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index 8c3f9ca7..fa27962a 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -261,7 +261,7 @@ def add_binding_source_files(): else: os.makedir(src_system_dir) shutil.move(build_system_dir / "lib.rs", src_system_dir) - else : + else: pass def post_gen(): From 523ea987f8471413f09bf8f445d7f78ad6e0f56f Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 27 Jul 2023 16:55:47 -0400 Subject: [PATCH 24/24] Update src/scicookie/hooks/post_gen_project.py --- src/scicookie/hooks/post_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index fa27962a..70c137c7 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -257,7 +257,7 @@ def add_binding_source_files(): build_system_dir = PROJECT_DIRECTORY / "build-system" src_system_dir = PROJECT_DIRECTORY/ "src" if USE_SRC_LAYOUT : - shutil.move(build_system_dir/"lib.rs", "src") + shutil.move(build_system_dir / "lib.rs", "src") else: os.makedir(src_system_dir) shutil.move(build_system_dir / "lib.rs", src_system_dir)