Package: packse
packsePython packaging scenarios.InstallationOnly a local installation is supported at this time:poetryinstallOnce installed, thepacksecommand-line interface will be available.Depending on your Poetry configuration, you may need to usepoetry run packseinstead or activate Poetry's
virtual environment.UsageScenariosA scenario is a JSON description of a dependency tree.Seescenarios/example.jsonEach scenario file can contain one or more scenarios.Listing scenariosA list of available scenarios can be printed with thelistcommand:packselistBy default, packse will search for scenarios in the current tree. You may also pass a file to read
from:packselistscenarios/example.jsonEach 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.Eachpacksecommand supports reading multiple scenario files. For example, withlist:packselistscenarios/example.jsonscenarios/requires-does-not-exist.jsonViewing scenariosThe dependency tree of a scenario can be previewed using theviewcommand:$ packse view scenarios/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.0Note theviewcommand will view all scenarios in a file by default. A single scenario can be viewed by providing
the--nameoption:$ packse view scenarios/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.0Notice, when a specific scenario is specified, there is more information displayed.Building scenariosA scenario can be used to generate packages and build distributions:packsebuildscenario/example.jsonThebuild/directory will contain sources for all of the packages in the scenario.
Thedist/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-hashargument, however, this will prevent
publishing multiple times to a registry that does not allow overwrites.ThePACKSE_VERSION_SEEDenvironment 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 scenariosBuilt scenarios can be published to a Python Package Index with thepublishcommand:packsepublishdist/example-cd797223By default, packages are published to the Test PyPI server.Credentials must be provided via thePACKSE_PYPI_PASSWORDenvironment variable.PACKSE_PYPI_USERNAMEcan be
used to set a username if not using an API token. If using a server which does not require authentication, the--anonymousflag can be passed.Running a package indexRequires installation with theindexextraA local package index can be controlled with theindexcommand. For example, to start a local package index:packseindexupThe--bgflag can be passed to run the index in the background.
When running an index in the background, state will be stored in the~/.packsedirectory. ThePACKSE_STATE_PATHenvironment variable can be used to change the state path.Packages can be installed by passing the--index-urlflag to the installer e.g. withpip:pipinstall--index-urlhttp://127.0.0.1:3141example-0611cb74Packages can be published to the index by providing the--index-urland--anonymousflags to thepublishcommand:packsepublishdist/example-cd797223--index-urlhttp://localhost:3141--anonymousPackages can also be published to the index by placing their distributions in the configured--dist-dir. This defaults
to./distwhich is also the default location used inpackse build.By default, the  index will fallback to PyPI for missing packages. To test in isolation, use the--offlineflag.To stop an index running in the background usepackse index down:packse index downServing scenariosRequires installation with theserveextraTheservecommand can be used to host, build, and publish scenarios in one step.packseservescenariosPackse will watch for changes to thescenariosdirectory, and publish new versions on each change.Note when developing, it is often useful to use the--no-hashflag to avoid having to determine the latest
hash for the scenario.Testing scenariosPublished scenarios can then be tested with your choice of package manager.For example, withpip:pipinstall-ihttps://test.pypi.org/simple/example-cd797223Exporting scenariosScenario information can be exported with thepackse inspect. This creates a JSON representation of the scenarios
with additional generated information such as the root package name and the tree displayed duringpackse view.Writing new scenariosScenario files may contain one or more scenarios written in JSON. See the existing scenarios for examples and
theScenariotype for details on the supported schema.