Skip to content

Commit

Permalink
Update conda publication
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit-cty authored and benoit-cty committed May 21, 2024
1 parent b5bc3a6 commit f3835fd
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 26 deletions.
24 changes: 9 additions & 15 deletions .conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{% set version = "2.4.1" %}
{% set version_match = load_file_regex(
load_file='codecarbon/_version.py',
regex_pattern='^__version__ = "(.+)"') %}
{% set version = version_match[1] %}
{% set pyproject = load_file_data('pyproject.toml') %}

package:
name: codecarbon
version: {{ version }}

source:
path: ../..
path: ..

build:
noarch: python
Expand All @@ -21,19 +25,9 @@ requirements:
- python
- pip
run:
- python>=3.7
- arrow
- click
- dash
- dash-bootstrap-components
- fire
- pandas
- requests
- psutil
- pynvml
- py-cpuinfo
- prometheus_client
- rapidfuzz
{% for req in pyproject.get('project').get('dependencies') %}
- {{ req }}
{% endfor %}

test:
imports:
Expand Down
4 changes: 1 addition & 3 deletions .github/check_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ def get_versions_from_pypi(package_name: str = "") -> dict:
args = parser.parse_args()
versions = get_versions_from_pypi("codecarbon")
module_version = get_local_version()
meta_version = get_local_version(".conda/meta.yaml")
local_versions = [module_version, meta_version]
local_versions = [module_version]
if local_versions.count(local_versions[0]) != len(local_versions):
print("All local versions did not match !")
print(f"codecarbon/_version.py : {module_version}")
print(f".conda/meta.yaml : {meta_version}")
sys.exit(1)
if args.onlyprintversion:
print(module_version)
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ to regenerate the html files.
### Release process

- Merge all PRs.
- Create a PR bumping the version with `hatch version minor` and report it in https://github.com/mlco2/codecarbon/blob/master/.conda/meta.yaml.
- Create a PR bumping the version with `hatch version minor`.
- Run `python3 .github/check_version.py` to check version consistancy.
- [Build Documentation](#documentation) if needed with `hatch run docs:build`.
- Merge the PR.
Expand All @@ -433,8 +433,8 @@ Start a Docker image in the same directory and bind-mount the current directory

Inside the docker container, run:
- `conda install conda-build conda-verify`
- `cd /data && mkdir -p conda_dist`
- `conda build --python 3.8 .conda/ -c conda-forge --output-folder conda_dist`
- `cd /data && mkdir -p /conda_dist`
- `conda build --python 3.8 .conda/ -c conda-forge --output-folder /conda_dist`
- `anaconda upload --user codecarbon /data/noarch/codecarbon-*.tar.bz2`


Expand Down
30 changes: 28 additions & 2 deletions requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
# - pre-commit
# - ruff
# - black
# - mypy
# - arrow
# - click
# - pandas
Expand All @@ -16,14 +18,18 @@

arrow==1.3.0
# via hatch.envs.dev
black==24.4.2
# via hatch.envs.dev
certifi==2024.2.2
# via requests
cfgv==3.4.0
# via pre-commit
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via hatch.envs.dev
# via
# hatch.envs.dev
# black
distlib==0.3.8
# via virtualenv
filelock==3.13.3
Expand All @@ -32,14 +38,26 @@ identify==2.5.35
# via pre-commit
idna==3.7
# via requests
mypy==1.10.0
# via hatch.envs.dev
mypy-extensions==1.0.0
# via
# black
# mypy
nodeenv==1.8.0
# via pre-commit
numpy==1.26.4
# via pandas
packaging==24.0
# via black
pandas==2.2.1
# via hatch.envs.dev
pathspec==0.12.1
# via black
platformdirs==4.2.0
# via virtualenv
# via
# black
# virtualenv
pre-commit==3.7.0
# via hatch.envs.dev
prometheus-client==0.20.0
Expand All @@ -66,8 +84,16 @@ ruff==0.3.4
# via hatch.envs.dev
six==1.16.0
# via python-dateutil
tomli==2.0.1
# via
# black
# mypy
types-python-dateutil==2.9.0.20240316
# via arrow
typing-extensions==4.11.0
# via
# black
# mypy
tzdata==2024.1
# via pandas
urllib3==2.2.1
Expand Down
102 changes: 99 additions & 3 deletions requirements/requirements-test.py3.9.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#
# This file is autogenerated by hatch-pip-compile with Python 3.9
#
# - mock
# - pytest
# - responses
# - numpy
# - psutil
# - requests-mock
# - rapidfuzz
# - arrow
# - click
# - pandas
Expand All @@ -10,22 +17,75 @@
# - pynvml
# - rapidfuzz
# - requests
# - dash
# - dash-bootstrap-components<1.0.0
# - fire
#

arrow==1.3.0
# via hatch.envs.test.py3.9
blinker==1.8.2
# via flask
certifi==2024.2.2
# via requests
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via
# hatch.envs.test.py3.9
# flask
dash==2.17.0
# via
# hatch.envs.test.py3.9
# dash-bootstrap-components
dash-bootstrap-components==0.13.1
# via hatch.envs.test.py3.9
dash-core-components==2.0.0
# via dash
dash-html-components==2.0.0
# via dash
dash-table==5.0.0
# via dash
exceptiongroup==1.2.1
# via pytest
fire==0.6.0
# via hatch.envs.test.py3.9
flask==3.0.3
# via dash
idna==3.7
# via requests
importlib-metadata==7.1.0
# via
# dash
# flask
iniconfig==2.0.0
# via pytest
itsdangerous==2.2.0
# via flask
jinja2==3.1.4
# via flask
markupsafe==2.1.5
# via
# jinja2
# werkzeug
mock==5.1.0
# via hatch.envs.test.py3.9
nest-asyncio==1.6.0
# via dash
numpy==1.26.4
# via pandas
# via
# hatch.envs.test.py3.9
# pandas
packaging==24.0
# via
# plotly
# pytest
pandas==2.2.1
# via hatch.envs.test.py3.9
plotly==5.22.0
# via dash
pluggy==1.5.0
# via pytest
prometheus-client==0.20.0
# via hatch.envs.test.py3.9
psutil==5.9.8
Expand All @@ -34,21 +94,57 @@ py-cpuinfo==9.0.0
# via hatch.envs.test.py3.9
pynvml==11.5.0
# via hatch.envs.test.py3.9
pytest==8.2.0
# via hatch.envs.test.py3.9
python-dateutil==2.9.0.post0
# via
# arrow
# pandas
pytz==2024.1
# via pandas
pyyaml==6.0.1
# via responses
rapidfuzz==3.7.0
# via hatch.envs.test.py3.9
requests==2.31.0
# via
# hatch.envs.test.py3.9
# dash
# requests-mock
# responses
requests-mock==1.12.1
# via hatch.envs.test.py3.9
responses==0.25.0
# via hatch.envs.test.py3.9
retrying==1.3.4
# via dash
six==1.16.0
# via python-dateutil
# via
# fire
# python-dateutil
# retrying
tenacity==8.3.0
# via plotly
termcolor==2.4.0
# via fire
tomli==2.0.1
# via pytest
types-python-dateutil==2.9.0.20240316
# via arrow
typing-extensions==4.11.0
# via dash
tzdata==2024.1
# via pandas
urllib3==2.2.1
# via requests
# via
# requests
# responses
werkzeug==3.0.3
# via
# dash
# flask
zipp==3.18.2
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools

0 comments on commit f3835fd

Please sign in to comment.