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

👷♻️ Use hatch as build backend #204

Merged
merged 6 commits into from
Sep 9, 2023
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
Binary file not shown.
2 changes: 2 additions & 0 deletions .github/workflows/autoupdate-pre-commit-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"

- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-autoupdate

- name: Update pre-commit config packages
uses: technote-space/create-pr-action@v2
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,24 @@ jobs:
example_name: ${{fromJson(needs.create-example-list.outputs.example-list)}}
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install pyglotaran-extras
run: |
pip install wheel
pip install .

- name: ${{ matrix.example_name }}
id: example-run
uses: glotaran/pyglotaran-examples@main
with:
example_name: ${{ matrix.example_name }}
install_extras: false

- name: Upload Example Plots Artifact
uses: actions/upload-artifact@v3
with:
Expand Down
58 changes: 36 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ jobs:
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Run pre-commit
uses: pre-commit/[email protected]

Expand All @@ -30,24 +32,27 @@ jobs:
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
conda-channels: conda-forge
activate-conda: false

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
conda install -y pandoc
python -m pip install -U pip wheel
pip install .
python -m pip install -U -r docs/requirements.txt
python -m pip install ".[docs]"

- name: Show installed dependencies
run: |
pip freeze
run: pip freeze

- name: Build docs
run: make --directory=docs clean html

Expand All @@ -57,24 +62,27 @@ jobs:
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
conda-channels: conda-forge
activate-conda: false

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
conda install -y pandoc
python -m pip install -U pip wheel
pip install .
python -m pip install -U -r docs/requirements.txt
python -m pip install ".[docs]"

- name: Show installed dependencies
run: |
pip freeze
run: pip freeze

- name: Build docs
run: make --directory=docs clean linkcheck

Expand All @@ -90,18 +98,21 @@ jobs:
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install -U pip wheel
python -m pip install -U -e .
python -m pip install -r requirements_dev.txt
python -m pip install -r requirements_pinned.txt
python -m pip install -U -e ".[test]"

- name: Run tests
run: |
py.test --nbval --cov=./ --cov-report term --cov-report xml --cov-config pyproject.toml tests
run: python -m pytest --nbval --cov=./ --cov-report term --cov-report xml --cov-config pyproject.toml tests

- name: Codecov Upload
continue-on-error: true
uses: codecov/codecov-action@v3
Expand All @@ -117,22 +128,24 @@ jobs:
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install -U pip wheel
python -m pip install -U -e .
python -m pip install -r requirements_dev.txt
python -m pip install -r requirements_pinned.txt
python -m pip install -U -e ".[test]"
python -m pip install git+https://github.com/glotaran/pyglotaran

- name: Show installed dependencies
run: |
pip freeze
run: pip freeze

- name: Run tests
run: |
py.test --nbval --cov=./ --cov-report term --cov-report xml --cov-config pyproject.toml tests
run: python -m pytest --nbval --cov=./ --cov-report term --cov-report xml --cov-config pyproject.toml tests

deploy:
name: Deploy to PyPi
Expand All @@ -141,16 +154,17 @@ jobs:
needs: test
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install -U pip wheel
run: python -m pip install -U hatch

- name: Build dist
run: |
python setup.py sdist bdist_wheel
run: hatch build

- name: Publish package
uses: pypa/[email protected]
Expand Down
8 changes: 2 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ repos:
- id: isort
minimum_pre_commit_version: 2.9.0

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.4.0
hooks:
- id: setup-cfg-fmt

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3 # Use the sha or tag you want to point at
hooks:
Expand Down Expand Up @@ -112,7 +107,7 @@ repos:
- "--allow-init-docstring=True"
- "--skip-checking-short-docstrings=False"
name: "flake8 lint docstrings"
exclude: "^(docs/|setup.py$|tests?/)"
exclude: "^(docs/|tests?/)"
additional_dependencies: [pydoclint==0.1.4]

- repo: https://github.com/rstcheck/rstcheck
Expand All @@ -121,6 +116,7 @@ repos:
- id: rstcheck
additional_dependencies: [sphinx]
exclude: "^docs/_templates"
args: [--ignore-directives=autosummary]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand Down
3 changes: 3 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[formatting]
align_comments = false
array_auto_collapse = false
122 changes: 122 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
```{highlight} shell

```

# Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.

You can contribute in many ways:

## Types of Contributions

### Report Bugs

Report bugs at <https://github.com/glotaran/pyglotaran-extras/issues>.

If you are reporting a bug, please include:

- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.

### Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
wanted" is open to whoever wants to implement it.

### Implement Features

Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.

### Write Documentation

pyglotaran_extras could always use more documentation, whether as part of the
official pyglotaran_extras docs, in docstrings, or even on the web in blog posts,
articles, and such.

### Submit Feedback

The best way to send feedback is to file an issue at <https://github.com/glotaran/pyglotaran-extras/issues>.

If you are proposing a feature:

- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions
are welcome :)

## Get Started!

Ready to contribute? Here's how to set up `pyglotaran_extras` for local development.

1. Fork the `pyglotaran-extras` repo on GitHub.

2. Clone your fork locally:

```
$ git clone [email protected]:your_name_here/pyglotaran_extras.git
```

3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:

```
$ mkvirtualenv pyglotaran_extras
$ cd pyglotaran-extras/
$ pip install -e .
```

4. install the `pre-commit` and `pre-push` hooks:

```
$ pre-commit install && pre-commit install -t pre-push
```

5. Create a branch for local development:

```
$ git checkout -b name-of-your-bugfix-or-feature
```

Now you can make your changes locally.

6. When you're done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox:

```
$ tox
```

To get flake8 and tox, just pip install them into your virtualenv.

7. Commit your changes and push your branch to GitHub:

```
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
```

8. Submit a pull request through the GitHub website.

## Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.md.
3. The pull request should work for Python 3.10 and 3.11. Check
<https://github.com/glotaran/pyglotaran-extras/actions>
and make sure that the tests pass for all supported Python versions.

## Tips

To run a subset of tests:

```
$ pytest tests.test_pyglotaran_extras
```
Loading