Skip to content

Commit 83b869d

Browse files
authored
Simplified uv venv and dependency install. Fixed a couple links. (#12)
Simplified uv venv and dependency install. Fixed a couple links.
1 parent 46891ec commit 83b869d

File tree

4 files changed

+32
-35
lines changed

4 files changed

+32
-35
lines changed

docs/dev_guide/contribute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This project uses a fork-and-pull-request workflow. You will need to make your [
1313
2. Clone the repository from your fork `git clone https://github.com/{your_github_username}/CDIPpy.git` - this will add your own fork as your `origin` remote repo. *Note: If you already have the main fork cloned, skip to the next step and follow instuctions to add your fork as another remote.*
1414
3. Add the main fork as another remote (or your fork, if you cloned from the main fork). This will allow you to pull latest code from the main fork, but push your own development to your own fork:
1515
```bash
16-
git add remote cdip https://github.com/{your_github_username}/CDIPpy.git
16+
git add remote cdip https://github.com/cdipsw/CDIPpy.git
1717
git fetch cdip
1818
git remote -v
1919
```

docs/dev_guide/index.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
# Installing CDIPpy for development
1+
# Installing CDIPpy for development
22
This page contains instructions for CDIPpy users interested in customizing or contributing to the library.
33

44
## Download source
5-
Clone the [CDIPpy repository](https://github.com/cdipsw/CDIPpy):
5+
Clone the [CDIPpy repository](https://github.com/cdipsw/CDIPpy):
66

77
* using `ssh` - `git clone git@github.com:cdipsw/CDIPpy.git`
88
* using `https` - `git clone https://github.com/cdipsw/CDIPpy.git`
99

1010
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.
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+
13+
[Dangit, Git!?!](https://dangitgit.com/) is another great resource for fixing git problems.
1314

1415
## Install with dev tools
1516
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`.
1617

1718
Navigate to the project root dirctory ('CDIPpy/') and run the following:
1819
``` 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.
20+
>>> pip install uv # install uv pacakge manager
21+
>>> uv sync # create a virtual envionment at CDIPpy/.venv/, install the source code, its runtime dependencies and it's dev dependencies defined in pyproject.toml.
22+
>>> source .venv/bin/activate # activate the environment
2323
```
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.
24+
To exclude the development dpendancies, you can run `uv sync --no-dev`.
2525

2626
### testing
2727
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.
28+
This runs every test in the library; you should see all successful tests.
2929

3030
Learn more about running specific tests or subsets from the [`unittest` docs](https://docs.python.org/3/library/unittest.html).
3131

3232
### 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 .`.
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 .`.
3434

3535
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.

docs/quickstart.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
## Installation
22
To install CDIPpy locally, you can either
3-
1. clone the repository, navigate to the root directory, and run `pip install .` or
4-
2. without cloning the repository, install from github:
3+
1. Clone the repository, navigate to the root directory, and run `pip install .` or
4+
2. Without cloning the repository, install from github:
55
*https: `pip install git+https://github.com/cdipsw/CDIPpy.git`*
66
*ssh: `pip install git+ssh://github.com/cdipsw/CDIPpy.git`*
77

88
{{ under_construction("add test snippet to check installation here") }}
99

1010
---
1111

12-
## Development
13-
To set up a development copy of CDIPpy, install the project form source using [`uv`](https://docs.astral.sh/uv/):
12+
## Development
13+
To set up a development copy of CDIPpy, install the project form source using [`uv`](https://docs.astral.sh/uv/):
1414
``` bash
1515
>>> pip install uv
16-
>>> uv venv
17-
>>> source activate .venv/bin/activate
18-
>>> uv pip install -e .[dev]
16+
>>> uv sync
17+
>>> source .venv/bin/activate
1918
```
2019

21-
This creates a local, virtual environment at `./.venv`, and installs a version of CDIPpy that is editable (`-e`), along with several additional dev dependencies (`[dev]`).
20+
This creates a local, virtual environment at `./.venv` and installs a version of CDIPpy along with several additional `dev` dependencies defined in the pyproject.toml file.
2221

2322
---
2423
### Testing
25-
This project uses python's built in `unittest` package. To run all tests:
24+
This project uses python's built in `unittest` package. To run all tests:
2625
~~~ bash
2726
>>> python -m unittest discover
2827
~~~
29-
To run with [coverage](https://coverage.readthedocs.io/en/7.8.2/):
28+
To run with [`coverage`](https://coverage.readthedocs.io/en/latest/):
3029
~~~ bash
3130
>>> coverage run -m unittest discover
3231
~~~
@@ -45,4 +44,4 @@ Contributions are welcome and should be merged via pull request on the `main` br
4544
* there must be at least one reviewer approval
4645
* a CLA must be signed by the contributor, if this is their first commit
4746

48-
If you do not wish you manually check the style for every commit, there is a pre-commit hook that can do it for you. After setting up CDIPpy for development, install the hook with: `pre-commit install`. The installed hook will auto-format the files in your commit with [`black`](https://black.readthedocs.io/en/stable/) and checked for any remaining format errors with `flake8`.
47+
If you do not wish you manually check the style for every commit, there is a pre-commit hook that can do it for you. After setting up CDIPpy for development, install the hook with: `pre-commit install`. The installed hook will auto-format the files in your commit with [`black`](https://black.readthedocs.io/en/stable/) and checked for any remaining format errors with `flake8`.

pyproject.toml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
[project]
42
name = "cdippy"
53
version = "0.1.0"
@@ -18,16 +16,6 @@ dependencies = [
1816
]
1917
keywords = ["oceanography", "waves", "buoy", "data"]
2018

21-
[project.optional-dependencies]
22-
dev = [
23-
"black",
24-
"coverage",
25-
"flake8",
26-
"mkdocs",
27-
"mkdocs-macros-plugin",
28-
"pre-commit"
29-
]
30-
3119
[project.urls]
3220
Homepage = "https://cdip.ucsd.edu"
3321
Source = "https://github.com/cdipsw/CDIPpy"
@@ -38,3 +26,13 @@ packages = ["cdippy"]
3826
[build-system]
3927
requires = ["setuptools>=61.0"]
4028
build-backend = "setuptools.build_meta"
29+
30+
[dependency-groups]
31+
dev = [
32+
"black",
33+
"coverage",
34+
"flake8",
35+
"mkdocs",
36+
"mkdocs-macros-plugin",
37+
"pre-commit",
38+
]

0 commit comments

Comments
 (0)