|
1 | 1 | # Installing CDIPpy for development |
2 | | -This page contains instructions for CDIPpy users interested in customizing or contributiing to the library. |
| 2 | +This page contains instructions for CDIPpy users interested in customizing or contributing to the library. |
3 | 3 |
|
4 | | -## Download from source |
| 4 | +## Download source |
| 5 | +Clone the [CDIPpy repository](https://github.com/cdipsw/CDIPpy): |
| 6 | + |
| 7 | +* using `ssh` - `git clone git@github.com:cdipsw/CDIPpy.git` |
| 8 | +* using `https` - `git clone https://github.com/cdipsw/CDIPpy.git` |
| 9 | + |
| 10 | +If you need help getting started with [Git](https://git-scm.com/doc) and [GitHub](https://docs.github.com/en/enterprise-cloud@latest/get-started). |
| 11 | +You'll specifically want to look at configuring credentials with [https](https://git-scm.com/docs/gitcredentials) or [ssh](https://docs.github.com/en/authentication/connecting-to-github-with-ssh). |
| 12 | +[Oh Shit, Git?!](https://ohshitgit.com/) is another great resource for fixing git problems. |
5 | 13 |
|
6 | 14 | ## Install with dev tools |
| 15 | +It is recommended to us [`uv`](https://docs.astral.sh/uv/) to manage you development environment for this project, but other package managers will likely work as well. This documentation provides instructions for using `uv`. |
| 16 | + |
| 17 | +Navigate to the project root dirctory ('CDIPpy/') and run the following: |
| 18 | +``` bash |
| 19 | +>>> pip install uv # install uv pacakge manager |
| 20 | +>>> uv venv # create a virtual envionment at CDIPpy/.venv/ |
| 21 | +>>> source activate .venv/bin/activate # activate the environment |
| 22 | +>>> uv pip install -e .[dev] # install the source code, its runtime dependencies, and its dev. dependencies. |
| 23 | +``` |
| 24 | +Using the `-e` flag tells `uv` to point the installation to the source code directory, so that changes you make will be automatically reflected in the environment without reinstalling the package. The `[dev]` specifier installs the packages requires to run tests, lint, and build documentation. |
7 | 25 |
|
8 | 26 | ### testing |
| 27 | +You can check that your dev installation was successful by running unit tests from the root directory: `python -m unittest discover`. |
| 28 | +This runs every test in the library; you should see all successful tests. |
| 29 | + |
| 30 | +Learn more about running specific tests or subsets from the [`unittest` docs](https://docs.python.org/3/library/unittest.html). |
| 31 | + |
| 32 | +### linting |
| 33 | +This library uses `flake8` to check for adherance to the [PEP8](https://peps.python.org/pep-0008/) style guide. To check whether your code is compliant with the project style, run `flake8 .` from the project root. You can fix problems manually, or use a tool like [`black`](https://black.readthedocs.io/en/stable/) to autolint: `black .`. |
9 | 34 |
|
10 | | -### linting |
| 35 | +This project also provides a [`pre-commit`](https://pre-commit.com/) hook to manage style for you autmatically on every `git commit`. To install it, run `pre-commit install` from the project root - this will use `black` and `flake` to autolint and check any changes you make for style before committing them to the repository. |
0 commit comments