Skip to content

Commit f44b0d5

Browse files
committedMar 19, 2025·
clean up docs
1 parent c63089c commit f44b0d5

File tree

3 files changed

+81
-115
lines changed

3 files changed

+81
-115
lines changed
 

‎docs/contributing.md

+28-56
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,60 @@
11
# How to Contribute
22

3-
We've tried to simplify development as much as possible to encourage contributions from anyone with experience in Python and/or R. Following the directions on this page to get going quickly. Check-out the [development page](./development.md) for more context and details
3+
We've tried to simplify development as much as possible to encourage contributions from anyone with experience in Python and/or R. Follow the directions on this page to get going quickly. Check-out the [development page](./development.md) for more context and details
44

55
## Quick start
66

7-
1. Install `pixi`
7+
### 1. Install `pixi`
88

99
```bash
1010
curl -fsSL https://pixi.sh/install.sh | bash
1111
```
1212

13-
2. Clone the repository and setup a development environment
13+
### 2. Clone the repository and setup a development environment
1414

1515
```bash
1616
git clone https://github.com/YOURFORK/pymer4.git
1717
cd pymer4
1818
pixi install
1919
```
2020

21-
3. Make code/documentation changes with tests and test them
21+
### 3. Make code/documentation changes with tests and test them
2222

2323
```bash
2424
pixi run tests
2525
```
2626

27-
4. Push your changes to Github and open a pull request!
27+
### 4. Push your changes to Github and open a pull request!
2828

