Skip to content

Commit d1968ab

Browse files
authored
Initial pixi attempt (#14)
Moving docs and testing to pixi. Updated UPSTAGE documentation to match.
1 parent c069a4f commit d1968ab

File tree

11 files changed

+7595
-182
lines changed

11 files changed

+7595
-182
lines changed

Diff for: .github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: monthly # or daily, weekly
7+
groups:
8+
dependencies:
9+
patterns:
10+
- '*'

Diff for: .github/workflows/documentation.yml

+5-9
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- uses: actions/setup-python@v5
13+
- uses: prefix-dev/setup-[email protected]
1414
with:
15-
python-version: '3.11'
16-
cache: 'pip'
17-
- name: Install dependencies
18-
run: pip install .[docs]
19-
- name: Build autodocs
20-
run: sphinx-apidoc -o ./docs/source/auto ./src/upstage_des ./src/upstage_des/test
21-
- name: Sphinx build
22-
run: sphinx-build -b html docs/source _build
15+
manifest-path: pixi.toml
16+
pixi-version: v0.39.0
17+
cache: true
18+
- run: pixi run -e py312 build_html_docs
2319
- name: Deploy to GitHub Pages
2420
uses: peaceiris/actions-gh-pages@v4
2521
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

Diff for: .github/workflows/lint.yml

+37-21
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
11
name: Lint
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [main, dev]
6+
pull_request:
7+
branches: ['*']
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.head_ref || github.ref_name }}
12+
cancel-in-progress: true
413

514
jobs:
6-
build:
15+
check:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
environment: [py312]
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: prefix-dev/[email protected]
23+
with:
24+
environments: ${{ matrix.environment }}
25+
manifest-path: pixi.toml
26+
pixi-version: v0.39.0
27+
cache: true
28+
- run: pixi run -e ${{ matrix.environment }} lint-check
29+
30+
test:
731
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
environment: [py311, py312, py313]
835
steps:
9-
- uses: actions/checkout@v4
10-
- name: Set up Python
11-
uses: actions/setup-python@v5
12-
with:
13-
python-version: "3.11"
14-
- name: Install dependencies
15-
run: |
16-
python -m pip install --upgrade pip
17-
pip install .[lint]
18-
- name: Verify pyproject format ran
19-
run: pyproject-fmt --check pyproject.toml
20-
- name: Verify ssort ran
21-
run: ssort --check src
22-
- name: Verify Ruff Formatter ran
23-
run: ruff format --check src
24-
- name: Run Ruff linter
25-
run: ruff check --output-format=github src
26-
- name: Run mypy
27-
run: mypy --show-error-codes -p upstage_des
36+
- uses: actions/checkout@v4
37+
- uses: prefix-dev/[email protected]
38+
with:
39+
environments: ${{ matrix.environment }}
40+
manifest-path: pixi.toml
41+
pixi-version: v0.39.0
42+
cache: true
43+
- run: pixi run -e ${{ matrix.environment }} test

Diff for: .github/workflows/python-app.yml

-32
This file was deleted.

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,13 @@ celerybeat-schedule
102102
# mypy
103103
.mypy_cache/
104104

105-
# doit
105+
# automation things
106106
.doit*
107107
.env
108108
.report.json
109109
.venv
110110
.scripts
111+
.pixi
111112

112113
# VSCode
113114
.vscode

Diff for: CONTRIBUTING.md

+21-69
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,36 @@
22

33
All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.
44

5-
## Bug Reports and Enhancement Requests
5+
## How do I report an issue?
66

