packse


Namepackse JSON
Version 0.3.39 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-11-04 12:35:36
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords packaging packse requirements testing uv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # packse

Python packaging scenarios.

## Installation

Install from PyPI:

```bash
uv pip install packse
```

Once installed, the `packse` command-line interface will be available.

## Usage

### Scenarios

A scenario is a JSON description of a dependency tree.

See [`scenarios/examples/`](./scenarios/examples/)

Each scenario file can contain one or more scenarios.

### Listing scenarios

A list of available scenarios can be printed with the `list` command:

```bash
packse list
```

By default, packse will search for scenarios in the current tree. You may also pass a file to read
from:

```bash
packse list scenarios/examples/example.json
```

Each scenario will be listed with its unique identifier e.g. `example-cd797223`. This is the name of the package
that can be installed to run the scenario once it is built and published.

Each `packse` command supports reading multiple scenario files. For example, with `list`:

```bash
packse list scenarios/examples/example.json scenarios/requires-does-not-exist.json
```

### Viewing scenarios

The dependency tree of a scenario can be previewed using the `view` command:

```
$ packse view scenarios/examples/example.json
example-89cac9f1
├── root
│   └── requires a
│       └── satisfied by a-1.0.0
├── a
│   └── a-1.0.0
│       └── requires b>1.0.0
│           ├── satisfied by b-2.0.0
│           └── satisfied by b-3.0.0
└── b
    ├── b-1.0.0
    ├── b-2.0.0
    │   └── requires c
    │       └── unsatisfied: no versions for package
    └── b-3.0.0
```

Note the `view` command will view all scenarios in a file by default. A single scenario can be viewed by providing
the `--name` option:

```
$ packse view scenarios/examples/example.json --name example
example

This is an example scenario, in which the user depends on a single package `a` which requires `b`

example-89cac9f1
├── root
│   └── requires a
│       └── satisfied by a-1.0.0
├── a
│   └── a-1.0.0
│       └── requires b>1.0.0
│           ├── satisfied by b-2.0.0
│           └── satisfied by b-3.0.0
└── b
    ├── b-1.0.0
    ├── b-2.0.0
    │   └── requires c
    │       └── unsatisfied: no versions for package
    └── b-3.0.0
```

Notice, when a specific scenario is specified, there is more information displayed.

### Building scenarios

A scenario can be used to generate packages and build distributions:

```bash
packse build scenario/example.json
```

The `build/` directory will contain sources for all of the packages in the scenario.
The `dist/` directory will contain built distributions for all of the packages in the scenario.

When a scenario is built, it is given a unique identifier based on a hash of the scenario contents and the project
templates used to generate the packages. Each package and requirement in the scenario will be prefixed with the
identifier. The unique identifier can be excluded using the `--no-hash` argument, however, this will prevent
publishing multiple times to a registry that does not allow overwrites.

The `PACKSE_VERSION_SEED` environment variable can be used to override the seed used to generate the unique
identifier, allowing versions to differ based on information outside of packse.

### Publishing scenarios

Built scenarios can be published to a Python Package Index with the `publish` command:

```bash
packse publish dist/example-cd797223
```

By default, packages are published to the Test PyPI server.

Credentials must be provided via the `PACKSE_PYPI_PASSWORD` environment variable. `PACKSE_PYPI_USERNAME` can be
used to set a username if not using an API token. If using a server which does not require authentication, the
`--anonymous` flag can be passed.

### Running a package index

_Requires installation with the `index` extra_

A local package index can be controlled with the `index` command. For example, to start a local package index:

```bash
packse index up
```

The `--bg` flag can be passed to run the index in the background.
When running an index in the background, state will be stored in the `~/.packse` directory. The `PACKSE_STATE_PATH`
environment variable can be used to change the state path.

Packages can be installed by passing the `--index-url` flag to the installer e.g. with `pip`:

```bash
pip install --index-url http://127.0.0.1:3141 example-0611cb74
```

Packages can be published to the index by providing the `--index-url` and `--anonymous` flags to the `publish` command:

```bash
packse publish dist/example-cd797223 --index-url http://localhost:3141 --anonymous
```

Packages can also be published to the index by placing their distributions in the configured `--dist-dir`. This defaults
to `./dist` which is also the default location used in `packse build`.

By default, the index will fallback to PyPI for missing packages. To test in isolation, use the `--offline` flag.

To stop an index running in the background use `packse index down`:

```
packse index down
```

### Serving scenarios

_Requires installation with the `serve` extra_

The `serve` command can be used to host, build, and publish scenarios in one step.

```bash
packse serve scenarios
```

Packse will watch for changes to the `scenarios` directory, and publish new versions on each change.

Note when developing, it is often useful to use the `--no-hash` flag to avoid having to determine the latest
hash for the scenario.

### Testing scenarios

