Skip to content

Commit

Permalink
Add optional build dependencies, instructions for building (#77)
Browse files Browse the repository at this point in the history
* Add optional build dependencies
* Add instructions for building
* Add Makefile for convenience
* Update README to point to dev dependencies
  • Loading branch information
labkey-alan authored Sep 10, 2024
1 parent d047737 commit c2f2cda
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 13 deletions.
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.PHONY: build
build:
python -m build

.PHONY: release-test
release-test:
twine upload dist/* -r testpypi

.PHONY: release
release:
twine upload dist/* -r pypi

.PHONY: install
install:
pip install -e '.[dev,build]'

.PHONY: uninstall
uninstall:
pip uninstall -y labkey
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,29 +117,29 @@ Python 3.7+ is fully supported.
LabKey Server v15.1 and later.

## Contributing
This package is maintained by [LabKey](http://www.labkey.com/). If you have any questions or need support, please use
the [LabKey Server developer support forum](https://www.labkey.org/home/developer/forum/project-start.view).
This package is maintained by [LabKey](http://www.labkey.com/). If you have any questions or need support, please use the
[LabKey Server developer support forum](https://www.labkey.org/home/developer/forum/project-start.view).

### Setup
To install the necessary dependencies for local development you can run the following command:

```bash
pip install -e .
pip install -e '.[dev]'
```

When contributing changes please use `Black` to format your code. To run Black follow these instructions:
1. Install black: `pip install black`
2. Run black: `black .`
3. Commit the newly formatted code.

### Testing
If you are looking to contribute please run the tests before issuing a PR. To run the tests you'll need to install the
additional testing dependencies, to do this run:
### Formatting your code
When contributing changes please use `Black` to format your code. To run Black you can run the following command:

```bash
$ pip install -e '.[test]'
black .
```

Then, the tests can be run with
After black has run it may have formatted some files, commit the changed files before opening a PR.

### Testing
If you are looking to contribute please run the tests before issuing a PR. The tests can be run with:

```bash
$ pytest .
```
Expand All @@ -154,3 +154,20 @@ $ pytest . -m "integration"
### Maintainers
Package maintainer's can reference the [Python Package Maintenance](https://docs.google.com/document/d/13nVxwyctH4YZ6gDhcrOu9Iz6qGFPAxicE1VHiVYpw9A/) document (requires permission) for updating
releases.

To build the package before releasing you will need to install the build dependencies. This can be done by running:

```bash
pip install -e '.[build]'
```

To build the package you can run:

```bash
python -m build
```

You should now have a `dist/` folder with two files:

1. `labkey-<version from __init__.py>.tar.gz` - This is the source distribution
2. `labkey-<version from __init__.py>-py3-none-any.whl` - This is the wheel
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
long_desc = "Python client API for LabKey Server. Supports query and experiment APIs."

tests_require = ["pytest", "requests", "mock", "pytest-cov"]
dev_require = ["pytest", "requests", "mock", "pytest-cov", "black"]
build_require = ["setuptools", "build", "twine", "wheel"]

setup(
name="labkey",
Expand All @@ -48,7 +50,7 @@
packages=packages,
package_data={},
install_requires=["requests"],
extras_require={"test": tests_require},
extras_require={"test": tests_require, "dev": dev_require, "build": build_require},
keywords="labkey api client",
classifiers=[
"Development Status :: 4 - Beta",
Expand Down

0 comments on commit c2f2cda

Please sign in to comment.