29-
## Development Tools
30-
31-
- `pixi` for project and environment management
32-
- `pyproject.toml` for specifying, pip, conda, runtime, and development dependencies as well as Pixi tasks
33-
- `conda/meta.yaml` reads from `pyproject.toml` to specify conda build instructions
34-
- `mkdocs` for documentation
35-
- `pytest` for testing
36-
- `VSCode` for development
37-
38-
## Code Guidelines
39-
40-
- TODO - note `ruff`
41-
42-
Please use [google style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html/) for documenting all functions, methods, and classes.
43-
44-
Please be sure to include tests with any code submissions and verify
45-
they pass using [pytest](https://docs.pytest.org/en/latest/). To run all
46-
package tests you can use `pytest -s --capture=no` in the project root.
47-
To run specific tests you can point to a file or even a test function
48-
within a file, e.g.
49-
`pytest pymer4/test/test_models.py -k "test_gaussian_lm"`
50-
51-
## Versioning Guidelines
52-
53-
The current `pymer4` scheme is [PEP
54-
440](https://www.python.org/dev/peps/pep-0440/) compliant with two and
55-
only two forms of version strings: `M.N.P` and `M.N.P.devX`. Versions
56-
with the `.devX` designation denote development versions typically on
57-
the `master` branch or `conda` pre-release channel.
29+
### General Recommendations
5830

59-
This simplifed scheme is not illustrated in the PEP 440 examples, but if
60-
was it would be described as \"major.minor.micro\" with development
61-
releases. To illustrate, the version sequence would look like this:
31+
- Please use [google style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html/) for documenting all functions, methods, and classes.
32+
- Please make sure to follow proper PEP code-formatting. You can use `pixi run lint` to check or `pixi run lint-fix` to format your files
33+
- Please be sure to include tests with any code submissions and verify they pass using `pixi run tests`
6234

63-
> ``` bash
64-
> 0.7.0
65-
> 0.7.1.dev0
66-
> 0.7.1.dev1
67-
> 0.7.1
68-
> ```
69-
70-
The third digit(s) in the `pymer4` scheme, i.e. PEP 440 \"micro,\" are
71-
not strictly necessary but are useful for semantically versioned
72-
\"patch\" designations. The `.devX` extension on the other hand denotes
73-
a sequence of incremental work in progress like the alpha, beta,
74-
developmental, release candidate system without the alphabet soup.
75-
76-
## Documentation Guidelines
35+
## Updating Documentation
7736

7837
Documentation is written using [`mkdocs`](https://www.mkdocs.org/) with the following plugins:
38+
7939
- [`mkdocs-material`](https://squidfunk.github.io/mkdocs-material/getting-started/)
8040
- [`mkdocs-jupyter`](https://github.com/danielfrg/mkdocs-jupyter)
8141
- [`mkdocstrings-python`](https://mkdocstrings.github.io/python/)
8242

83-
### Adding new pages & tutorials
43+
New documentation can be created by:
44+
45+
- Adding new markdown files to `docs/` to create new pages
46+
- Adding new jupyter notebooks to `docs/tutorials/` to create new tutorials
47+
- Adding the filename(s) to the `nav` section of `mkdocs.yml`
48+
- Using `pixi run docs` to preview changes
49+
50+
## Development Tools
51+
52+
We utilize the following tools for development:
8453

85-
- Add new markdown files to `docs/` to create new pages
86-
- Add new jupyter notebooks to `docs/tutorials/` to create new tutorials
87-
- Add the filename(s) to the `nav` section of `mkdocs.yml`
88-
- Use `pixi run docs` to preview changes
54+
- `pixi` for project and environment management
55+
- `pyproject.toml` for specifying, pip, conda, runtime, and development dependencies as well as Pixi tasks
56+
- `conda/meta.yaml` reads from `pyproject.toml` to specify conda build instructions
57+
- `mkdocs` for documentation
58+
- `ruff` for linting and formatting
59+
- `pytest` for testing
60+
- `VSCode` for development

‎docs/development.md

+48-56
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,44 @@
11
# Development & Contributing
22

33
Since version `0.9.0` `pymer4` uses [Pixi](https://prefix.dev/blog/pixi_for_scientists) to simplify package management, development, and testing.
4-
Use the Development Quickstart below for the TL;DR on contributing to `pymer4`.
5-
Otherwise, checkout the rest of this page to read more about how `pymer4` is configure with Pixi
4+
This page provides more background details and context on how Pixi and the other packaging development tools work.
5+
[Check-out this page](./contributing.md) if you're just interested in the TL;DR on making a contribution.
66

7-
## Development Quickstart
7+
## Overview
8+
9+
`pymer4` uses a single [`pyproject.toml`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/) file to configure package setup and requirements instead of the traditional `setup.py` & `requirements.txt` approach. This file also contains additional instructions that specify `setuptools` as the build system as well as additional instructions for Pixi (see below) to manage environments, tasks, and additional development dependencies. While this is sufficient for building a traditional `pip`-installable Python package, `pymer4` also needs a properly configured and working R installation with particular libraries pre-installed. To accomplish this, `pymer4` is distributed as a `conda` package that's built from `conda/meta.yaml`. This file is created by reading meta-data and requirements from `pyproject.toml`.
10+
11+
Currently, `pymer4` uses `pyproject.toml` to specify:
12+
13+
- `pip` dependencies in `project.dependencies`
14+
- `conda-forge` dependencies in `tool.pixi.dependencies`
15+
- optional development only dependences (`conda-forge`) in `tool.pixi.featre.dev.dependencies`
16+
- the `default` environment and make sure it includes optional dependencies
17+
- various Pixi tasks in `tool.pixi.feature.dev.tasks`
18+
19+
!!! note "Note"
20+
*We hope to replace the last step above with `pixi build` when it [comes out of beta](https://pixi.sh/latest/build/getting_started/) and integrates with `rattler-build`, a replacement for `conda-build`*
21+
22+
## Pixi
23+
24+
[Pixi](https://prefix.dev/blog/pixi_for_scientists) is a modern, extremely fast project-management tool that excels at handling Python environments with mixed dependecies from `conda` and `pip`, while building upon Python standards. In other words using Pixi, **the `pyproject.tml` acts as a single source of truth for *all* of pymer4's dependencies**, including both Python and R packages.
25+
26+
Pixi manages projects in a style similar to popuar Javascript tools like `npm` rather than traditional Anaconda environments and is powered by extremely fast tooling like Rust, `uv` for `pip` packages, and `mamba` for `conda` packages. Using `pixi install`, Pixi creates 1 or more environments in a hidden `.pixi` folder that are *automatically* used for running a variety of [tasks](https://pixi.sh/latest/features/advanced_tasks/), short commands that can be executed with `pixi run taskName` similar to a `Makefile`. These environments are **completeley isolated** just like traditional `conda` environments, but you don't need to manage or switch to them; Pixi handles all that for you based on the configuration in `pyproject.toml`
27+
28+
### Tasks
29+
30+
Pixi also allows us to define handy commands (like a `Makefile`) that it calls *tasks*. You can see all the ones we've setup using `pixi task list` and run one with `pixi run *cmd*`. We've configured several to make it super easy to run tests, build documentation, and build the conda package itself. Running a task will automatically run it in environment for the project without you having to activate or deactivate anything. You can try them out for yourself as you're working with the code base.
31+
32+
### Traditional environment activation
33+
When you ran `pixi install` Pixi created an isolated environment with all the dependencies listed in `pyproject.toml`. You can activate this environment conda-style using `pix shell` after which commands like `jupyter-book` or `pytest` will become available in your terminal. This is similar to using `conda activate *my_environment*`
34+
35+
### Additional Guides & Resources
36+
- [Official Github Action Workflow](https://github.com/prefix-dev/setup-pixi/tree/v0.8.3/)
37+
- [Python Tutorial](https://pixi.sh/latest/tutorials/python/)
38+
- [Initial `pyproject.toml` setup](https://pixi.sh/latest/advanced/pyproject_toml/#python-dependency)
39+
- [`pyproject.toml` reference](https://pixi.sh/latest/reference/pixi_manifest/)
40+
41+
## Getting Started
842

943
Installing Pixi is very easy as it has no dependencies and doesn't affect any other Python versions or tools you may already use (e.g. Anaconda). Just copy the following command into your terminal:
1044

@@ -14,7 +48,9 @@ curl -fsSL https://pixi.sh/install.sh | bash
1448

1549
Then clone the repository and run `pixi install` which will configure and create an isolated development environment for you. Once you're setup you can use any of the Pixi tasks we've configured to run tests, build docs, etc or use the Pixi cheatsheet to add/remove dependencies:
1650

17-
### Helpful development commands (Pixi tasks)
51+
### Configured Tasks
52+
53+
The following tasks have already been configured in `pyproject.toml` and can be utilized with `pixi run taskName`
1854

1955
| Pixi Command | Description |
2056
|--------------|------------------|
@@ -31,7 +67,9 @@ Then clone the repository and run `pixi install` which will configure and create
3167
| `pixi run upload-pre` | Uploads built package to `pre-release` label; requires `$token` and `$file` environment variables to be set |
3268
| `pixi run main` | Uploads built package to `main` label; requires `$token` and `$file` environment variables to be set |
3369

34-
### Pixi Cheatsheet
70+
### Additional Commands
71+
72+
You can perform additional actions like adding/removing packages or activating the pixi environment with the following commands:
3573

3674
| Pixi Command | Conda/Pip Equivalent | Description |
3775
|--------------|------------------|-------------|
@@ -43,69 +81,23 @@ Then clone the repository and run `pixi install` which will configure and create
4381
| `pixi run task_name` | `conda run -n env_name command` | Runs a command in the project environment |
4482
| `pixi shell` | `conda activate env_name` | Activates the project environment |
4583

46-
## Overview
47-
48-
`pymer4` uses a single [`pyproject.toml`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/) file to configure package setup and requirements instead of the traditional `setup.py` & `requirements.txt` approach. This file also contains additional instructions that specify `setuptools` as the build system as well as additional instructions for Pixi (see below) to manage environments, tasks, and additional development dependencies. While this is sufficient for building a traditional `pip`-installable Python package, `pymer4` also needs a properly configured and working R installation with particular libraries pre-installed. To accomplish this, `pymer4` is distributed as a `conda` package that's built from `conda/meta.yaml`. This file is created by reading meta-data and requirements from `pyproject.toml`.
49-
50-
### Dependencies & Configuration
51-
52-
Currently, `pymer4` uses `pyproject.toml` to specify:
53-
- `pip` dependencies in `project.dependencies`
54-
- `conda-forge` dependencies in `tool.pixi.dependencies`
55-
- optional development only dependences (`conda-forge`) in `tool.pixi.featre.dev.dependencies`
56-
- the `default` environment and make sure it includes optional dependencies
57-
- various Pixi tasks in `tool.pixi.feature.dev.tasks`
58-
59-
```{note}
60-
*We hope to replace the last step above with `pixi build` when it [comes out of beta](https://pixi.sh/latest/build/getting_started/) and integrates with `rattler-build`, a replacement for `conda-build`*
61-
```
62-
63-
### Automatic Testing and Deployment
84+
## Automatic Testing and Deployment
6485

6586
Automated package testing and deployment are handled by a single `pixi.yml` Github Actions (GA) workflow that does the following:
87+
6688
- Setup up Pixi
6789
- Configure an environment and install runtime & development depenencies
6890
- Runs tests using `pixi run tests`
6991
- Build and deploys docs using `pixi run docs-build`
7092
- Build and deploys the package to the `pre-release` or `main` labels on the `ejolly` channel at Anaconda.org using `conda-build` and `anaconda-client`
7193

7294
A few other notes about automation & deployment
95+
7396
- Conda packages are exclusively `noarch` builds that should run be cross-compatible for macOS & Linux as long as the minimum required Python version is met (Windows not officially supported)
7497
- The configured GA workflow automatically runs on any commits/PRs against the `main` branch as well as on a weekly schedule every Sunday
7598
- Built packages are available on the `ejolly` channel on [Anaconda.org](https://anaconda.org/ejolly/pymer4) under one of the 2 following *labels*
7699
- `main`: built from official Github Release only
77100
- `pre-release`: built from every new commit to the `main` branch on github
78101

79-
```{note}
80-
*We hope to have `pymer4` available on the `conda-forge` channel instead of `ejolly` soon!*
81-
```
82-
83-
### Documenation
84-
85-
- [mkdocs](https://github.com/danielfrg/mkdocs-jupyter)
86-
87-
All documentation is built using [jupyter book](https://jupyterbook.org/en/stable/intro.html). This is handled automatically on Github Actions or you can use the Pixi tasks noted above to build the docs locally: `pixi run docs-build` and `pixi run docs-preview`
88-
89-
Aside from the `api.md` file which uses special directives to automatically extract function and method docstrings, new documentation can be easily added by create new markdown files or jupyter notebooks and adding them to `_toc.yml`
90-
91-
## Pixi
92-
93-
[Pixi](https://prefix.dev/blog/pixi_for_scientists) is a modern, extremely fast project-management tool that excels at handling Python environments with mixed dependecies from `conda` and `pip`, while building upon Python standards. In other words using Pixi, **the `pyproject.tml` acts as a single source of truth for *all* of pymer4's dependencies**, including both Python and R packages.
94-
95-
Pixi manages projects in a style similar to popuar Javascript tools like `npm` rather than traditional Anaconda environments and is powered by extremely fast tooling like Rust, `uv` for `pip` packages, and `mamba` for `conda` packages. Using `pixi install`, Pixi creates 1 or more environments in a hidden `.pixi` folder that are *automatically* used for running a variety of [tasks](https://pixi.sh/latest/features/advanced_tasks/), short commands that can be executed with `pixi run taskName` similar to a `Makefile`. These environments are **completeley isolated** just like traditional `conda` environments, but you don't need to manage or switch to them; Pixi handles all that for you based on the configuration in `pyproject.toml`
96-
97-
### Tasks
98-
99-
Pixi also allows us to define handy commands (like a `Makefile`) that it calls *tasks*. You can see all the ones we've setup using `pixi task list` and run one with `pixi run *cmd*`. We've configured several to make it super easy to run tests, build documentation, and build the conda package itself. Running a task will automatically run it in environment for the project without you having to activate or deactivate anything. You can try them out for yourself as you're working with the code base.
100-
101-
### Traditional environment activation
102-
When you ran `pixi install` Pixi created an isolated environment with all the dependencies listed in `pyproject.toml`. You can activate this environment conda-style using `pix shell` after which commands like `jupyter-book` or `pytest` will become available in your terminal. This is similar to using `conda activate *my_environment*`
103-
104-
### Pixi Resources
105-
- [Official Github Action Workflow](https://github.com/prefix-dev/setup-pixi/tree/v0.8.3/)
106-
- [Python Tutorial](https://pixi.sh/latest/tutorials/python/)
107-
- [Initial `pyproject.toml` setup](https://pixi.sh/latest/advanced/pyproject_toml/#python-dependency)
108-
- [`pyproject.toml` reference](https://pixi.sh/latest/reference/pixi_manifest/)
109-
110-
111-
102+
!!! note "Note"
103+
*We hope to have `pymer4` available on the `conda-forge` channel instead of `ejolly` soon!*

‎docs/installation.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Installation
22

3-
!!! warning "Note"
4-
3+
!!! warning "**Do NOT install** using `pip`"
54
Due to the cross-language nature of `pymer4`, installing via `pip` is **not supported**.
6-
You **must** install `pymer4` using `conda` or `pixi` as outlined below
5+
You **must** install `pymer4` using `conda` as outlined below
6+
7+
!!! Info "Windows Users"
8+
Unfortunately, Windows it **not officially support** as package installation can be unreliable. We recommend using the [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install) and setting up a conda install through there.
79

810
## Install using `conda` (recommended)
911

0 commit comments

Comments
 (0)
Please sign in to comment.