Skip to content

Commit

Permalink
Revert "Initial pixi attempt"
Browse files Browse the repository at this point in the history
This reverts commit 261bfe1.
  • Loading branch information
JamesArruda committed Dec 17, 2024
1 parent 261bfe1 commit c069a4f
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 7,570 deletions.
47 changes: 20 additions & 27 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,25 @@ name: Lint
on: [push, pull_request]

jobs:
lint:
build:
runs-on: ubuntu-latest
strategy:
matrix:
environment: [py312]
steps:
- uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: ${{ matrix.environment }}
pixi-version: v0.39.0
cache: true
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
- run: pixi run lint-check

test:
runs-on: ubuntu-latest
strategy:
matrix:
environment: [py311, py312, py313]
steps:
- uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: ${{ matrix.environment }}
pixi-version: v0.39.0
cache: true
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
- run: pixi run test
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[lint]
- name: Verify pyproject format ran
run: pyproject-fmt --check pyproject.toml
- name: Verify ssort ran
run: ssort --check src
- name: Verify Ruff Formatter ran
run: ruff format --check src
- name: Run Ruff linter
run: ruff check --output-format=github src
- name: Run mypy
run: mypy --show-error-codes -p upstage_des
32 changes: 32 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will install Python dependencies, run tests

name: Test

# on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
on: [push, pull_request]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
- name: Test with pytest
run: pytest
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,12 @@ celerybeat-schedule
# mypy
.mypy_cache/

# automation things
# doit
.doit*
.env
.report.json
.venv
.scripts
.pixi

# VSCode
.vscode
Expand Down
90 changes: 69 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,52 @@

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

## How do I report an issue?
## Bug Reports and Enhancement Requests

Using the [Github issues](https://github.com/gtri/upstage/issues) feature, please explain in as much detail as possible:
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.

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

Bug reports and enhancement requests are an important part of making UPSTAGE more stable. If you wish to contribute, then please be sure
there is an active issue to work against. If there is not one please create one.
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.

## How do I put in a good PR?
## Making Code Changes

### Create a Fork
If you wish to contribute to UPSTAGE, we ask that you follow these steps to ensure code quality.

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.
### Development Environment Setup

First, create a Python 3.11 or 3.12 environment through your preferred means (conda, mamba, venv, e.g.).

### Set Up the Development Environment
```bash
python -m venv /path/to/upstage_dev/.venv
```

1. Get [`pixi`](https://pixi.sh).
2. Use `pixi run -e dev start`
Ensure that the pip version is >= `21.3` to allow editable installations with just `pyproject.toml`
and the `flit` backend.

That will give you an editable install in to the `dev` local environment managed by `pixi`. It also runs the lint,
tests, and builds the docs. Any errors from that command should be reported as issues.
```bash
python -m pip install --upgrade pip
```

### Code Quality and Testing
Next, clone the repo locally:

1. Use `pixi r -e dev lint-fix`, and `pixi r -e dev lint-check` to run style/formatting/typing checks.
2. Use `pixi r -e dev test` to run the tests
3. If you modify the docs, use `pixi r -e dev build_html_docs` to ensure they build.
```bash
cd /path/to/upstage_des
git clone https://github.com/gtri/upstage.git
cd upstage
```

Install UPSTAGE to your environment with

```bash
pip install -e '.[docs,lint,test]'
```

### Style Guide

For style, see [STYLE_GUIDE](STYLE_GUIDE.md).

### Code Quality

Code quality is enforced using the following tools:

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

### Style Guide
These tools are run as follows, allowing for auto-fixing:

For style, see [STYLE_GUIDE](STYLE_GUIDE.md).
```bash
# 3 formatters, linting, then type checking
pyproject-fmt pyproject.toml
ssort src
ruff format src
ruff check --fix src
mypy --show-error-codes -p upstage_des
```

### Testing

To run the unit tests in `src/upstage_des/test`, run:

```bash
pytest
```

from the top level of the repo.

Test reports will be in `./build/reports`

### Building the documentation

Documentation is built from autodocs first, then the source build.

From the top level of the repo:

```bash
sphinx-apidoc -o ./docs/source/auto ./src/upstage_des ./src/upstage_des/test
sphinx-build -a -E -b html ./docs/source ./build/docs
```

Then the docs can be loaded from `./build/docs/index.html`

## Making Pull Requests

Expand Down
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,40 @@ In an environment (Python 3.11+) of your choice:
pip install upstage-des
```

### Installation from source

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):

```console
python -m pip install .
```

(or just `pip install .`)

### Installation for tests

To run the tests: clone locally, install into a fresh environment, and run using:

```console
pip install -e .[test]
pytest
```

## Documentation

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

## How do I contribute or set up a develpment environment?
## How do I report an issue?

Using the issue feature, please explain in as much detail as possible:

1. The Python version and environment
2. How UPSTAGE was installed
3. A minimum working example of the bug, along with any output/errors.

## How do I contribute?

See [CONTRIBUTING][contributing].
To set up a suitable development environment, see [CONTRIBUTING][contributing].

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

Expand Down
22 changes: 20 additions & 2 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,25 @@ Alternatively, you can download UPSTAGE and install it manually. Clone, or downl

(or just `pip install .`)

### Installation for running tests

Note that the tests include the two full examples from the documentation.

```console
(venv) $ pip install upstage-des[test]
(venv) $ pytest
```

### Installation for building docs

Unless you're adding to the codebase, you won't need to run the `sphinx-apidoc` command.

```console
(venv) $ pip install upstage-des[docs]
(venv) $ sphinx-apidoc -o .\docs\source\auto .\src\upstage_des\ .\src\upstage_des\test\
(venv) $ sphinx-build -b html .\docs\source\ .\docs\build\
```

## User Guide

```{toctree}
Expand All @@ -58,8 +77,7 @@ user_guide/index

## Contributing

To contribute to UPSTAGE, or to learn the steps for building documentation, running tests, and putting
in PRs, see [CONTRIBUTING.MD](https://github.com/gtri/upstage/blob/main/CONTRIBUTING.md))
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))

## License and Attribution

Expand Down
Loading

0 comments on commit c069a4f

Please sign in to comment.