Skip to content

Commit

Permalink
Merge pull request #1 from AnacondaRecipes/PKG-5880-thop-0_1_1_post-2…
Browse files Browse the repository at this point in the history
…209072238

thop 0.1.1.post2209072238 ❄️
  • Loading branch information
lorepirri authored Dec 30, 2024
2 parents 51812ef + 99ca078 commit 5f33393
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 40 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
About <pkg_name>-feedstock
About thop-feedstock
=======================

Feedstock license: [BSD-3-Clause](LICENSE)

Home: <home_url>
Home: https://github.com/Lyken17/pytorch-OpCounter

Package license: <pkg_license>
Package license: MIT

Summary: <pkg_summary>
Summary: Count the MACs / FLOPs of your PyTorch model.


Current release info
====================

| Name | Downloads | Version | Platforms |
| --- | --- | --- | --- |
| [![Conda Recipe](https://img.shields.io/badge/recipe-<pkg_name>-green.svg)](https://anaconda.org/anaconda/<pkg_name>) | [![Conda Downloads](https://img.shields.io/conda/dn/anaconda/<pkg_name>.svg)](https://anaconda.org/anaconda/<pkg_name>) | [![Conda Version](https://img.shields.io/conda/vn/anaconda/<pkg_name>.svg)](https://anaconda.org/anaconda/<pkg_name>) | [![Conda Platforms](https://img.shields.io/conda/pn/anaconda/<pkg_name>.svg)](https://anaconda.org/anaconda/<pkg_name>) |
| [![Conda Recipe](https://img.shields.io/badge/recipe-thop-green.svg)](https://anaconda.org/anaconda/thop) | [![Conda Downloads](https://img.shields.io/conda/dn/anaconda/thop.svg)](https://anaconda.org/anaconda/thop) | [![Conda Version](https://img.shields.io/conda/vn/anaconda/thop.svg)](https://anaconda.org/anaconda/thop) | [![Conda Platforms](https://img.shields.io/conda/pn/anaconda/thop.svg)](https://anaconda.org/anaconda/thop) |

Installing <pkg_name>
Installing thop
==================

Installing `<pkg_name>` from the main channel can be achieved by:
Installing `thop` from the main channel can be achieved by:

```
conda install <pkg_name>
conda install thop
```

It is possible to list all of the versions of `<pkg_name>` available on your platform with `conda`:
It is possible to list all of the versions of `thop` available on your platform with `conda`:

```
conda search <pkg_name>
conda search thop
```
2 changes: 2 additions & 0 deletions abs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
upload_channels:
- sfe1ed40
15 changes: 0 additions & 15 deletions pull_request_template.md

This file was deleted.

46 changes: 31 additions & 15 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,61 @@
{% set name = "<PLEASE ADD PKG NAME>" %}
{% set version = "<PLEASE ADD PKG VERSION>" %}
{% set name = "thop" %}
{% set version = "0.1.1.post2209072238" %}
{% set commit_id = "43c064afb71383501e41eaef9e8c8407265cf77f" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
sha256: <sha256>
# use github archive release for tests, LICENSE, and because there is no sdist on PyPi
url: https://github.com/Lyken17/pytorch-OpCounter/archive/{{ commit_id }}.tar.gz
sha256: cbda9dc83ad9b78a9fbc8d89f8f1fb1da8ca284b39faab3e9ed697fb2bee909f
patches:
- patches/0001-use-conda-build-version-for-pkg.patch

build:
number: 0
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
skip: True # [py<38]
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation

requirements:
build:
- patch # [not win]
- m2-patch # [win]
host:
- python
- pip
- setuptools
- wheel
run:
- python
- pytorch

test:
imports:
- {{ name.replace('-', '.') }}
- thop
requires:
- pip
- pytest
source_files:
- tests
commands:
- pip check
# check that pip gets the correct version
- python -c "from importlib.metadata import version; assert(version('{{ name }}')=='{{ version }}')"
- pytest tests

about:
home: <PLEASE ADD HOME URL>
summary: <PLEASE ADD SUMMARY>
home: https://github.com/Lyken17/pytorch-OpCounter
summary: Count the MACs / FLOPs of your PyTorch model.
description: |
<PLEASE ADD DESCRIPTION>
license: <PLEASE ADD LICENSE>
license_family: <PLEASE ADD LICENSE_FAMILY>
license_file: <PLEASE_ADD_LICENSE_FILE>
dev_url: <PLEASE ADD DEV URL>
doc_url: <PLEASE ADD DOC URL>
Count the MACs / FLOPs of your PyTorch model.
license: MIT
license_family: MIT
license_file: LICENSE
dev_url: https://github.com/Lyken17/pytorch-OpCounter
doc_url: https://github.com/Lyken17/pytorch-OpCounter

extra:
recipe-maintainers:
- Jrice1317
- lorepirri
43 changes: 43 additions & 0 deletions recipe/patches/0001-use-conda-build-version-for-pkg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From bd8bdee45c2584f3633e2534979657f659546e9f Mon Sep 17 00:00:00 2001
From: Lorenzo Pirritano <[email protected]>
Date: Mon, 4 Nov 2024 14:22:12 +0100
Subject: [PATCH] use conda build version for pkg

The version is generated with the timestamp as suffix each time
setup.py is run (every time we build the package).

With this patch we override the package version to the conda build
one (from the environment variable PKG_VERSION).

---
setup.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/setup.py b/setup.py
index 100bd16..d14cace 100644
--- a/setup.py
+++ b/setup.py
@@ -8,8 +8,8 @@ from setuptools.command.install import install

readme = open("README.md").read()

-fp = open("thop/__version__.py", "r").read()
-VERSION = eval(fp.strip().split()[-1])
+# fp = open("thop/__version__.py", "r").read()
+# VERSION = eval(fp.strip().split()[-1])

requirements = [
"torch",
@@ -18,7 +18,8 @@ requirements = [
# import subprocess
# commit_hash = subprocess.check_output("git rev-parse HEAD", shell=True).decode('UTF-8').rstrip()
# VERSION += "_" + str(int(commit_hash, 16))[:8]
-VERSION += "_" + datetime.datetime.now().strftime("%Y%m%d%H%M")[2:]
+# VERSION += "_" + datetime.datetime.now().strftime("%Y%m%d%H%M")[2:]
+VERSION = os.environ['PKG_VERSION']
print(VERSION)

setup(
--
2.39.1

0 comments on commit 5f33393

Please sign in to comment.