pyprojectx


Namepyprojectx JSON
Version 3.1.3 PyPI version JSON
download
home_pageNone
SummaryExecute scripts from pyproject.toml, installing tools on-the-fly
upload_time2024-11-18 14:22:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords build dependency pyprojectx
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![pyprojectx](https://pyprojectx.github.io/assets/px.png)

# Pyprojectx: All-inclusive Python Projects

Execute scripts from pyproject.toml, installing tools on-the-fly

## [Full documentation](https://pyprojectx.github.io)

## Introduction
Pyprojectx makes it easy to create all-inclusive Python projects; no need to install any tools upfront,
not even Pyprojectx itself!

Tools that are specified within your pyproject.toml file will be installed on demand when invoked from Pyprojectx:
```shell
> ./pw black src
Collecting black ...
Successfully installed black-23.9.1 ...

All done! ✨ 🍰 ✨
18 files left unchanged.
```

## Feature highlights
* Reproducible builds by treating tools and utilities as (locked) dev-dependencies
* No global installs, everything is stored inside your project directory (like npm's _node_modules_)
* Bootstrap your entire build process with a small wrapper script (like Gradle's _gradlew_ wrapper)
* Configure shortcuts for routine tasks
* Simple configuration in _pyproject.toml_

Projects can be build/tested/used immediately without explicit installation nor initialization:
```bash
git clone https://github.com/pyprojectx/px-demo.git
cd px-demo
./pw build
```
![Clone and Build](https://raw.githubusercontent.com/pyprojectx/pyprojectx/main/docs/docs/assets/build.png)

## Installation
One of the key features is that there is no need to install anything explicitly (except a Python 3.9+ interpreter).

`cd` into your project directory and download the
[wrapper scripts](https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip):

**Linux/Mac**
```bash
curl -LO https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip && unzip wrappers.zip && rm -f wrappers.zip
```

**Windows**
```powershell
Invoke-WebRequest https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip -OutFile wrappers.zip; Expand-Archive -Path wrappers.zip -DestinationPath .; Remove-Item -Path wrappers.zip
```

## Getting started
Initialize a new or existing project by adding tools (on Windows, replace `./pw` with `pw`):
```bash
./pw --add pdm,ruff,pre-commit,px-utils
./pw --install-context main
# invoke a tool via the wrapper script
./pw pdm --version
./pw ruff check src
# or activate the tool context
source .pyprojectx/main/activate
pdm --version
ruff check src
```

For reproducible builds and developer experience, it is recommended to lock the versions of the tools
and add the generated _pw.lock_ file to your repository:
```bash
./pw --lock
```

## Create command shortcuts
The _tool.pyprojectx.aliases_ section in _pyproject.toml_ can contain commandline aliases:
```toml
[tool.pyprojectx.aliases]
# convenience shortcuts
run = "poetry run"
test = "poetry run pytest"
lint = ["ruff check"]
check = ["@lint", "@test"]
```

## Usage
Instead of calling the CLI of a tool directly, prefix it with `./pw` (`pw` on Windows).

Examples:
```shell
./pw poetry add -D pytest
cd src
../pw lint
```

Aliases can be invoked as is or with extra arguments:
```shell
./pw poetry run my-script --foo bar
# same as above, but using the run alias
./pw run my-script --foo bar
```

## Why yet another tool?
* As Python noob I had hard times setting up a project and building existing projects
* There is always someone in the team having issues with his setup, either with a specific tool, with Homebrew, pipx, ...
* Using (PDM or Poetry) dev-dependencies to install tools, impacts your production dependencies and can even lead to dependency conflicts
* Different projects often require different versions of the same tool

## Example projects
* This project (using PDM)
* [px-demo](https://github.com/pyprojectx/px-demo) (using PDM)

## Development
* Build/test:
```shell
git clone https://github.com/pyprojectx/pyprojectx.git
cd pyprojectx
./pw build
```

* Use your local pyprojectx copy in another project: set the path to pyprojectx in the _PYPROJECTX_PACKAGE_ environment variable
  and create a symlink to the wrapper script.
```shell
# Linux, Mac
export PYPROJECTX_PACKAGE=path/to/pyprojectx
ln -s $PYPROJECTX_PACKAGE/src/pyprojectx/wrapper/pw.py pw
# windows
set PYPROJECTX_PACKAGE=path/to/pyprojectx
mklink pw %PYPROJECTX_PACKAGE%\src\pyprojectx\wrapper\pw.py
# or copy the wrapper script if you can't create a symlink on windows
copy %PYPROJECTX_PACKAGE%\src\pyprojectx\wrapper\pw.py pw
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyprojectx",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "build, dependency, pyprojectx",
    "author": null,
    "author_email": "Houbie <ivo@houbrechts-it.be>",
    "download_url": "https://files.pythonhosted.org/packages/f6/b0/42b2483c7705961d0e76b4a938428adc2ef1090d1fd4e33fddecd2e99b48/pyprojectx-3.1.3.tar.gz",
    "platform": null,
    "description": "![pyprojectx](https://pyprojectx.github.io/assets/px.png)\n\n# Pyprojectx: All-inclusive Python Projects\n\nExecute scripts from pyproject.toml, installing tools on-the-fly\n\n## [Full documentation](https://pyprojectx.github.io)\n\n## Introduction\nPyprojectx makes it easy to create all-inclusive Python projects; no need to install any tools upfront,\nnot even Pyprojectx itself!\n\nTools that are specified within your pyproject.toml file will be installed on demand when invoked from Pyprojectx:\n```shell\n> ./pw black src\nCollecting black ...\nSuccessfully installed black-23.9.1 ...\n\nAll done! \u2728 \ud83c\udf70 \u2728\n18 files left unchanged.\n```\n\n## Feature highlights\n* Reproducible builds by treating tools and utilities as (locked) dev-dependencies\n* No global installs, everything is stored inside your project directory (like npm's _node_modules_)\n* Bootstrap your entire build process with a small wrapper script (like Gradle's _gradlew_ wrapper)\n* Configure shortcuts for routine tasks\n* Simple configuration in _pyproject.toml_\n\nProjects can be build/tested/used immediately without explicit installation nor initialization:\n```bash\ngit clone https://github.com/pyprojectx/px-demo.git\ncd px-demo\n./pw build\n```\n![Clone and Build](https://raw.githubusercontent.com/pyprojectx/pyprojectx/main/docs/docs/assets/build.png)\n\n## Installation\nOne of the key features is that there is no need to install anything explicitly (except a Python 3.9+ interpreter).\n\n`cd` into your project directory and download the\n[wrapper scripts](https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip):\n\n**Linux/Mac**\n```bash\ncurl -LO https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip && unzip wrappers.zip && rm -f wrappers.zip\n```\n\n**Windows**\n```powershell\nInvoke-WebRequest https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip -OutFile wrappers.zip; Expand-Archive -Path wrappers.zip -DestinationPath .; Remove-Item -Path wrappers.zip\n```\n\n## Getting started\nInitialize a new or existing project by adding tools (on Windows, replace `./pw` with `pw`):\n```bash\n./pw --add pdm,ruff,pre-commit,px-utils\n./pw --install-context main\n# invoke a tool via the wrapper script\n./pw pdm --version\n./pw ruff check src\n# or activate the tool context\nsource .pyprojectx/main/activate\npdm --version\nruff check src\n```\n\nFor reproducible builds and developer experience, it is recommended to lock the versions of the tools\nand add the generated _pw.lock_ file to your repository:\n```bash\n./pw --lock\n```\n\n## Create command shortcuts\nThe _tool.pyprojectx.aliases_ section in _pyproject.toml_ can contain commandline aliases:\n```toml\n[tool.pyprojectx.aliases]\n# convenience shortcuts\nrun = \"poetry run\"\ntest = \"poetry run pytest\"\nlint = [\"ruff check\"]\ncheck = [\"@lint\", \"@test\"]\n```\n\n## Usage\nInstead of calling the CLI of a tool directly, prefix it with `./pw` (`pw` on Windows).\n\nExamples:\n```shell\n./pw poetry add -D pytest\ncd src\n../pw lint\n```\n\nAliases can be invoked as is or with extra arguments:\n```shell\n./pw poetry run my-script --foo bar\n# same as above, but using the run alias\n./pw run my-script --foo bar\n```\n\n## Why yet another tool?\n* As Python noob I had hard times setting up a project and building existing projects\n* There is always someone in the team having issues with his setup, either with a specific tool, with Homebrew, pipx, ...\n* Using (PDM or Poetry) dev-dependencies to install tools, impacts your production dependencies and can even lead to dependency conflicts\n* Different projects often require different versions of the same tool\n\n## Example projects\n* This project (using PDM)\n* [px-demo](https://github.com/pyprojectx/px-demo) (using PDM)\n\n## Development\n* Build/test:\n```shell\ngit clone https://github.com/pyprojectx/pyprojectx.git\ncd pyprojectx\n./pw build\n```\n\n* Use your local pyprojectx copy in another project: set the path to pyprojectx in the _PYPROJECTX_PACKAGE_ environment variable\n  and create a symlink to the wrapper script.\n```shell\n# Linux, Mac\nexport PYPROJECTX_PACKAGE=path/to/pyprojectx\nln -s $PYPROJECTX_PACKAGE/src/pyprojectx/wrapper/pw.py pw\n# windows\nset PYPROJECTX_PACKAGE=path/to/pyprojectx\nmklink pw %PYPROJECTX_PACKAGE%\\src\\pyprojectx\\wrapper\\pw.py\n# or copy the wrapper script if you can't create a symlink on windows\ncopy %PYPROJECTX_PACKAGE%\\src\\pyprojectx\\wrapper\\pw.py pw\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Execute scripts from pyproject.toml, installing tools on-the-fly",
    "version": "3.1.3",
    "project_urls": {
        "documentation": "https://pyprojectx.github.io",
        "homepage": "https://github.com/pyprojectx/pyprojectx"
    },
    "split_keywords": [
        "build",
        " dependency",
        " pyprojectx"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8c2ac602aefe4513f801f525b5ca72ffa162361137886d88b02473756aad916",
                "md5": "a88cb7e33a6f5eadc85fe222c8a1277e",
                "sha256": "51a26e9304e4411f2f2680324130ab5e9adbe758e9774b1f882b48e792dee536"
            },
            "downloads": -1,
            "filename": "pyprojectx-3.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a88cb7e33a6f5eadc85fe222c8a1277e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 21700,
            "upload_time": "2024-11-18T14:22:12",
            "upload_time_iso_8601": "2024-11-18T14:22:12.364604Z",
            "url": "https://files.pythonhosted.org/packages/d8/c2/ac602aefe4513f801f525b5ca72ffa162361137886d88b02473756aad916/pyprojectx-3.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f6b042b2483c7705961d0e76b4a938428adc2ef1090d1fd4e33fddecd2e99b48",
                "md5": "b8d7838b4653e9a45d308fa83a529a33",
                "sha256": "89ece64050528b110fab220c2c231224d2e5dcc7214584e0688c1ceb6841a123"
            },
            "downloads": -1,
            "filename": "pyprojectx-3.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "b8d7838b4653e9a45d308fa83a529a33",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 28690,
            "upload_time": "2024-11-18T14:22:14",
            "upload_time_iso_8601": "2024-11-18T14:22:14.023170Z",
            "url": "https://files.pythonhosted.org/packages/f6/b0/42b2483c7705961d0e76b4a938428adc2ef1090d1fd4e33fddecd2e99b48/pyprojectx-3.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 14:22:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pyprojectx",
    "github_project": "pyprojectx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyprojectx"
}
        
Elapsed time: 0.38158s