Skip to content

Commit c2f2cda

Browse files
authored
Add optional build dependencies, instructions for building (#77)
* Add optional build dependencies * Add instructions for building * Add Makefile for convenience * Update README to point to dev dependencies
1 parent d047737 commit c2f2cda

File tree

3 files changed

+51
-13
lines changed

3 files changed

+51
-13
lines changed

Makefile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.PHONY: build
2+
build:
3+
python -m build
4+
5+
.PHONY: release-test
6+
release-test:
7+
twine upload dist/* -r testpypi
8+
9+
.PHONY: release
10+
release:
11+
twine upload dist/* -r pypi
12+
13+
.PHONY: install
14+
install:
15+
pip install -e '.[dev,build]'
16+
17+
.PHONY: uninstall
18+
uninstall:
19+
pip uninstall -y labkey

README.md

+29-12
Original file line numberDiff line numberDiff line change
@@ -117,29 +117,29 @@ Python 3.7+ is fully supported.
117117
LabKey Server v15.1 and later.
118118

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

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

125126
```bash
126-
pip install -e .
127+
pip install -e '.[dev]'
127128
```
128129

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

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

138134
```bash
139-
$ pip install -e '.[test]'
135+
black .
140136
```
141137

142-
Then, the tests can be run with
138+
After black has run it may have formatted some files, commit the changed files before opening a PR.
139+
140+
### Testing
141+
If you are looking to contribute please run the tests before issuing a PR. The tests can be run with:
142+
143143
```bash
144144
$ pytest .
145145
```
@@ -154,3 +154,20 @@ $ pytest . -m "integration"
154154
### Maintainers
155155
Package maintainer's can reference the [Python Package Maintenance](https://docs.google.com/document/d/13nVxwyctH4YZ6gDhcrOu9Iz6qGFPAxicE1VHiVYpw9A/) document (requires permission) for updating
156156
releases.
157+
158+
To build the package before releasing you will need to install the build dependencies. This can be done by running:
159+
160+
```bash
161+
pip install -e '.[build]'
162+
```
163+
164+
To build the package you can run:
165+
166+
```bash
167+
python -m build
168+
```
169+
170+
You should now have a `dist/` folder with two files:
171+
172+
1. `labkey-<version from __init__.py>.tar.gz` - This is the source distribution
173+
2. `labkey-<version from __init__.py>-py3-none-any.whl` - This is the wheel

setup.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
long_desc = "Python client API for LabKey Server. Supports query and experiment APIs."
3434

3535
tests_require = ["pytest", "requests", "mock", "pytest-cov"]
36+
dev_require = ["pytest", "requests", "mock", "pytest-cov", "black"]
37+
build_require = ["setuptools", "build", "twine", "wheel"]
3638

3739
setup(
3840
name="labkey",
@@ -48,7 +50,7 @@
4850
packages=packages,
4951
package_data={},
5052
install_requires=["requests"],
51-
extras_require={"test": tests_require},
53+
extras_require={"test": tests_require, "dev": dev_require, "build": build_require},
5254
keywords="labkey api client",
5355
classifiers=[
5456
"Development Status :: 4 - Beta",

0 commit comments

Comments
 (0)