Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: version string #101

Merged
merged 11 commits into from
Apr 5, 2023
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Generated version file
/src/conda_project/_version.py
27 changes: 16 additions & 11 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
{% set pyproject = load_file_data('../pyproject.toml', from_recipe_dir=True) %}
{% set project = pyproject['project'] %}

{% set name = project['name'] %}
{% set version = VERSION %}

package:
name: conda-project
version: {{ VERSION }}
name: {{ name|lower }}
version: {{ version }}

source:
path: ..

build:
script: {{ PYTHON }} -m pip install --no-deps --ignore-installed -vv .
script: {{ PYTHON }} -m pip install . -vv
noarch: python

entry_points:
{% for name, reference in pyproject['project']['scripts'].items() %}
{% for name, reference in project['scripts'].items() %}
- {{ name }} = {{ reference }}
{% endfor %}


requirements:
host:
- python {{ pyproject['project']['requires-python'] }}
- python {{ project['requires-python'] }}
- pip
- setuptools
run:
- python {{ pyproject['project']['requires-python'] }}
{% for dep in pyproject['project']['dependencies'] %}
- python {{ project['requires-python'] }}
{% for dep in project['dependencies'] %}
- {{ dep.lower() }}
{% endfor %}

Expand All @@ -33,9 +36,11 @@ test:
- conda_project
commands:
- conda-project --help
- conda-project --version
- python -c "import conda_project; ver = conda_project.__version__; assert ver != '0.0.0' and ver != 'unknown'"

about:
home: {{ pyproject['project']['urls']['repository'] }}
summary: {{ pyproject['project']['description'] }}
license: {{ pyproject['project']['license']['text'] }}
home: {{ project['urls']['repository'] }}
summary: {{ project['description'] }}
license: {{ project['license']['text'] }}
license_file: LICENSE
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies = [

[tool.setuptools_scm]
version_scheme = "post-release"
write_to = "src/conda_project/_version.py"

[project.optional-dependencies]
docs = [
Expand Down
6 changes: 4 additions & 2 deletions src/conda_project/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2022 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import importlib.metadata

__version__ = importlib.metadata.version("conda-project")
try:
from ._version import __version__
except ImportError:
__version__ = "unknown"

# flake8: noqa
from .exceptions import CondaProjectError
Expand Down