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

Initial pixi attempt #14

Merged
merged 9 commits into from
Dec 17, 2024
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
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly # or daily, weekly
groups:
dependencies:
patterns:
- '*'
14 changes: 5 additions & 9 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: prefix-dev/setup-pixi@v0.8.1
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: pip install .[docs]
- name: Build autodocs
run: sphinx-apidoc -o ./docs/source/auto ./src/upstage_des ./src/upstage_des/test
- name: Sphinx build
run: sphinx-build -b html docs/source _build
manifest-path: pixi.toml
pixi-version: v0.39.0
cache: true
- run: pixi run -e py312 build_html_docs
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
Expand Down
58 changes: 37 additions & 21 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
name: Lint

on: [push, pull_request]
on:
push:
branches: [main, dev]
pull_request:
branches: ['*']
workflow_dispatch:

concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
build:
check:
runs-on: ubuntu-latest
strategy:
matrix:
environment: [py312]
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: ${{ matrix.environment }}
manifest-path: pixi.toml
pixi-version: v0.39.0
cache: true
- run: pixi run -e ${{ matrix.environment }} lint-check

test:
runs-on: ubuntu-latest
strategy:
matrix:
environment: [py311, py312, py313]
steps:
- 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
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: ${{ matrix.environment }}
manifest-path: pixi.toml
pixi-version: v0.39.0
cache: true
- run: pixi run -e ${{ matrix.environment }} test
32 changes: 0 additions & 32 deletions .github/workflows/python-app.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ celerybeat-schedule
# mypy
.mypy_cache/

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

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

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

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

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

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

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.

## Making Code Changes

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

### Development Environment Setup

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

```bash
python -m venv /path/to/upstage_dev/.venv
```
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.

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

```bash
python -m pip install --upgrade pip
```
### Create a Fork

Next, clone the repo locally:
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.

```bash
cd /path/to/upstage_des
git clone https://github.com/gtri/upstage.git
cd upstage
```
### Set Up the Development Environment

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

```bash
pip install -e '.[docs,lint,test]'
```
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.

### Style Guide
### Code Quality and Testing

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

### Code Quality
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.

Code quality is enforced using the following tools:

Expand All @@ -56,41 +40,9 @@ 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

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

```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
```
### Style Guide

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

## Making Pull Requests

Expand Down
31 changes: 2 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,40 +44,13 @@ 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 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?
## How do I contribute or set up a develpment environment?

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

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

Expand Down
22 changes: 2 additions & 20 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,6 @@ 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 @@ -77,7 +58,8 @@ user_guide/index

## Contributing

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

## License and Attribution

Expand Down
Loading
Loading