Skip to content

Commit 0ede6be

Browse files
Merge pull request #9 from katehyerinjeon/hw5
hw5
2 parents 93d7440 + 1404c73 commit 0ede6be

19 files changed

Lines changed: 612 additions & 98 deletions

.bumpversion.cfg

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[bumpversion]
2+
current_version = 0.1.0
3+
commit = True
4+
tag = True
5+
6+
[bumpversion:file:pynrm/_version.py]
7+
search = __version__ = "{current_version}"
8+
replace = __version__ = "{new_version}"
9+
10+
[bumpversion:file:pyproject.toml]
11+
search = version="{current_version}"
12+
replace = version="{new_version}"
13+
14+
[bumpversion:file:setup.py]
15+
search = version="{current_version}"
16+
replace = version="{new_version}"

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.ipynb linguist-documentation
2+
3+
* text=auto eol=lf

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build Status
2+
3+
on:
4+
push:
5+
branches:
6+
- hw4
7+
tags:
8+
- v*
9+
paths-ignore:
10+
- CONTRIBUTING.md
11+
- LICENSE
12+
- README.md
13+
pull_request:
14+
workflow_dispatch:
15+
16+
jobs:
17+
build:
18+
runs-on: ${{ matrix.os }}
19+
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest]
23+
python-version: [3.9]
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
cache: "pip"
33+
cache-dependency-path: 'pyproject.toml'
34+
35+
- name: Install dependencies
36+
run: |
37+
make develop
38+
- name: Build
39+
run: |
40+
make build
41+
- name: Lint
42+
run: |
43+
make lint
44+
- name: Checks
45+
run: |
46+
make checks
47+
- name: Test
48+
run: |
49+
make coverage
50+
- name: Upload test results
51+
uses: actions/upload-artifact@v3
52+
with:
53+
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
54+
path: python_junit.xml
55+
if: ${{ always() }}
56+
57+
- name: Upload coverage
58+
uses: codecov/codecov-action@v3

.gitignore

Lines changed: 12 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ __pycache__/
33
*.py[cod]
44
*$py.class
55

6-
# C extensions
7-
*.so
8-
96
# Distribution / packaging
107
.Python
118
build/
@@ -50,80 +47,35 @@ coverage.xml
5047
*.py,cover
5148
.hypothesis/
5249
.pytest_cache/
50+
lib-cov
51+
coverage
52+
python_junit.xml
5353

54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
54+
# Documentation
7255
docs/_build/
56+
/site
7357

7458
# PyBuilder
7559
target/
7660

7761
# Jupyter Notebook
7862
.ipynb_checkpoints
7963

80-
# IPython
81-
profile_default/
82-
ipython_config.py
83-
84-
# pyenv
85-
.python-version
86-
87-
# pipenv
88-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91-
# install all needed dependencies.
92-
#Pipfile.lock
93-
94-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95-
__pypackages__/
96-
97-
# Celery stuff
98-
celerybeat-schedule
99-
celerybeat.pid
100-
101-
# SageMath parsed files
102-
*.sage.py
103-
10464
# Environments
10565
.env
10666
.venv
10767
env/
10868
venv/
10969
ENV/
110-
env.bak/
111-
venv.bak/
11270

113-
# Spyder project settings
114-
.spyderproject
115-
.spyproject
116-
117-
# Rope project settings
118-
.ropeproject
119-
120-
# mkdocs documentation
121-
/site
71+
# Linting
72+
.eslintcache
12273

12374
# mypy
12475
.mypy_cache/
125-
.dmypy.json
126-
dmypy.json
12776

128-
# Pyre type checker
129-
.pyre/
77+
# Mac
78+
.DS_Store
79+
80+
# VS Code
81+
.vscode

MANIFEST.in

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
graft pynrm
2+
graft pynrm/tests
3+
4+
include LICENSE
5+
include README.md
6+
include CONTRIBUTING.md
7+
8+
include .bumpversion.cfg
9+
include pyproject.toml
10+
include Makefile
11+
12+
prune .vscode
13+
prune .github
14+
exclude .gitignore
15+
exclude .gitattributes
16+
17+
# Patterns to exclude from any directory
18+
global-exclude *~
19+
global-exclude *.pyc
20+
global-exclude *.pyo
21+
global-exclude .git
22+
global-exclude .ipynb_checkpoints
23+
global-exclude .DS_Store

