Skip to content

Commit

Permalink
Merge pull request #1 from renan-r-santos/first-release
Browse files Browse the repository at this point in the history
First release
  • Loading branch information
renan-r-santos authored Apr 4, 2024
2 parents 8e40f13 + cf73f33 commit cd443b4
Show file tree
Hide file tree
Showing 25 changed files with 3,241 additions and 156 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: CI

on:
pull_request:
push:
branches:
- main

env:
python-version: "3.12"
poetry-version: "1.8.2"

jobs:
test:
strategy:
matrix:
pixi-version: ["0.18.0"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Pixi ${{ matrix.pixi-version }}
uses: prefix-dev/setup-pixi@v0.5.1
with:
pixi-version: v${{ matrix.pixi-version }}
run-install: false
- name: Install Poetry
run: pipx install poetry==${{ env.poetry-version }}
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install environment
run: poetry install
- name: Test with nox
run: poetry run nox -s test-${{ matrix.python-version }} integration-${{ matrix.python-version }}
- name: Store coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: .coverage.*
coverage:
needs: test
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry==${{ env.poetry-version }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
cache: poetry
- name: Install environment
run: poetry install
- name: Fetch coverage
uses: actions/download-artifact@v4
with:
pattern: coverage-*
merge-multiple: true
- name: Combine coverage and generate report
run: poetry run nox -s coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry==${{ env.poetry-version }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
cache: poetry
- name: Install environment
run: poetry install
- name: Run code quality checks
run: poetry run nox -s lint
poetry-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry==${{ env.poetry-version }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Validate Poetry configuration and lockfile freshness
run: poetry lock --check
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
push:
tags:
- "v*"

env:
python-version: "3.12"
poetry-version: "1.8.2"

jobs:
pypi-publish:
name: Publish release to PyPI
runs-on: ubuntu-22.04
environment: release
permissions:
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry==${{ env.poetry-version }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Build release
run: poetry run python -m build --wheel --outdir dist
- name: Check that tag version and Poetry version match
run: '[[ "v$(poetry version --short)" == "${{ github.ref_name }}" ]]'
- name: Upload distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
174 changes: 20 additions & 154 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,160 +1,26 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# Python
**/__pycache__

# C extensions
*.so
# Poetry, Pixi and Setuptools
/.venv
/build
/dist
*.egg-info
**/.pixi

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# nox
/.nox

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# ruff
/.ruff_cache

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# IDEs
/.vscode

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# coverage
/.coverage*
/htmlcov
/coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# System
.DS_Store
58 changes: 58 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Contributing

Pixi Kernel is free and open source software developed under an MIT license. Development occurs at
the [GitHub project](https://github.com/renan-r-santos/pixi-kernel). Contributions are welcome.

Bug reports and feature requests may be made directly on the
[issues](https://github.com/renan-r-santos/pixi-kernel/issues) tab.

To make a pull request, you will need to fork the repo, clone the repo, make the changes, run the
tests, push the changes, and [open a PR](https://github.com/renan-r-santos/pixi-kernel/pulls).

## Cloning the repo

To make a local copy of Pixi Kernel, clone the repository with git:

```shell
git clone https://github.com/renan-r-santos/pixi-kernel.git
```

## Installing from source

Pixi Kernel uses Poetry as its packaging and dependency manager. In whatever Python environment you
prefer, install Poetry and then use Poetry to install Pixi Kernel and its dependencies:

```shell
pip install poetry
poetry install
```

## Testing and code quality

Pixi Kernel uses pytest to run the tests in the `tests/` directory. To run them as well as the
linters and formatters, use `nox`:

```shell
poetry run nox
```

This will try to test with all compatible Python versions that `nox` can find and use Ruff to
ensure a minimum standard of code quality.

## Making a release

1. Bump
1. Increment version in `pyproject.toml`
2. Commit with message "Bump version number to X.Y.Z"
3. Push commit to GitHub
4. Check [CI](https://github.com/renan-r-santos/pixi-kernel/actions/workflows/ci.yml) to ensure
all tests pass
2. Tag
1. Tag commit with "vX.Y.Z"
2. Push tag to GitHub
3. Wait for [build](https://github.com/renan-r-santos/pixi-kernel/actions/workflows/release.yml)
to finish
4. Check [PyPI](https://pypi.org/project/pixi-kernel/) for good upload
3. Document
1. Create [GitHub release](https://github.com/renan-r-santos/pixi-kernel/releases) with name
"Pixi Kernel X.Y.Z" and major changes in body
Loading

0 comments on commit cd443b4

Please sign in to comment.