miniscons


Nameminiscons JSON
Version 0.11.2 PyPI version JSON
download
home_pageNone
SummarySCons builders.
upload_time2024-05-05 15:12:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
license# MIT License Copyright (c) 2024 Joel Lefkowitz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords scons sconstruct builders
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Miniscons

SCons builders.

![Review](https://img.shields.io/github/actions/workflow/status/JoelLefkowitz/miniscons/review.yml)
![Version](https://img.shields.io/pypi/v/miniscons)
![Downloads](https://img.shields.io/pypi/dw/miniscons)
![Quality](https://img.shields.io/codacy/grade/97f4a968fe554186b58c2f49903a09f4)
![Coverage](https://img.shields.io/codacy/coverage/97f4a968fe554186b58c2f49903a09f4)

## Motivation

When writing an `SConstruct.py` configuration it is difficult to:

- Specify libraries and warnings for each build since the default environment is global
- Declare executable targets that depend on builds and don't need to be built themselves
- Parse outputs from `conan` to get include paths for build dependencies since they don't appear in the exported `conandeps`
- Declare and chain together aliases for external scripts

We can use `miniscons` to keep the `SConstruct.py` file short and get an interface like this:

```
builds:
  build
  tests

targets:
  start -> build
  test -> tests

scripts:
  clang-tidy
  cppclean

routines:
  lint -> [clang-tidy, cppclean]

flags:
  --dump
```

## Installation

```bash
pip install miniscons
```

## Documentation

Documentation and more detailed examples are hosted on [Github Pages](https://joellefkowitz.github.io/miniscons).

##  Usage

Parse the `SConscript_conandeps` if you are using `conan`:

```py
from miniscons import conan

env = conan()
```

Add the builds with their specific warning flags and libs to include:

```py
from miniscons import Build, flags, packages
from walkmate import tree

build = Build(
    "build",
    tree("src", r"(?<!\.spec)\.cpp$"),
    flags("c++11", ["shadow"]),
)

tests = Build(
    "tests",
    tree("src", r"\.cpp$", ["main.cpp"]),
    flags("c++11"),
    packages(["gtest"]),
)
```

Add the executable targets that depend on the builds with their runtime arguments:

```py
from miniscons import Target

start = Target("start", build)

test = Target("test", tests, ["--gtest_brief"])
```

Add the scripts to invoke your tooling:

```py
from miniscons import Script
from walkmate import tree

cppclean = Script("cppclean", ["."])

includes = tests.packages["CPPPATH"]

tidy = Script(
    "clang-tidy",
    [tree("src", r"\.(cpp)$"), "--", [f"-I{i}" for i in includes]],
)
```

Add the routines and flags for your interface:

```py
from miniscons import Flag, Routine

lint = Routine("lint", [cppclean, tidy])

dump = Flag("--dump")
```

Register all the declarations with the environment and add handlers for each flag:

```py
from miniscons import Tasks
from SCons.Script.Main import GetOption

cli = Tasks(
    [build, tests],
    [start, test],
    [tidy, cppclean],
    [lint],
    [dump],
)

cli.register(env)

if GetOption("dump"):
    cli.dump()
```

Now if we run

```bash
scons --dump
```

We get our interface:

```
scons: Reading SConscript files ...

builds:
  build
  tests

targets:
  start -> build
  test -> tests

scripts:
  clang-tidy
  cppclean

routines:
  lint -> [clang-tidy, cppclean]

flags:
  --dump
```

## Discussion

Why not use a simple task runner for scripts and routines?

Some scripts need access to the include paths that appear in the `SConstruct.py` file so they need to be integrated into the scons workflow.

## Tooling

### Dependencies

To install dependencies:

```bash
yarn install
pip install .[all]
```

### Tests

To run tests:

```bash
thx test
```

### Documentation

To generate the documentation locally:

```bash
thx docs
```

### Linters

To run linters:

```bash
thx lint
```

### Formatters

To run formatters:

```bash
thx format
```

## Contributing

Please read this repository's [Code of Conduct](CODE_OF_CONDUCT.md) which outlines our collaboration standards and the [Changelog](CHANGELOG.md) for details on breaking changes that have been made.

This repository adheres to semantic versioning standards. For more information on semantic versioning visit [SemVer](https://semver.org).

Bump2version is used to version and tag changes. For example:

```bash
bump2version patch
```

### Contributors

- [Joel Lefkowitz](https://github.com/joellefkowitz) - Initial work

## Remarks

Lots of love to the open source community!

<div align='center'>
    <img width=200 height=200 src='https://media.giphy.com/media/osAcIGTSyeovPq6Xph/giphy.gif' alt='Be kind to your mind' />
    <img width=200 height=200 src='https://media.giphy.com/media/KEAAbQ5clGWJwuJuZB/giphy.gif' alt='Love each other' />
    <img width=200 height=200 src='https://media.giphy.com/media/WRWykrFkxJA6JJuTvc/giphy.gif' alt="It's ok to have a bad day" />
</div>

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "miniscons",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "SCons, SConstruct, builders",
    "author": null,
    "author_email": "Joel Lefkowitz <joellefkowitz@hotmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/52/c4/75fc3e4c3edd1bdc9b14fb9392828223ea8c260d42e8f775488227f8f0d1/miniscons-0.11.2.tar.gz",
    "platform": null,
    "description": "# Miniscons\n\nSCons builders.\n\n![Review](https://img.shields.io/github/actions/workflow/status/JoelLefkowitz/miniscons/review.yml)\n![Version](https://img.shields.io/pypi/v/miniscons)\n![Downloads](https://img.shields.io/pypi/dw/miniscons)\n![Quality](https://img.shields.io/codacy/grade/97f4a968fe554186b58c2f49903a09f4)\n![Coverage](https://img.shields.io/codacy/coverage/97f4a968fe554186b58c2f49903a09f4)\n\n## Motivation\n\nWhen writing an `SConstruct.py` configuration it is difficult to:\n\n- Specify libraries and warnings for each build since the default environment is global\n- Declare executable targets that depend on builds and don't need to be built themselves\n- Parse outputs from `conan` to get include paths for build dependencies since they don't appear in the exported `conandeps`\n- Declare and chain together aliases for external scripts\n\nWe can use `miniscons` to keep the `SConstruct.py` file short and get an interface like this:\n\n```\nbuilds:\n  build\n  tests\n\ntargets:\n  start -> build\n  test -> tests\n\nscripts:\n  clang-tidy\n  cppclean\n\nroutines:\n  lint -> [clang-tidy, cppclean]\n\nflags:\n  --dump\n```\n\n## Installation\n\n```bash\npip install miniscons\n```\n\n## Documentation\n\nDocumentation and more detailed examples are hosted on [Github Pages](https://joellefkowitz.github.io/miniscons).\n\n## \u00a0Usage\n\nParse the `SConscript_conandeps` if you are using `conan`:\n\n```py\nfrom miniscons import conan\n\nenv = conan()\n```\n\nAdd the builds with their specific warning flags and libs to include:\n\n```py\nfrom miniscons import Build, flags, packages\nfrom walkmate import tree\n\nbuild = Build(\n    \"build\",\n    tree(\"src\", r\"(?<!\\.spec)\\.cpp$\"),\n    flags(\"c++11\", [\"shadow\"]),\n)\n\ntests = Build(\n    \"tests\",\n    tree(\"src\", r\"\\.cpp$\", [\"main.cpp\"]),\n    flags(\"c++11\"),\n    packages([\"gtest\"]),\n)\n```\n\nAdd the executable targets that depend on the builds with their runtime arguments:\n\n```py\nfrom miniscons import Target\n\nstart = Target(\"start\", build)\n\ntest = Target(\"test\", tests, [\"--gtest_brief\"])\n```\n\nAdd the scripts to invoke your tooling:\n\n```py\nfrom miniscons import Script\nfrom walkmate import tree\n\ncppclean = Script(\"cppclean\", [\".\"])\n\nincludes = tests.packages[\"CPPPATH\"]\n\ntidy = Script(\n    \"clang-tidy\",\n    [tree(\"src\", r\"\\.(cpp)$\"), \"--\", [f\"-I{i}\" for i in includes]],\n)\n```\n\nAdd the routines and flags for your interface:\n\n```py\nfrom miniscons import Flag, Routine\n\nlint = Routine(\"lint\", [cppclean, tidy])\n\ndump = Flag(\"--dump\")\n```\n\nRegister all the declarations with the environment and add handlers for each flag:\n\n```py\nfrom miniscons import Tasks\nfrom SCons.Script.Main import GetOption\n\ncli = Tasks(\n    [build, tests],\n    [start, test],\n    [tidy, cppclean],\n    [lint],\n    [dump],\n)\n\ncli.register(env)\n\nif GetOption(\"dump\"):\n    cli.dump()\n```\n\nNow if we run\n\n```bash\nscons --dump\n```\n\nWe get our interface:\n\n```\nscons: Reading SConscript files ...\n\nbuilds:\n  build\n  tests\n\ntargets:\n  start -> build\n  test -> tests\n\nscripts:\n  clang-tidy\n  cppclean\n\nroutines:\n  lint -> [clang-tidy, cppclean]\n\nflags:\n  --dump\n```\n\n## Discussion\n\nWhy not use a simple task runner for scripts and routines?\n\nSome scripts need access to the include paths that appear in the `SConstruct.py` file so they need to be integrated into the scons workflow.\n\n## Tooling\n\n### Dependencies\n\nTo install dependencies:\n\n```bash\nyarn install\npip install .[all]\n```\n\n### Tests\n\nTo run tests:\n\n```bash\nthx test\n```\n\n### Documentation\n\nTo generate the documentation locally:\n\n```bash\nthx docs\n```\n\n### Linters\n\nTo run linters:\n\n```bash\nthx lint\n```\n\n### Formatters\n\nTo run formatters:\n\n```bash\nthx format\n```\n\n## Contributing\n\nPlease read this repository's [Code of Conduct](CODE_OF_CONDUCT.md) which outlines our collaboration standards and the [Changelog](CHANGELOG.md) for details on breaking changes that have been made.\n\nThis repository adheres to semantic versioning standards. For more information on semantic versioning visit [SemVer](https://semver.org).\n\nBump2version is used to version and tag changes. For example:\n\n```bash\nbump2version patch\n```\n\n### Contributors\n\n- [Joel Lefkowitz](https://github.com/joellefkowitz) - Initial work\n\n## Remarks\n\nLots of love to the open source community!\n\n<div align='center'>\n    <img width=200 height=200 src='https://media.giphy.com/media/osAcIGTSyeovPq6Xph/giphy.gif' alt='Be kind to your mind' />\n    <img width=200 height=200 src='https://media.giphy.com/media/KEAAbQ5clGWJwuJuZB/giphy.gif' alt='Love each other' />\n    <img width=200 height=200 src='https://media.giphy.com/media/WRWykrFkxJA6JJuTvc/giphy.gif' alt=\"It's ok to have a bad day\" />\n</div>\n",
    "bugtrack_url": null,
    "license": "# MIT License  Copyright (c) 2024 Joel Lefkowitz  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "SCons builders.",
    "version": "0.11.2",
    "project_urls": {
        "homepage": "https://joellefkowitz.github.io/miniscons",
        "repository": "https://github.com/JoelLefkowitz/miniscons"
    },
    "split_keywords": [
        "scons",
        " sconstruct",
        " builders"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a54aa435d831f8234329a7b3b0b9db673ad472c1267ebdc02d2ca87a3cc8d6b5",
                "md5": "6580999a54c4aacdb0738e125127be22",
                "sha256": "530c95bace358ee8e7a2c29ca74c99bbd2a2dd7cfd28842af0f418a189a3a60e"
            },
            "downloads": -1,
            "filename": "miniscons-0.11.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6580999a54c4aacdb0738e125127be22",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9572,
            "upload_time": "2024-05-05T15:12:23",
            "upload_time_iso_8601": "2024-05-05T15:12:23.342769Z",
            "url": "https://files.pythonhosted.org/packages/a5/4a/a435d831f8234329a7b3b0b9db673ad472c1267ebdc02d2ca87a3cc8d6b5/miniscons-0.11.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "52c475fc3e4c3edd1bdc9b14fb9392828223ea8c260d42e8f775488227f8f0d1",
                "md5": "d7930d19b6951fe0d04a1252bd27009c",
                "sha256": "f97e48e71d07ea55754374f1f7cb04298e4e1dfe601acf2362cce131d02b3f9d"
            },
            "downloads": -1,
            "filename": "miniscons-0.11.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d7930d19b6951fe0d04a1252bd27009c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6345,
            "upload_time": "2024-05-05T15:12:25",
            "upload_time_iso_8601": "2024-05-05T15:12:25.018734Z",
            "url": "https://files.pythonhosted.org/packages/52/c4/75fc3e4c3edd1bdc9b14fb9392828223ea8c260d42e8f775488227f8f0d1/miniscons-0.11.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-05 15:12:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JoelLefkowitz",
    "github_project": "miniscons",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "miniscons"
}
        
Elapsed time: 0.28693s