Makefile

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#########
2+
# BUILD #
3+
#########
4+
develop: ## install dependencies and build library
5+
python -m pip install -e .[develop]
6+
7+
build: ## build the python library
8+
python setup.py build build_ext --inplace
9+
10+
install: ## install library
11+
python -m pip install .
12+
13+
#########
14+
# LINTS #
15+
#########
16+
lint: ## run static analysis with flake8
17+
python -m black --check pynrm setup.py
18+
python -m flake8 --max-line-length=120 --extend-ignore=E203 pynrm setup.py
19+
20+
# Alias
21+
lints: lint
22+
23+
format: ## run autoformatting with black
24+
python -m black pynrm/ setup.py
25+
26+
# alias
27+
fix: format
28+
29+
check: ## check assets for packaging
30+
check-manifest -v
31+
32+
# Alias
33+
checks: check
34+
35+
annotate: ## run type checking
36+
python -m mypy ./pynrm
37+
38+
#########
39+
# TESTS #
40+
#########
41+
test: ## clean and run unit tests
42+
python -m pytest -v pynrm/tests
43+
44+
coverage: ## clean and run unit tests with coverage
45+
python -m pytest -v pynrm/tests --cov=pynrm --cov-branch --cov-fail-under=75 --cov-report term-missing
46+
47+
# Alias
48+
tests: test
49+
50+
###########
51+
# VERSION #
52+
###########
53+
show-version:
54+
bump2version --dry-run --allow-dirty setup.py --list | grep current | awk -F= '{print $2}'
55+
56+
patch:
57+
bump2version patch
58+
59+
minor:
60+
bump2version minor
61+
62+
major:
63+
bump2version major
64+
65+
########
66+
# DIST #
67+
########
68+
dist-build: # Build python dist
69+
python setup.py sdist bdist_wheel
70+
71+
dist-check:
72+
python -m twine check dist/*
73+
74+
dist: clean build dist-build dist-check ## Build dists
75+
76+
publish: # Upload python assets
77+
echo "would usually run python -m twine upload dist/* --skip-existing"
78+
79+
#########
80+
# CLEAN #
81+
#########
82+
deep-clean: ## clean everything from the repository
83+
git clean -fdx
84+
85+
clean: ## clean the repository
86+
rm -rf .coverage coverage cover htmlcov logs build dist *.egg-info .pytest_cache
87+
88+
############################################################################################
89+
90+
# Thanks to Francoise at marmelab.com for this
91+
.DEFAULT_GOAL := help
92+
help:
93+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
94+
95+
print-%:
96+
@echo '$*=$($*)'
97+
98+
.PHONY: develop build install lint lints format fix check checks annotate test coverage show-coverage tests show-version patch minor major dist-build dist-check dist publish deep-clean clean help

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# pynrm
22
`pynrm` is a lightweight and extensible animal breeding simulation library for Python.
33

4+
[![Build Status](https://github.com/katehyerinjeon/pynrm/workflows/Build%20Status/badge.svg?branch=main)](https://github.com/katehyerinjeon/pynrm/actions?query=workflow%3A%22Build+Status%22)
5+
[![codecov](https://codecov.io/gh/katehyerinjeon/pynrm/branch/main/graph/badge.svg)](https://codecov.io/gh/katehyerinjeon/pynrm)
46
![GitHub](https://img.shields.io/github/license/katehyerinjeon/pynrm)
57
![GitHub issues](https://img.shields.io/github/issues/katehyerinjeon/pynrm)
68

@@ -9,4 +11,4 @@ The numerator relationship matrix describes additive genetic relationships withi
911
Numerous evaluation-selection systems have been devised to produce populations with favorable genetic responses while maintaining moderate to low rates of inbreeding.
1012
`pynrm` provides a simple yet powerful simulation tool to forecast the stochastic impacts of these systems.
1113
One major bottleneck to running these simulations is that as the number of animals bred increases, the size of the matrix grows exponentially.
12-
`pynrm` efficiently solves for the numerator relationship matrix values by tracing up the pedigree for only the relevant ancestors, thereby minimizing computational overhead.
14+
`pynrm` efficiently solves for the numerator relationship matrix values by tracing up the pedigree for only the relevant ancestors, thereby minimizing computational overhead.

nrm.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)