Skip to content

Commit aab0e48

Browse files
committed
docs: fix various typos & grammar mistakes
1 parent 63c6a55 commit aab0e48

14 files changed

+54
-54
lines changed

CONTRIBUTING.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ conda create --name codecarbon python=3.8
4646
conda activate codecarbon
4747
```
4848

49-
Install from sources in development mode :
49+
Install from sources in development mode:
5050

5151
```bash
5252
git clone https://github.com/mlco2/codecarbon
@@ -64,19 +64,19 @@ Make sure that the [`tox` package](https://tox.readthedocs.io/en/latest/example/
6464
pip install tox
6565
```
6666

67-
You can run tests by simply entering tox in the terminal when in the root package directory, and it will run the unit tests.
67+
You can run the unit tests by simply entering tox in the terminal when in the root package directory.
6868

6969
```
7070
tox
7171
```
7272

73-
This will not run test that may failed because of your environment (no CO2 Signal API token, no PowerGadget...), if you want to run all package tests :
73+
This will not run test that may fail because of your environment (no CO2 Signal API token, no PowerGadget...). If you want to run all package tests:
7474

7575
```
7676
tox -e all
7777
```
7878

79-
You can also test your specific test in an isolated fashion to develop and debug them:
79+
You can also run your specific test in isolation to develop and debug them:
8080

8181
```
8282
$ python -m unittest tests.test_your_feature
@@ -89,20 +89,20 @@ $ python -m unittest tests.test_your_feature.YourTestCase.test_function
8989
To test the API, see [how to deploy it](#local_deployement) first.
9090

9191

92-
Core & external classes are unit tested, with one test file per class. Mosts pull-requests are expected to contains new tests or test update, if you are unusure what to test / how to test it, please put it in the pull-request description and the maintainers will help you.
92+
Core and external classes are unit tested, with one test file per class. Most pull requests are expected to contain either new tests or test updates. If you are unusure what to test / how to test it, please put it in the pull request description and the maintainers will help you.
9393

9494
### Stress your computer
9595

96-
To test CodeCarbon it is usefull to stress your computer to make it use his full power :
97-
- 7Zip is often already on your computer, running it with `7z b` make a quick CPU test.
96+
To test CodeCarbon, it is useful to stress your computer to make it use its full power:
97+
- 7Zip is often already installed, running it with `7z b` makes a quick CPU test.
9898
- [GPU-burn](https://github.com/wilicc/gpu-burn) will load test the GPU for a configurable duration.
9999

100-
`nvidia-smi` is a usefull tool to see the metrics of the GPU and compare it with CodeCarbon.
100+
`nvidia-smi` is a useful tool to see the metrics of the GPU and compare it with CodeCarbon.
101101

102-
### Versionning
102+
### Versioning
103103

104104

105-
To add a new feature to codecarbon, the following workflow is applied :
105+
To add a new feature to codecarbon, the apply the following workflow:
106106
- Master branch is protected
107107
- To contribute to an already [prioritized](https://github.com/orgs/mlco2/projects/1) feature, you can create a branch from master and open a draft PR
108108
- Documenting the intent & the limits of a contribution in a dedicated issue or in the pull request helps the review
@@ -182,7 +182,7 @@ Then, click on the url displayed in the terminal.
182182

183183
### Coding style && Linting
184184

185-
The coding style and linting rules are automatically applied and enforce by [pre-commit](https://pre-commit.com/). This tool helps to maintain the same code style across the code-base to ease the review and collaboration process. Once installed ([https://pre-commit.com/#installation](https://pre-commit.com/#installation)), you can install a Git hook to automatically run pre-commit (and all configured linters/auto-formatters) before doing a commit with `pre-commit install`. Then once you tried to commit, the linters/formatters will run automatically. It should display something similar to:
185+
The coding style and linting rules are automatically applied and enforce by [pre-commit](https://pre-commit.com/). This tool helps to maintain the same code style across the code-base and to ease the review and collaboration process. Once installed ([https://pre-commit.com/#installation](https://pre-commit.com/#installation)), you can install a Git hook to automatically run pre-commit (and all configured linters/auto-formatters) before doing a commit with `pre-commit install`. Then once you tried to commit, the linters/formatters will run automatically. It should display something similar to:
186186

187187
```
188188
[INFO] Initializing environment for https://github.com/psf/black.
@@ -204,7 +204,7 @@ black....................................................................Passed
204204
flake8...................................................................Passed
205205
```
206206

207-
If any of the linters/formatters failed, check the difference with `git diff`, add the differences if there is no behavior changes (isort and black might have change some coding style or import order, this is expected it is their jobs) with `git add` and finally try to commit again `git commit ...`.
207+
If any of the linters/formatters fail, check the difference with `git diff`, add the differences if there is no behavior changes (isort and black might have change some coding style or import order, this is expected it is their job) with `git add` and finally try to commit again `git commit ...`.
208208

209209
You can also run `pre-commit` with `pre-commit run -v` if you have some changes staged but you are not ready yet to commit.
210210

@@ -216,12 +216,12 @@ Dependencies are defined in three different places:
216216
- In [setup.py](setup.py#L7), those are the dependencies for the Pypi package.
217217
- In [.conda/meta.yaml](.conda/meta.yaml#L21), those are the dependencies for the Conda pacakge targeting Python 3.7 and higher versions.
218218

219-
We drop support of Python 3.6 since version 2.0.0 of CodeCarbon.
219+
We have dropped support of Python 3.6 since version 2.0.0 of CodeCarbon.
220220

221221
### Alternative ways of contributing
222222

223223

224-
You have a cool idea, but do not know know if it fits with Code Carbon ? You can create an issue to share :
224+
You have a cool idea, but do not know know if it fits with Code Carbon? You can create an issue to share:
225225
- the code, via the Github repo or [Binder](https://mybinder.org/), to share executable notebooks
226226
- a webapp, using [Voilà](https://github.com/voila-dashboards/voila), [Dash](https://github.com/plotly/dash) or [Streamlit](https://github.com/streamlit/streamlit)
227227
- ideas for improvement about the tool or its documentation
@@ -272,15 +272,15 @@ Inside the docker container, run:
272272

273273
### API
274274

275-
To run the API locally, the easiest way is Docker. Launch this command in the project directory:
275+
The easiest way to run the API locally is with Docker. Launch this command in the project directory:
276276
```
277277
docker-compose up -d
278278
```
279279
Please see [Docker specific documentation](./docker/README.md) for more informations.
280-
When up, the API documentation is locally available at the following URL : http://localhost:8008/redoc and can be used for testing.
280+
When up, the API documentation is available locally at the following URL: http://localhost:8008/redoc and can be used for testing.
281281

282282

283-
In order to connect make codecarbon automatically connect to the local API, create a file `.codecarbon.config` with the content:
283+
In order to make codecarbon automatically connect to the local API, create a file `.codecarbon.config` with contents:
284284
```
285285
[codecarbon]
286286
api_endpoint = http://localhost:8008
@@ -303,11 +303,11 @@ python examples/api_call_debug.py
303303

304304
##### API
305305

306-
The API is availiable to everyone from https://api.codecarbon.io but if you want to deploy it for yourself, here is the instructions.
306+
The API is availiable to everyone from https://api.codecarbon.io, but if you want to deploy it for yourself, here are the instructions.
307307

308-
To deploy the API we use [Clever Cloud](https://www.clever-cloud.com/) , an IT Automation platform. They manage all the hard ops work while we focus on the Code Carbon value.
308+
To deploy the API we use [Clever Cloud](https://www.clever-cloud.com/), an IT Automation platform. They manage all the hard ops work while we focus on the Code Carbon value.
309309

310-
Here is the Clever Cloud configuration if you want to reproduce it :
310+
Here is the Clever Cloud configuration if you want to reproduce it:
311311
```
312312
APP_FOLDER="carbonserver"
313313
CC_PIP_REQUIREMENTS_FILE="requirements.txt"
@@ -325,7 +325,7 @@ To deploy,
325325
git remote add deploy git+ssh://[email protected]/app_<secret_do_not_share>.git
326326
git push deploy master:master
327327
```
328-
Yeah, no so hard, isn't it ?
328+
Yeah, not so hard, is it?
329329

330330
See (the doc)[https://www.clever-cloud.com/doc/getting-started/quickstart/] for more informations.
331331

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pip install codecarbon
5656
```python
5757
conda install -c conda-forge codecarbon
5858
```
59-
To see more installation options please refer to the documentation : [**Installation**](https://mlco2.github.io/codecarbon/installation.html#)
59+
To see more installation options please refer to the documentation: [**Installation**](https://mlco2.github.io/codecarbon/installation.html#)
6060

6161
## Start to estimate your impact 📏
6262

carbonserver/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@
33
## Code Carbon architecture
44
![Code Carbon architecture](Images/code_carbon_archi.png)
55

6-
Documentation :
6+
Documentation:
77

88
- Routers handling: https://fastapi.tiangolo.com/tutorial/bigger-applications/
99
- Security: https://fastapi.tiangolo.com/tutorial/security/
1010
- SQL: https://fastapi.tiangolo.com/tutorial/sql-databases/
11-
- Alembic : https://youtu.be/36yw8VC3KU8
12-
- Deploy a full stack FastAPI / Vue.js app : https://github.com/tiangolo/full-stack-fastapi-postgresql
13-
- FastAPI + PG on docker : https://testdriven.io/blog/fastapi-docker-traefik
11+
- Alembic: https://youtu.be/36yw8VC3KU8
12+
- Deploy a full stack FastAPI / Vue.js app: https://github.com/tiangolo/full-stack-fastapi-postgresql
13+
- FastAPI + PG on docker: https://testdriven.io/blog/fastapi-docker-traefik
1414
- FastAPI db dependency injection: https://python-dependency-injector.ets-labs.org/examples/fastapi-sqlalchemy.html
1515

1616
## Schema of the database
1717
![DB Schema](Images/CodecarbonDB.jpg)
1818

1919

2020

21-
Container Dependencies injection :
21+
Container Dependencies injection:
2222

2323

2424

25-
Database is a core part of the application, used with 2 different usages :
25+
Database is a core part of the application, used with 2 different usages:
2626
- Administration, with alembic to create / populate tables.
2727
- Data persistence, for users data, through the HTTP layer.
2828

2929
The load of data would not be the same for those 2 usages, thus we must define 2 types of database connections for them.
3030
To handle properly the connexion / session, we could define it as part of the infrastructure & keep in the database
3131
folder the high level functions that manipulates tested session building.
32-
A software based on dependency injector :
32+
A software based on dependency injector:
3333
- https://github.com/bentoml/BentoML

carbonserver/tests/TESTING.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ To test the interface exposed by entities, in memory repositories can be used to
1010

1111
### Infrastructure
1212

13-
- Testing SqlRepositories :
14-
- Spawn a test database :
13+
- Testing SqlRepositories:
14+
- Spawn a test database:
1515
- Use docker compose to launch a Postgres instance from project root
1616
```bash
17-
docker compose up -d postgres pgadmin
17+
docker-compose up -d postgres pgadmin
1818
```
1919
- Use [alembic](carbonserver/carbonserver/database/alembic/README.md) to inject last version of database schema
2020
```bash
@@ -39,15 +39,15 @@ A Postman collection of requests is available: ```carbonserver/tests/postman/Tes
3939

4040

4141
### Integration
42-
- Database : in the CI, a prod-like database can be used to test features on real data (TODO)
43-
- Code Carbon package : Launch a train scenario (TODO)
42+
- Database: in the CI, a prod-like database can be used to test features on real data (TODO)
43+
- Code Carbon package: Launch a train scenario (TODO)
4444

4545

46-
## Running the tests :
46+
## Running the tests:
4747

4848
### Install the test setup
4949

50-
In a virtual environment, install and build the api package :
50+
In a virtual environment, install and build the api package:
5151
```bash
5252
git clone [email protected]:mlco2/codecarbon.git
5353
git checkout api
@@ -65,7 +65,7 @@ tox -e integration # Integration tests
6565
```
6666

6767

68-
To test the HTTP layer, you can also deploy a local instance :
68+
To test the HTTP layer, you can also deploy a local instance:
6969

7070
```bash
7171
cd carbonserver/

docker/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ FROM python:3.8
22
WORKDIR /opt
33

44
WORKDIR /opt/codecarbon
5-
# Tips : relative path is from root project folder as we use context in docker-compose
5+
# Tips: relative path is from root project folder as we use context in docker-compose
66
#COPY ./docker/.env.docker .env
77
COPY setup.py .
88
RUN python3 setup.py install
99
COPY . .
10-
# TODO : install codecarbon package ?
10+
# TODO: install codecarbon package?

docker/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Usage of CodeCarbon with Docker
22

3-
## Pre-requisis
3+
## Prerequisites
44

55
Clone the project
66
```sh
77
git clone https://github.com/mlco2/codecarbon/codecarbon.git
88
```
99

10-
Prepare configuration :
10+
Prepare configuration:
1111
```sh
1212
cd codecarbon
1313
cp docker/docker.env .env

docs/edit/faq.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Frequently Asked Questions
99
* **What are the sources of your energy carbon intensity data?**
1010
We use the following sources:
1111

12-
For cloud computing :
12+
For cloud computing:
1313

1414
- Google publish carbon intensity of electricity for `Google Cloud Plateform <https://cloud.google.com/sustainability/region-carbon?hl=fr>`_.
1515

@@ -18,7 +18,7 @@ Frequently Asked Questions
1818
- Microsoft has a Sustainability Calculator that helps enterprises analyze the carbon emissions of their IT infrastructure. But does not publish datacenter carbon intensity.
1919

2020

21-
For private infra :
21+
For private infra:
2222

2323
- When available we use data from `ourworld in data <https://ourworldindata.org/grapher/carbon-intensity-electricity?tab=table>`_
2424

docs/edit/methodology.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ energy sources that are used to generate electricity, including fossil fuels and
2626

2727
When available, CodeCarbon uses global carbon intensity of electricity per cloud provider ( `here <https://github.com/mlco2/codecarbon/blob/master/codecarbon/data/cloud/impact.csv>`_ ) or per country ( `here <https://github.com/mlco2/codecarbon/blob/master/codecarbon/data/private_infra/eu-carbon-intensity-electricity.csv>`_ ).
2828

29-
If we don't have the global carbon intensity or electricity of a country, but we have its electricity mix, we compute the carbon intensity of electricity using this table :
29+
If we don't have the global carbon intensity or electricity of a country, but we have its electricity mix, we compute the carbon intensity of electricity using this table:
3030

3131
.. list-table:: Carbon Intensity Across Energy Sources
3232
:widths: 50 50

examples/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ pip install -r requirements-examples.txt
1111
* [mnist_decorator.py](mnist_decorator.py): Using the `@track_co2` decorator.
1212
* [mnist_callback.py](mnist_callback.py): Using Keras callbacks to save emissions after each epoch.
1313
* [mnist-comet.py](mnist-comet.py): Using `CO2Tracker` with [`Comet`](https://www.comet.ml/site) for automatic experiment and emissions tracking.
14-
* [api_call_demo.py](api_call_demo.py) : Simplest demo to send computer emissions to CodeCarbon API.
15-
* [api_call_debug.py](api_call_debug.py) : Script to send computer emissions to CodeCarbon API. Made for debugging : debug log and send data every 20 seconds.
14+
* [api_call_demo.py](api_call_demo.py): Simplest demo to send computer emissions to CodeCarbon API.
15+
* [api_call_debug.py](api_call_debug.py): Script to send computer emissions to CodeCarbon API. Made for debugging: debug log and send data every 20 seconds.

examples/api_call_debug.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def train_model():
1616
This function will do nothing during (occurrence * delay) seconds.
1717
The Code Carbon API will be called every (measure_power_secs * api_call_interval) seconds.
1818
"""
19-
occurrence = 60 * 24 * 365 * 100 # Run for 100 years !
19+
occurrence = 60 * 24 * 365 * 100 # Run for 100 years!
2020
delay = 60 # Seconds
2121
for i in range(occurrence):
2222
print(f"{occurrence * delay - i * delay} seconds before ending script...")

examples/logging_to_file.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def train_model():
1010
This function will do nothing during (occurrence * delay) seconds.
1111
The Code Carbon API will be called every (measure_power_secs * api_call_interval) seconds.
1212
"""
13-
occurrence = 60 * 24 * 365 * 100 # Run for 100 years !
13+
occurrence = 60 * 24 * 365 * 100 # Run for 100 years!
1414
delay = 60 # Seconds
1515
for i in range(occurrence):
1616
print(f"{occurrence * delay - i * delay} seconds before ending script...")

examples/notebook.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
],
8484
"source": [
8585
"try:\n",
86-
" # Compute intensive code goes here\n",
86+
" # Compute-intensive code goes here\n",
8787
" for i in range(10,1):\n",
8888
" print(i)\n",
8989
"finally:\n",

examples/prometheus_call.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def train_model():
1515
This function will do nothing during (occurrence * delay) seconds.
1616
The Code Carbon API will be called every (measure_power_secs * api_call_interval) seconds.
1717
"""
18-
occurrence = 60 * 24 * 365 * 100 # Run for 100 years !
18+
occurrence = 60 * 24 * 365 * 100 # Run for 100 years!
1919
delay = 60 # Seconds
2020
for i in range(occurrence):
2121
print(f"{occurrence * delay - i * delay} seconds before ending script...")
@@ -24,7 +24,7 @@ def train_model():
2424

2525
if __name__ == "__main__":
2626
logger.setLevel(logging.DEBUG)
27-
# create file handler which logs even debug messages
27+
# create a file handler which logs even debug messages
2828
fh = logging.FileHandler("codecarbon.log")
2929
fh.setLevel(logging.DEBUG)
3030
formatter = logging.Formatter(

examples/pytorch-multigpu-example.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ def __init__(self):
2828
nn.ReLU(),
2929
nn.MaxPool2d(2),
3030
)
31-
# fully connected layer, output 10 classes
31+
# Fully connected layer, output 10 classes
3232
self.out = nn.Linear(32 * 7 * 7, 10)
3333

3434
def forward(self, x):
3535
x = self.conv1(x)
3636
x = self.conv2(x)
37-
# flatten the output of conv2 to (batch_size, 32 * 7 * 7)
37+
# Flatten the output of conv2 to (batch_size, 32 * 7 * 7)
3838
x = x.view(x.size(0), -1)
3939
output = self.out(x)
4040
return output
@@ -104,7 +104,7 @@ def forward(self, x):
104104

105105
for epoch in range(10):
106106
cnn.train()
107-
# train for 1 epoch
107+
# Train for 1 epoch
108108
for _, (image, label) in enumerate(loaders["train"]):
109109
print(f"\rBatch {bidx} | Epoch {epoch}", end="")
110110
bidx += 1

0 commit comments

Comments
 (0)