Published scenarios can then be tested with your choice of package manager.

For example, with `pip`:

```bash
pip install -i https://test.pypi.org/simple/ example-cd797223
```

### Exporting scenarios

Scenario information can be exported with the `packse inspect`. This creates a JSON representation of the scenarios
with additional generated information such as the root package name and the tree displayed during `packse view`.

### Writing new scenarios

Scenario files may contain one or more scenarios written in JSON. See the existing scenarios for examples and
the `Scenario` type for details on the supported schema.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "packse",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "packaging, packse, requirements, testing, uv",
    "author": null,
    "author_email": "\"Astral Software Inc.\" <hey@astral.sh>",
    "download_url": "https://files.pythonhosted.org/packages/d5/c6/810310ea8722107d567d28fdcbaf3cee4c7a2e9c011497fed0e3da4ceea0/packse-0.3.39.tar.gz",
    "platform": null,
    "description": "# packse\n\nPython packaging scenarios.\n\n## Installation\n\nInstall from PyPI:\n\n```bash\nuv pip install packse\n```\n\nOnce installed, the `packse` command-line interface will be available.\n\n## Usage\n\n### Scenarios\n\nA scenario is a JSON description of a dependency tree.\n\nSee [`scenarios/examples/`](./scenarios/examples/)\n\nEach scenario file can contain one or more scenarios.\n\n### Listing scenarios\n\nA list of available scenarios can be printed with the `list` command:\n\n```bash\npackse list\n```\n\nBy default, packse will search for scenarios in the current tree. You may also pass a file to read\nfrom:\n\n```bash\npackse list scenarios/examples/example.json\n```\n\nEach scenario will be listed with its unique identifier e.g. `example-cd797223`. This is the name of the package\nthat can be installed to run the scenario once it is built and published.\n\nEach `packse` command supports reading multiple scenario files. For example, with `list`:\n\n```bash\npackse list scenarios/examples/example.json scenarios/requires-does-not-exist.json\n```\n\n### Viewing scenarios\n\nThe dependency tree of a scenario can be previewed using the `view` command:\n\n```\n$ packse view scenarios/examples/example.json\nexample-89cac9f1\n\u251c\u2500\u2500 root\n\u2502   \u2514\u2500\u2500 requires a\n\u2502       \u2514\u2500\u2500 satisfied by a-1.0.0\n\u251c\u2500\u2500 a\n\u2502   \u2514\u2500\u2500 a-1.0.0\n\u2502       \u2514\u2500\u2500 requires b>1.0.0\n\u2502           \u251c\u2500\u2500 satisfied by b-2.0.0\n\u2502           \u2514\u2500\u2500 satisfied by b-3.0.0\n\u2514\u2500\u2500 b\n    \u251c\u2500\u2500 b-1.0.0\n    \u251c\u2500\u2500 b-2.0.0\n    \u2502   \u2514\u2500\u2500 requires c\n    \u2502       \u2514\u2500\u2500 unsatisfied: no versions for package\n    \u2514\u2500\u2500 b-3.0.0\n```\n\nNote the `view` command will view all scenarios in a file by default. A single scenario can be viewed by providing\nthe `--name` option:\n\n```\n$ packse view scenarios/examples/example.json --name example\nexample\n\nThis is an example scenario, in which the user depends on a single package `a` which requires `b`\n\nexample-89cac9f1\n\u251c\u2500\u2500 root\n\u2502   \u2514\u2500\u2500 requires a\n\u2502       \u2514\u2500\u2500 satisfied by a-1.0.0\n\u251c\u2500\u2500 a\n\u2502   \u2514\u2500\u2500 a-1.0.0\n\u2502       \u2514\u2500\u2500 requires b>1.0.0\n\u2502           \u251c\u2500\u2500 satisfied by b-2.0.0\n\u2502           \u2514\u2500\u2500 satisfied by b-3.0.0\n\u2514\u2500\u2500 b\n    \u251c\u2500\u2500 b-1.0.0\n    \u251c\u2500\u2500 b-2.0.0\n    \u2502   \u2514\u2500\u2500 requires c\n    \u2502       \u2514\u2500\u2500 unsatisfied: no versions for package\n    \u2514\u2500\u2500 b-3.0.0\n```\n\nNotice, when a specific scenario is specified, there is more information displayed.\n\n### Building scenarios\n\nA scenario can be used to generate packages and build distributions:\n\n```bash\npackse build scenario/example.json\n```\n\nThe `build/` directory will contain sources for all of the packages in the scenario.\nThe `dist/` directory will contain built distributions for all of the packages in the scenario.\n\nWhen a scenario is built, it is given a unique identifier based on a hash of the scenario contents and the project\ntemplates used to generate the packages. Each package and requirement in the scenario will be prefixed with the\nidentifier. The unique identifier can be excluded using the `--no-hash` argument, however, this will prevent\npublishing multiple times to a registry that does not allow overwrites.\n\nThe `PACKSE_VERSION_SEED` environment variable can be used to override the seed used to generate the unique\nidentifier, allowing versions to differ based on information outside of packse.\n\n### Publishing scenarios\n\nBuilt scenarios can be published to a Python Package Index with the `publish` command:\n\n```bash\npackse publish dist/example-cd797223\n```\n\nBy default, packages are published to the Test PyPI server.\n\nCredentials must be provided via the `PACKSE_PYPI_PASSWORD` environment variable. `PACKSE_PYPI_USERNAME` can be\nused to set a username if not using an API token. If using a server which does not require authentication, the\n`--anonymous` flag can be passed.\n\n### Running a package index\n\n_Requires installation with the `index` extra_\n\nA local package index can be controlled with the `index` command. For example, to start a local package index:\n\n```bash\npackse index up\n```\n\nThe `--bg` flag can be passed to run the index in the background.\nWhen running an index in the background, state will be stored in the `~/.packse` directory. The `PACKSE_STATE_PATH`\nenvironment variable can be used to change the state path.\n\nPackages can be installed by passing the `--index-url` flag to the installer e.g. with `pip`:\n\n```bash\npip install --index-url http://127.0.0.1:3141 example-0611cb74\n```\n\nPackages can be published to the index by providing the `--index-url` and `--anonymous` flags to the `publish` command:\n\n```bash\npackse publish dist/example-cd797223 --index-url http://localhost:3141 --anonymous\n```\n\nPackages can also be published to the index by placing their distributions in the configured `--dist-dir`. This defaults\nto `./dist` which is also the default location used in `packse build`.\n\nBy default, the index will fallback to PyPI for missing packages. To test in isolation, use the `--offline` flag.\n\nTo stop an index running in the background use `packse index down`:\n\n```\npackse index down\n```\n\n### Serving scenarios\n\n_Requires installation with the `serve` extra_\n\nThe `serve` command can be used to host, build, and publish scenarios in one step.\n\n```bash\npackse serve scenarios\n```\n\nPackse will watch for changes to the `scenarios` directory, and publish new versions on each change.\n\nNote when developing, it is often useful to use the `--no-hash` flag to avoid having to determine the latest\nhash for the scenario.\n\n### Testing scenarios\n\nPublished scenarios can then be tested with your choice of package manager.\n\nFor example, with `pip`:\n\n```bash\npip install -i https://test.pypi.org/simple/ example-cd797223\n```\n\n### Exporting scenarios\n\nScenario information can be exported with the `packse inspect`. This creates a JSON representation of the scenarios\nwith additional generated information such as the root package name and the tree displayed during `packse view`.\n\n### Writing new scenarios\n\nScenario files may contain one or more scenarios written in JSON. See the existing scenarios for examples and\nthe `Scenario` type for details on the supported schema.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.3.39",
    "project_urls": null,
    "split_keywords": [
        "packaging",
        " packse",
        " requirements",
        " testing",
        " uv"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "01a3baea0dadb43a0f08baf19b2b4356edf40fa11fd6a68f28e17c3420eaeda8",
                "md5": "e0958d62622237ca2fbca3d7cf21504b",
                "sha256": "be35f05ffa153f3be6a8054ef0afe7dacc7c21899bd6d4a4d21ae1ed56a409a1"
            },
            "downloads": -1,
            "filename": "packse-0.3.39-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e0958d62622237ca2fbca3d7cf21504b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 36078,
            "upload_time": "2024-11-04T12:35:35",
            "upload_time_iso_8601": "2024-11-04T12:35:35.350411Z",
            "url": "https://files.pythonhosted.org/packages/01/a3/baea0dadb43a0f08baf19b2b4356edf40fa11fd6a68f28e17c3420eaeda8/packse-0.3.39-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d5c6810310ea8722107d567d28fdcbaf3cee4c7a2e9c011497fed0e3da4ceea0",
                "md5": "ce051401e94eb200df1843f3db643158",
                "sha256": "81aacc142939a3cde37bfad065aea62dce4b0fc6f70d2b4a4915bfca9dc3ec07"
            },
            "downloads": -1,
            "filename": "packse-0.3.39.tar.gz",
            "has_sig": false,
            "md5_digest": "ce051401e94eb200df1843f3db643158",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 5870672,
            "upload_time": "2024-11-04T12:35:36",
            "upload_time_iso_8601": "2024-11-04T12:35:36.755580Z",
            "url": "https://files.pythonhosted.org/packages/d5/c6/810310ea8722107d567d28fdcbaf3cee4c7a2e9c011497fed0e3da4ceea0/packse-0.3.39.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-04 12:35:36",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "packse"
}
        
Elapsed time: 0.40367s