Skip to content

Commit

Permalink
110 - building package workflow (#130)
Browse files Browse the repository at this point in the history
Solves #110 

Hi all, this PR includes adds local build of the package and few other
changes to improve workflow. Let me know if you have any feedback.
Thanks, -- Miguel

---------

Co-authored-by: Paddy Roddy <[email protected]>
  • Loading branch information
mxochicale and paddyroddy authored Aug 18, 2023
1 parent 3c2cdae commit 2be493a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*.egg-info
*.pyc
*.idea

#default project path
python-template
60 changes: 51 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ We've turned on [discussions](https://github.com/UCL-ARC/python-tooling/discussi

## Using this template

1. Install [cookieninja]
```
pip install cookieninja
```
1. Install [cookieninja](https://libraries.io/pypi/cookieninja) in a `conda`, `mamba` or `venv` environment (commented lines for conda example).

```
# conda create -n ptoolingVE pip -c conda-forge
# conda activate ptoolingVE
pip install cookieninja
```

2. Run cookieninja in the desired directory
```
cookieninja gh:ucl-arc/python-tooling
Expand Down Expand Up @@ -82,13 +86,14 @@ We've turned on [discussions](https://github.com/UCL-ARC/python-tooling/discussi
```

5. To work on your project, initialise a git repository and _install_ it in editable mode.
(If you want to develop in a `venv` or `conda` environment, now is a good time to set that up)
```
cd PROJECT_SLUG
git init
# conda create -n PROJECT_SLUG-dev python=3.11
# conda activate PROJECT_SLUG-dev
python -m pip install -e .
python -m pip install -e ".[dev]"
```
6. Build your package
```
python -m build
```

## Notes for developers
Expand All @@ -113,6 +118,36 @@ To contribute:

### Development

- Clone repository

- (Optional) Generate your SSH keys as suggested [here](https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
- (Optional) GitHub CLI as suggested [here](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account?tool=cli)
- Clone the repository by typing (or copying) the following line in a terminal at your selected path in your machine:

```
git clone [email protected]:UCL-ARC/python-tooling.git
cd python-tooling
```

- To create and remove your virtual environment

```
conda create -n ptoolingVE pip -c conda-forge
conda activate ptoolingVE
conda deactivate ptoolingVE
conda remove -n ptoolingVE --all
```

- To run template in the same path of this repo.
We do a test cookiecut of a dummy package and install it to ensure the template setup works.

```
cookieninja .
cd python-template
git init
python -m pip install -e ".[dev]"
```

- To run cookieninja using a specific branch of the template:

```
Expand All @@ -125,7 +160,14 @@ To contribute:
pytest -s
```

We do a test cookiecut of a dummy package and install it to ensure the template setup works.
- To commit changes

```
pre-commit run -a
git add .
git commmit -m 'message issue number (#NN)'
git push origin NN-future-branch
```

- To build the docs locally

Expand Down
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ optional-dependencies = {dev = [
"build",
"mypy",
"pre-commit",
"pytest",
"ruff",
"tox>=4",
"twine",
Expand Down

0 comments on commit 2be493a

Please sign in to comment.