Skip to content

Commit 4415944

Browse files
authored
docs: update installation instructions to use pixi package manager (#119)
* docs: update installation instructions to use pixi package manager * docs: update build and upload instructions in CONTRIBUTING.md * black formatting * Update readme
1 parent 09b269c commit 4415944

File tree

4 files changed

+54
-17
lines changed

4 files changed

+54
-17
lines changed

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ $ rm -fr build
184184
> 4. Make PR on GitHub, and check docs compile correctly on Github Actions
185185
> 5. Create a tag with the version number and push it.
186186
> 6. Crate PYPI pckage
187-
> : 1. Run `python -m build . --sdist`
188-
> 2. Run `twine upload dist/*`
187+
> : 1. Run `pixi run build`
188+
> 2. Run `pixi run pipy-upload`
189189
> 7. Update the conda forge package on <https://github.com/conda-forge/anypytools-feedstock>
190190
191191
## Document History

README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,19 @@ If you use the library for publications please **cite as:**
2121
2222
## Installation
2323

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

2727
```bash
28-
conda config --add channels conda-forge
29-
conda install anypytools
28+
pixi init
29+
pixi add anypytools
30+
pixi install
3031
```
3132

33+
This will install a virtual environment with python, anypytools and all
34+
dependencies. You can then run you scripts in the virtual environment by typing
35+
by prefixing the command with `pixi run`: e.g. `pixi run python myscript.py`
36+
3237
The library is also available on [PyPi](https://pypi.python.org/pypi/AnyPyTools) for installing using `pip`.
3338

3439

anypytools/tools.py

+1
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ def silentremove(filename):
964964
except PermissionError as e:
965965
logging.debug(f"Error removing file: {filename}. Permission denied.")
966966

967+
967968
def make_hash(o):
968969
"""Make a hash from a dictionary, list, tuple or set.
969970

docs/Tutorial/00_Install_and_setup.ipynb

+42-11
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,61 @@
1212
"#### Requirements:\n",
1313
"\n",
1414
"* The [AnyBody Modeling System](http://www.anybodytech.com)\n",
15-
"* A Scientific Python distribution\n",
15+
"* Python\n",
1616
"\n",
1717
"\n",
1818
"#### Easy Installation: \n",
1919
"\n",
20-
"- Download and install the a [conda Python distribution](https://www.continuum.io/downloads)\n",
20+
"The best way to get started is using the pixi package manager. It will automatically install python and all needed depencies for you. \n",
2121
"\n",
22-
"- After installation, open the Anaconda command prompt and type:\n",
22+
"Install the [pixi](https://pixi.sh/) package manager for Python.\n",
2323
"\n",
2424
"> ```bash\n",
25-
"> conda config --add channels conda-forge\n",
26-
"> conda install anypytools\n",
25+
"> powershell -ExecutionPolicy ByPass -c \"irm -useb https://pixi.sh/install.ps1 | ie\n",
2726
"> ```\n",
28-
" \n",
29-
"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",
3027
"\n",
31-
"To update the package in case of newer versions run\n",
28+
"After installation, open your working directory in the terminal and run the following command:\n",
3229
"\n",
33-
">```bash\n",
34-
"> conda update anypytools\n",
30+
"> ```bash\n",
31+
"> pixi init\n",
32+
"> pixi add anypytools\n",
33+
"> pixi install\n",
3534
"> ```\n",
35+
" \n",
36+
"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",
37+
"\n",
38+
"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",
39+
"\n",
40+
"e.g.: \n",
41+
"```bash \n",
42+
"pixi run python my_script.py\n",
43+
"```\n",
44+
"\n",
45+
"### Controling the version of AnyBody used by AnyPyTools\n",
46+
"\n",
47+
"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",
48+
"\n",
49+
"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",
3650
"\n",
37-
"<img src=\"Tutorial_files/relax.png\" alt=\"\" align=\"left\" style=\"height: 150px;\"/>"
51+
"To do this we first need to add the `anybody` channel to our project. \n",
52+
"\n",
53+
"```bash\n",
54+
"pixi project channel add anybody` \n",
55+
"```\n",
56+
"\n",
57+
"Then we can install a specific version of AnyBody console application. \n",
58+
"\n",
59+
"```bash\n",
60+
"pixi add anybodycon=8.0.4\n",
61+
"```\n",
62+
"\n",
63+
"Now all simulations in this project will use the specified version of AnyBody, regardsless of what is installed on the host system."
3864
]
65+
},
66+
{
67+
"cell_type": "markdown",
68+
"metadata": {},
69+
"source": []
3970
}
4071
],
4172
"metadata": {

0 commit comments

Comments
 (0)