Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update installation instructions to use pixi package manager #119

Merged
merged 4 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ $ rm -fr build
> 4. Make PR on GitHub, and check docs compile correctly on Github Actions
> 5. Create a tag with the version number and push it.
> 6. Crate PYPI pckage
> : 1. Run `python -m build . --sdist`
> 2. Run `twine upload dist/*`
> : 1. Run `pixi run build`
> 2. Run `pixi run pipy-upload`
> 7. Update the conda forge package on <https://github.com/conda-forge/anypytools-feedstock>

## Document History
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ If you use the library for publications please **cite as:**

## Installation

- Download and install the [Anaconda Python distribution]
- After installation opens the Anaconda command prompt and type:
- Download and install the [pixi](https://pixi.sh) package manager
- After installation open a command prompt in you project directory and type:

```bash
conda config --add channels conda-forge
conda install anypytools
pixi init
pixi add anypytools
pixi install
```

This will install a virtual environment with python, anypytools and all
dependencies. You can then run you scripts in the virtual environment by typing
by prefixing the command with `pixi run`: e.g. `pixi run python myscript.py`

The library is also available on [PyPi](https://pypi.python.org/pypi/AnyPyTools) for installing using `pip`.


Expand Down
1 change: 1 addition & 0 deletions anypytools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,7 @@ def silentremove(filename):
except PermissionError as e:
logging.debug(f"Error removing file: {filename}. Permission denied.")


def make_hash(o):
"""Make a hash from a dictionary, list, tuple or set.

Expand Down
53 changes: 42 additions & 11 deletions docs/Tutorial/00_Install_and_setup.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,61 @@
"#### Requirements:\n",
"\n",
"* The [AnyBody Modeling System](http://www.anybodytech.com)\n",
"* A Scientific Python distribution\n",
"* Python\n",
"\n",
"\n",
"#### Easy Installation: \n",
"\n",
"- Download and install the a [conda Python distribution](https://www.continuum.io/downloads)\n",
"The best way to get started is using the pixi package manager. It will automatically install python and all needed depencies for you. \n",
"\n",
"- After installation, open the Anaconda command prompt and type:\n",
"Install the [pixi](https://pixi.sh/) package manager for Python.\n",
"\n",
"> ```bash\n",
"> conda config --add channels conda-forge\n",
"> conda install anypytools\n",
"> powershell -ExecutionPolicy ByPass -c \"irm -useb https://pixi.sh/install.ps1 | ie\n",
"> ```\n",
" \n",
"This will install the newest version of AnyPyTools. Note: If Anaconda is 'Installed for all users' it may be necessary to run the command with admin rights. \n",
"\n",
"To update the package in case of newer versions run\n",
"After installation, open your working directory in the terminal and run the following command:\n",
"\n",
">```bash\n",
"> conda update anypytools\n",
"> ```bash\n",
"> pixi init\n",
"> pixi add anypytools\n",
"> pixi install\n",
"> ```\n",
" \n",
"This will create a virtual python environment in that folder and install the AnyPyTools package. Likwise, you can add other depedencies to the virtual environment (e.g. `pixi add jupyter pandas`). All dependencies are tracked in the `pixi.yaml` file which can also be edited manually. \n",
"\n",
"You can now activate the virtual environment with `pixi shell` and run your scripts. Otherwise, you can prefix your commands with `pixi run` to run them in the virtual environment. \n",
"\n",
"e.g.: \n",
"```bash \n",
"pixi run python my_script.py\n",
"```\n",
"\n",
"### Controling the version of AnyBody used by AnyPyTools\n",
"\n",
"The clever part of using a package manger like pixi is that you can also control which version of the AnyBody console application is used by AnyPyTools.\n",
"\n",
"A light weight headless version of AnyBody exists as [conda-packages](https://anaconda.org/anybody/anybodycon). Hence, we can install a specific version of AnyBody into our virtual environment. \n",
"\n",
"<img src=\"Tutorial_files/relax.png\" alt=\"\" align=\"left\" style=\"height: 150px;\"/>"
"To do this we first need to add the `anybody` channel to our project. \n",
"\n",
"```bash\n",
"pixi project channel add anybody` \n",
"```\n",
"\n",
"Then we can install a specific version of AnyBody console application. \n",
"\n",
"```bash\n",
"pixi add anybodycon=8.0.4\n",
"```\n",
"\n",
"Now all simulations in this project will use the specified version of AnyBody, regardsless of what is installed on the host system."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
Expand Down