{"id":27011633,"url":"https://github.com/eth-cscs/py2spack","last_synced_at":"2025-04-04T11:36:16.220Z","repository":{"id":247612028,"uuid":"809716850","full_name":"eth-cscs/py2spack","owner":"eth-cscs","description":"Automatic conversion of standard Python packages to Spack package recipes.","archived":false,"fork":false,"pushed_at":"2024-09-11T14:56:43.000Z","size":288,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-18T20:43:28.610Z","etag":null,"topics":["python-packages","spack","spack-packages"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eth-cscs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-03T10:08:56.000Z","updated_at":"2024-09-17T11:43:23.000Z","dependencies_parsed_at":"2024-08-20T09:14:39.930Z","dependency_job_id":"67ddad49-8787-4a78-9c77-9f6a0aaf0a29","html_url":"https://github.com/eth-cscs/py2spack","commit_stats":null,"previous_names":["davhofer/py2spack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-cscs%2Fpy2spack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-cscs%2Fpy2spack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-cscs%2Fpy2spack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-cscs%2Fpy2spack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eth-cscs","download_url":"https://codeload.github.com/eth-cscs/py2spack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247173256,"owners_count":20896053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python-packages","spack","spack-packages"],"created_at":"2025-04-04T11:36:15.589Z","updated_at":"2025-04-04T11:36:16.213Z","avatar_url":"https://github.com/eth-cscs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# py2spack: Automating conversion of standard python packages to Spack package recipes\n\nGithub repository for the CSCS internship project with the goal of developing a Python tool for automatically generating Spack package recipes based on existing Python packages, with the ability to handle direct and transitive dependencies and flexible versions.\n\nFor more information, see the [Documentation](#Documentation).\n\n## Installation\n\nThe package is still in development and not yet published to PyPI. It can however be installed manually.\n\n1. If you don't have it yet, [install Spack](https://spack.readthedocs.io/en/latest/getting_started.html) on your system.\n2. py2spack imports various modules from Spack and thus needs to find those through `$PYTHONPATH`\n\n   1. Make sure that the environment variable `SPACK_ROOT` is set, e.g. `export SPACK_ROOT=/home/\u003cuser\u003e/spack`.\n   2. Either execute the following in your active shell or place it in your shell rc file (e.g. `.bashrc`, `.zshrc`). If you place it in the `.rc` file, make sure `$SPACK_ROOT` is set or replace it with the explicit path.\n\n   ```bash\n   export PYTHONPATH=$SPACK_ROOT/lib/spack/external/_vendoring:$SPACK_ROOT/lib/spack/external:$SPACK_ROOT/lib/spack:$PYTHONPATH\n   ```\n\n3. Install py2spack\n   1. Directly from GitHub:\n   ```bash\n   pip install git+https://github.com/davhofer/py2spack\n   ```\n   2. Or clone and install manually:\n   ```bash\n   git clone git@github.com:davhofer/py2spack.git\n   cd py2spack\n   pip install .\n   ```\n\n## Usage\n\n```\nusage: py2spack [-h] [--max-conversions MAX_CONVERSIONS] [--versions-per-package VERSIONS_PER_PACKAGE] [--repo REPO] [--allow-duplicate] package [--ignore [IGNORE ...]]\n\nCLI for converting a python package and its dependencies to Spack.\n\npositional arguments:\n  package               Name of the package to be converted\n\noptions:\n  -h, --help            show this help message and exit\n  --max-conversions MAX_CONVERSIONS\n                        Maximum number of packages that are converted\n  --versions-per-package VERSIONS_PER_PACKAGE\n                        Versions per package to be downloaded and converted\n  --repo REPO           Name of or full path to local Spack repository where packages should be saved\n  --ignore [IGNORE ...]\n                        List of packages to ignore. Must be specified last (after \u003cpackage\u003e argument) for the command to work\n  --allow-duplicate     Convert the package, even if a package of the same name already exists in some Spack repo. Will NOT overwrite the existing package. Only applies to the main package to be converted, not to dependencies.\n```\n\n### Conversion from PyPI\n\n```bash\npy2spack package-name\n```\n\n### Conversion from GitHub\n\n```bash\npy2spack https://github.com/user/package-name\n```\n\nor\n\n```bash\npy2spack user/package-name\n```\n\n\u003e NOTE: dependencies will always be resolved through PyPI, even when converting a package from GitHub\n\n## Documentation\n\nTo check out the detailed documentation (API docs, usage, implementation, package conversion, etc.), you need to clone the repository and build the docs:\n\n```bash\npip install .[docs]\ncd docs; make html\n```\n\nYou can then browse it locally, e.g.\n\n```bash\nfirefox _build/html/index.html\n```\n\n## Testing\n\nAfter installing the package with the `tests` option, the tests can be run from the project root directory as follows:\n\n```bash\npython -m pytest\n```\n\nInstallation tests for converted packages are run through GitHub Actions in a Docker container, see `.github/workflows/run-installation-tests.yaml`.\n\n## Author\n\nCreated by David Hofer ([davhofer](https://github.com/davhofer), `davhofer [at] ethz [dot] ch`) during an internship at [CSCS](https://www.cscs.ch/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feth-cscs%2Fpy2spack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feth-cscs%2Fpy2spack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feth-cscs%2Fpy2spack/lists"}