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

Adding Contribution Guidelines & Nix #106

Merged
merged 6 commits into from
Jun 15, 2020
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ testing/udo_test.py

Simulation.md

monkeytype.sqlite3
monkeytype.sqlite3

result
20 changes: 16 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,32 @@

:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

The following is a set of guidelines for contributing to cadCAD. These are mostly guidelines, not rules.
The following is a set of guidelines for contributing to cadCAD.
Use your best judgment, and feel free to propose changes to this document in a pull request.

### Pull Requests:

Pull Request (PR) presented as "->".

General Template:
fork/branch -> BlockScience/staging
user/branch -> BlockScience/staging

Contributing a new feature:
fork/feature -> BlockScience/staging
user/feature -> BlockScience/staging

Contributing to an existing feature:
fork/feature -> BlockScience/feature
user/feature -> BlockScience/feature

### General Advise for Forked Repositories:
1. `git pull fork master`
2. `git checkout -b feature` (new feature)
3. Apply your awesomeness! (Commit Often)
4. `git push fork feature`
5. Apply a merge strategy you're comfortable with. I suggest a merge path to `master` similar to what's above.
6. Submit PR from `user:master` into `BlockScience:staging`
7. PR is queued for review
8. PR Reviewed (Update necessary if rejected)
9. PR Approved (There may be circumstances delaying the merge.)
10. Your contribution merged into next feature release on `BlockScience:master`

Thanks! :heart:
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ python3 setup.py sdist bdist_wheel
pip3 install dist/*.whl
```

**Option C: Using [Nix](https://nixos.org/nix/)**
1. Run `curl -L https://nixos.org/nix/install | sh` or install Nix via system package manager
2. Run `nix-shell` to enter into a development environment, `nix-build` to build project from source, and `nix-env -if default.nix` to install

The above steps will enter you into a Nix development environment, with all package requirements for development of and with cadCAD.

This works with just about all Unix systems as well as MacOS, for pure reproducible builds that don't dirty your local environment.

## 2. Learn the basics
**Tutorials:** available both as [Jupyter Notebooks](tutorials)
Expand All @@ -46,5 +53,7 @@ Familiarize yourself with some system modelling concepts and cadCAD terminology.
* [Policy Aggregation](documentation/Policy_Aggregation.md)
* [System Model Parameter Sweep](documentation/System_Model_Parameter_Sweep.md)

## 4. Connect
## 4. [Contribution](CONTRIBUTING.md)

## 5. Connect
Find other cadCAD users at our [Discourse](https://community.cadcad.org/). We are a small but rapidly growing community.
45 changes: 45 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{ pkgs ? import <nixpkgs> { }, stdenv ? pkgs.stdenv, fetchPypi ? pkgs.fetchPypi
, pythonPkgs ? pkgs.python36Packages
, buildPythonPackage ? pythonPkgs.buildPythonPackage }:

buildPythonPackage rec {
pname = "cadCAD";
version = "0.4.15";

# Nix allows fetching the project source from different locations
#src = fetchPypi {
# inherit pname version;
# sha256 = "4f2a4d39e4ea601b9ab42b2db08b5918a9538c168cff1c6895ae26646f3d73b1";
#};
# src = builtins.fetchGit {
# url = "git@github.com:BlockScience/cadCAD.git";
# ref = "master";
# };
src = ./.;

# In future, when tests are introduced, this can be updated to 'true'
doCheck = false;

buildInputs = with pythonPkgs; [
wheel
pytest
parameterized
];
checkInputs = [ ];
propagatedBuildInputs = with pythonPkgs; [
pandas
pathos
fn
funcy
tabulate
];

meta = with stdenv.lib; {
description =
"Design, test and validate complex systems through simulation in Python";
homepage = "https://github.com/BlockScience/cadCAD";
license = licenses.mit;
# maintainers = with maintainers; [ benschza ];
platforms = platforms.unix;
};
}
4 changes: 4 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
with import <nixpkgs> { };

(let cadCAD = pkgs.callPackage ./default.nix { inherit (pkgs) ; };
in pkgs.python36.withPackages (ps: [ cadCAD ps.pandas ])).env