7-
Bug reports and enhancement requests are an important part of making UPSTAGE more stable and are curated though [Github issues](https://github.com/gtri/upstage/issues). If you wish to contribute, then please be sure there is an active issue to work against and there is not then go ahead and create one.
7+
Using the [Github issues](https://github.com/gtri/upstage/issues) feature, please explain in as much detail as possible:
88

9-
## Create a Fork
9+
1. The Python version and environment
10+
2. How UPSTAGE was installed
11+
3. A minimum working example of the bug, along with any output/errors.
1012

11-
You will need your own copy of UPSTAGE (aka fork) to work on the code. Go to the [UPSTAGE project page](https://github.com/gtri/upstage) and hit the `Fork` button.
12-
13-
## Making Code Changes
14-
15-
If you wish to contribute to UPSTAGE, we ask that you follow these steps to ensure code quality.
16-
17-
### Development Environment Setup
18-
19-
First, create a Python 3.11 or 3.12 environment through your preferred means (conda, mamba, venv, e.g.).
20-
21-
```bash
22-
python -m venv /path/to/upstage_dev/.venv
23-
```
13+
Bug reports and enhancement requests are an important part of making UPSTAGE more stable. If you wish to contribute, then please be sure
14+
there is an active issue to work against. If there is not one please create one.
2415

25-
Ensure that the pip version is >= `21.3` to allow editable installations with just `pyproject.toml`
26-
and the `flit` backend.
16+
## How do I put in a good PR?
2717

28-
```bash
29-
python -m pip install --upgrade pip
30-
```
18+
### Create a Fork
3119

32-
Next, clone the repo locally:
20+
You will need your own copy of UPSTAGE (aka fork) to work on the code. Go to the [UPSTAGE project page](https://github.com/gtri/upstage) and hit the `Fork` button.
3321

34-
```bash
35-
cd /path/to/upstage_des
36-
git clone https://github.com/gtri/upstage.git
37-
cd upstage
38-
```
22+
### Set Up the Development Environment
3923

40-
Install UPSTAGE to your environment with
24+
1. Get [`pixi`](https://pixi.sh).
25+
2. Use `pixi run -e dev start`
4126

42-
```bash
43-
pip install -e '.[docs,lint,test]'
44-
```
27+
That will give you an editable install in to the `dev` local environment managed by `pixi`. It also runs the lint,
28+
tests, and builds the docs. Any errors from that command should be reported as issues.
4529

46-
### Style Guide
30+
### Code Quality and Testing
4731

48-
For style, see [STYLE_GUIDE](STYLE_GUIDE.md).
49-
50-
### Code Quality
32+
1. Use `pixi r -e dev lint-fix`, and `pixi r -e dev lint-check` to run style/formatting/typing checks.
33+
2. Use `pixi r -e dev test` to run the tests
34+
3. If you modify the docs, use `pixi r -e dev build_html_docs` to ensure they build.
5135

5236
Code quality is enforced using the following tools:
5337

@@ -56,41 +40,9 @@ Code quality is enforced using the following tools:
5640
3. [`ruff`](https://docs.astral.sh/ruff/) - linter and code formatter
5741
4. [`mypy`](https://mypy-lang.org/) - static type checker
5842

59-
These tools are run as follows, allowing for auto-fixing:
60-
61-
```bash
62-
# 3 formatters, linting, then type checking
63-
pyproject-fmt pyproject.toml
64-
ssort src
65-
ruff format src
66-
ruff check --fix src
67-
mypy --show-error-codes -p upstage_des
68-
```
69-
70-
### Testing
71-
72-
To run the unit tests in `src/upstage_des/test`, run:
73-
74-
```bash
75-
pytest
76-
```
77-
78-
from the top level of the repo.
79-
80-
Test reports will be in `./build/reports`
81-
82-
### Building the documentation
83-
84-
Documentation is built from autodocs first, then the source build.
85-
86-
From the top level of the repo:
87-
88-
```bash
89-
sphinx-apidoc -o ./docs/source/auto ./src/upstage_des ./src/upstage_des/test
90-
sphinx-build -a -E -b html ./docs/source ./build/docs
91-
```
43+
### Style Guide
9244

93-
Then the docs can be loaded from `./build/docs/index.html`
45+
For style, see [STYLE_GUIDE](STYLE_GUIDE.md).
9446

9547
## Making Pull Requests
9648

Diff for: README.md

+2-29
Original file line numberDiff line numberDiff line change
@@ -44,40 +44,13 @@ In an environment (Python 3.11+) of your choice:
4444
pip install upstage-des
4545
```
4646

47-
### Installation from source
48-
49-
Alternatively, you can download UPSTAGE and install it manually. Clone, or download the archive and extract it. From the extraction location (and within a suitable Python environment):
50-
51-
```console
52-
python -m pip install .
53-
```
54-
55-
(or just `pip install .`)
56-
57-
### Installation for tests
58-
59-
To run the tests: clone locally, install into a fresh environment, and run using:
60-
61-
```console
62-
pip install -e .[test]
63-
pytest
64-
```
65-
6647
## Documentation
6748

6849
See the [documentation][upstage-docs] for tutorials and additional details.
6950

70-
## How do I report an issue?
71-
72-
Using the issue feature, please explain in as much detail as possible:
73-
74-
1. The Python version and environment
75-
2. How UPSTAGE was installed
76-
3. A minimum working example of the bug, along with any output/errors.
77-
78-
## How do I contribute?
51+
## How do I contribute or set up a develpment environment?
7952

80-
To set up a suitable development environment, see [CONTRIBUTING][contributing].
53+
See [CONTRIBUTING][contributing].
8154

8255
For information on how to style your code, see the [Style Guide][style-guide].
8356

Diff for: docs/source/index.md

+2-20
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,6 @@ Alternatively, you can download UPSTAGE and install it manually. Clone, or downl
4747

4848
(or just `pip install .`)
4949

50-
### Installation for running tests
51-
52-
Note that the tests include the two full examples from the documentation.
53-
54-
```console
55-
(venv) $ pip install upstage-des[test]
56-
(venv) $ pytest
57-
```
58-
59-
### Installation for building docs
60-
61-
Unless you're adding to the codebase, you won't need to run the `sphinx-apidoc` command.
62-
63-
```console
64-
(venv) $ pip install upstage-des[docs]
65-
(venv) $ sphinx-apidoc -o .\docs\source\auto .\src\upstage_des\ .\src\upstage_des\test\
66-
(venv) $ sphinx-build -b html .\docs\source\ .\docs\build\
67-
```
68-
6950
## User Guide
7051

7152
```{toctree}
@@ -77,7 +58,8 @@ user_guide/index
7758

7859
## Contributing
7960

80-
To contribute to UPSTAGE, or to learn the steps for building documentation and running tests, see [CONTRIBUTING.MD](https://github.com/gtri/upstage/blob/main/CONTRIBUTING.md))
61+
To contribute to UPSTAGE, or to learn the steps for building documentation, running tests, and putting
62+
in PRs, see [CONTRIBUTING.MD](https://github.com/gtri/upstage/blob/main/CONTRIBUTING.md))
8163

8264
## License and Attribution
8365

0 commit comments

Comments
 (0)