Skip to content

Commit

Permalink
Merge pull request #36 from Arcadia-Science/feat/major-revamp
Browse files Browse the repository at this point in the history
[Feature] Reorganize and reimplement the package
  • Loading branch information
keithchev authored Jul 2, 2024
2 parents b9f91ee + ef740c7 commit 4689e60
Show file tree
Hide file tree
Showing 177 changed files with 9,113 additions and 4,506 deletions.
5 changes: 5 additions & 0 deletions .env.copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# API token for the PyPI prod server.
POETRY_PYPI_TOKEN_PYPI=

# API token for the PyPI test server.
POETRY_PYPI_TOKEN_PYPI_TEST=
54 changes: 54 additions & 0 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: lint-and-test

on:
push:
branches:
- main
- feat/*
pull_request:
branches:
- main
- feat/*

jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Cache Poetry install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-1.8.3-0

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: true

- name: Cache Poetry dependencies
id: cache-poetry-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

- run: poetry install --no-interaction --no-root
if: steps.cache-poetry-deps.outputs.cache-hit != 'true'

- name: Run Ruff
run: poetry run ruff check --output-format=github .

- name: Run Ruff formatter
run: poetry run ruff format --check .

- name: Run tests
run: poetry run pytest
31 changes: 0 additions & 31 deletions .github/workflows/lint.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
docs/output/
/test-outputs/

# packages installed in editable mode
envs/src/**

Expand All @@ -18,6 +21,7 @@ __pycache__/
*.so

# Distribution / packaging
.env
.Python
env/
build/
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
- id: requirements-txt-fixer

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.4.4
hooks:
- id: ruff
args: [--fix]
Expand Down
44 changes: 43 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,54 @@
include .env

DOCS_DIR := ./docs
JUPYTER_NOTEBOOKS := $(shell find $(DOCS_DIR) -type f -name '*.ipynb')

.PHONY: execute-all-notebooks
execute-all-notebooks:
@for file in $(JUPYTER_NOTEBOOKS); do \
echo "Executing notebook $$file"; \
jupyter execute --inplace $$file; \
done

.PHONY: lint
lint:
ruff check --exit-zero .
ruff format --check .
pyright --project pyproject.toml .

.PHONY: format
format:
ruff --fix .
ruff check --fix .
ruff format .

.PHONY: pre-commit
pre-commit:
pre-commit run --all-files

.PHONY: test
test:
pytest -v .

.PHONY: clean
clean:
rm -rf dist

.PHONY: build
build: clean
poetry build

# Note: `poetry` does not appear to read the `POETRY_PYPI_TOKEN_<NAME>` environment variable,
# so we need to pass it explicitly in the `publish` command.
.PHONY: test-publish
test-publish: build
poetry publish \
--repository pypi_test \
--username __token__ \
--password ${POETRY_PYPI_TOKEN_PYPI_TEST}

.PHONY: publish
publish: build
poetry publish \
--repository pypi \
--username __token__ \
--password ${POETRY_PYPI_TOKEN_PYPI}
1,830 changes: 0 additions & 1,830 deletions README.ipynb

This file was deleted.

Loading

0 comments on commit 4689e60

Please sign in to comment.