Skip to content

Commit

Permalink
Make library public
Browse files Browse the repository at this point in the history
  • Loading branch information
Floris Laporte committed Feb 2, 2022
2 parents 5d9953c + f56ad35 commit fac3a24
Show file tree
Hide file tree
Showing 82 changed files with 15,565 additions and 2,375 deletions.
15 changes: 15 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[bumpversion]
current_version = 0.6.0
commit = True
tag = True
tag_name = {new_version}

[bumpversion:file:setup.cfg]

[bumpversion:file:settings.ini]

[bumpversion:file:environment.yml]

[bumpversion:file:nbs/99_init.ipynb]

[bumpversion:file:sax/__init__.py]
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# IDE settings
.vscode/
.idea/

# nbdev
docs/
.jekyll-cache/
Gemfile.lock
*.bak
.gitattributes
.last_checked
.gitconfig
*.bak
*.log
*~
~*
_tmp*
tmp*
tags

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -128,3 +148,7 @@ dmypy.json

# Pyre type checker
.pyre/

# Pyright
node_modules
package-lock.json
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: local
hooks:
- id: nbdev_clean_nbs
name: nbdev_clean_nbs
entry: nbdev_clean_nbs
language: python
pass_filenames: false
additional_dependencies:
- nbdev
- repo: local
hooks:
- id: nbstripout
name: nbstripout
entry: nbstripout
language: python
pass_filenames: true
types: [jupyter]
- repo: local
hooks:
- id: nbdev_diff_nbs
name: nbdev_diff_nbs
entry: bash -c 'if [ ! -z "$(nbdev_diff_nbs)" ]; then nbdev_build_lib; fi'
language: python
pass_filenames: false
additional_dependencies:
- nbdev
52 changes: 52 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# How to contribute

## How to get started

Before anything else, please install the git hooks that run automatic scripts during
each commit and merge to strip the notebooks of superfluous metadata (and avoid merge
conflicts). After cloning the repository, run the following commands inside the sax
conda environment:

```
nbdev_install_git_hooks
pre-commit install
```

## Did you find a bug?

- Ensure the bug was not already reported by searching on GitHub under Issues.
- If you're unable to find an open issue addressing the problem, open a new one. Be sure
to include a title and clear description, as much relevant information as possible, and
a code sample or an executable test case demonstrating the expected behavior that is not
occurring.
- Be sure to add the complete error messages.

#### Did you write a patch that fixes a bug?

- Open a new GitHub pull request with the patch.
- Ensure that your PR includes a test that fails without your patch, and pass with it.
- Ensure the PR description clearly describes the problem and solution. Include the
relevant issue number if applicable.

## PR submission guidelines

- Keep each PR focused. While it's more convenient, do not combine several unrelated
fixes together. Create as many branches as needing to keep each PR focused.
- Do not mix style changes/fixes with "functional" changes. It's very difficult to
review such PRs and it most likely get rejected.
- Do not add/remove vertical whitespace. Preserve the original style of the file you
edit as much as you can.
- Do not turn an already submitted PR into your development playground. If after you
submitted PR, you discovered that more work is needed - close the PR, do the required
work and then submit a new PR. Otherwise each of your commits requires attention from
maintainers of the project.
- If, however, you submitted a PR and received a request for changes, you should proceed
with commits inside that PR, so that the maintainer can see the incremental fixes and
won't need to review the whole PR again. In the exception case where you realize it'll
take many many commits to complete the requests, then it's probably best to close the
PR, do the work and then submit it again. Use common sense where you'd choose one way
over another.

## Do you want to contribute to the documentation?

- Docs are automatically created from the notebooks in the nbs folder.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM condaforge/mambaforge:4.11.0-0

COPY environment.yml /environment.yml
RUN mamba env update -n base -f /environment.yml
RUN conda run -n base python -m ipykernel install --user --name base --display-name base
RUN rm -rf /environment.yml

COPY docs/nbdev_showdoc.patch /nbdev_showdoc.patch
RUN patch -R $(python -c "from nbdev import showdoc; print(showdoc.__file__)") < /nbdev_showdoc.patch
RUN rm -rf /nbdev_showdoc.patch

ADD . /sax
RUN pip install /sax
RUN rm -rf /sax

RUN conda create -n sax --clone base
RUN conda run -n sax python -m ipykernel install --user --name sax --display-name sax
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2022 Floris Laporte

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
67 changes: 67 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.ONESHELL:
SHELL := /bin/bash
SRC = $(wildcard nbs/*.ipynb)

all: sax docs

.SILENT: docker
docker:
sed -i "s/^[ ]*-[ ]\bsax\b.*//g" environment.yml
sed -i "s/\$${RPYPI_USER}/${RPYPI_USER}/g" environment.yml
sed -i "s/\$${RPYPI_TOKEN}/${RPYPI_TOKEN}/g" environment.yml
-docker build . -t sax
git checkout -- environment.yml

sax: $(SRC)
nbdev_build_lib

lib:
nbdev_build_lib

sync:
nbdev_update_lib

serve:
cd docs && bundle exec jekyll serve

.PHONY: docs
docs:
jupyter nbconvert --execute --inplace index.ipynb
nbdev_build_docs

run:
find . -name "*.ipynb" | grep -v ipynb_checkpoints | xargs -I {} papermill {} {}

test:
nbdev_test_nbs

release: pypi conda_release
nbdev_bump_version

conda_release:
fastrelease_conda_package

pypi: dist
twine upload --repository pypi dist/*

dist: clean
python -m build --sdist --wheel

clean:
nbdev_clean_nbs
find . -name "*.ipynb" | xargs nbstripout
find . -name "dist" | xargs rm -rf
find . -name "build" | xargs rm -rf
find . -name "builds" | xargs rm -rf
find . -name "__pycache__" | xargs rm -rf
find . -name "*.so" | xargs rm -rf
find . -name "*.egg-info" | xargs rm -rf
find . -name ".ipynb_checkpoints" | xargs rm -rf
find . -name ".pytest_cache" | xargs rm -rf

reset:
rm -rf sax
rm -rf docs
git checkout -- docs
nbdev_build_lib
make clean

0 comments on commit fac3a24

Please sign in to comment.