Git Product home page Git Product logo

Comments (13)

allanleal avatar allanleal commented on June 16, 2024 2

@nicoddemus Sure! :) I'll see what I can do.
@marcelotrevisani Sure, unix === linux or osx, right.

from conda-devenv.

tadeu avatar tadeu commented on June 16, 2024 1

Awesome idea!

conda build has these selectors: https://conda.io/projects/conda-build/en/latest/source/define-metadata.html#preprocessing-selectors, we can try to keep conda-devenv compatible as more variables are added.

from conda-devenv.

prusse-martin avatar prusse-martin commented on June 16, 2024 1

I will suggest to left out py27, py34, py35, and py36.

py27 | True if the Python version is 2.7. Use of this selector is discouraged in favor of comparison operators (e.g. py==27).

from conda-devenv.

prusse-martin avatar prusse-martin commented on June 16, 2024 1

Yes you are right. I say we drop all python (and numpy) related vars. Since to the environment being created the info from the root (base) environment is not really useful and can became confusing.

from conda-devenv.

prusse-martin avatar prusse-martin commented on June 16, 2024

AFAIK it is just a question of adding those booleans to jinja_dict in the function render_jinja so they are avalable durring jinja rendering.

from conda-devenv.

allanleal avatar allanleal commented on June 16, 2024

In addition, a string variable arch or architecture that gets set to '64bit' or '32bit', by a call to platform.architecture()[0], would be useful.

from conda-devenv.

nicoddemus avatar nicoddemus commented on June 16, 2024

Agreed to all those. Should be a nice first contribution if you are inclined @allanleal. 😉

from conda-devenv.

marcelotrevisani avatar marcelotrevisani commented on June 16, 2024

I think would be useful to have an unix variable instead of doing linux or osx

from conda-devenv.

allanleal avatar allanleal commented on June 16, 2024

@tadeu Nice list as a reference for what should be supported.

from conda-devenv.

nicoddemus avatar nicoddemus commented on June 16, 2024

I will suggest to left out py27, py34, py35, and py36.

Definitely. When we are parsing the devenv file, we don't actually know which is the Python version which will be used to create the environment, because the target environmnt's Python is defined in the devenv file itself.

from conda-devenv.

allanleal avatar allanleal commented on June 16, 2024

Below is how jinja_dict could be modified to include the preprocessing selectors used by conda-build:

pyversion = platform.python_version().split('.')

iswin = sys.platform.startswith('win')
islinux = sys.platform.startswith('linux')
isosx = sys.platform.startswith('darwin')

is32bit = '32bit' == platform.architecture()[0]
is64bit = not is32bit

jinja_dict = {
    "root": os.path.dirname(os.path.abspath(filename)),
    "os": os,
    "sys": sys,
    "platform": platform,
    "x86": 'x86' == platform.machine(),
    "x86_64": 'x86_64' == platform.machine(),
    "linux": islinux,
    "linux32": islinux and is32bit,
    "linux64": islinux and is64bit,
    "armv6l": None,
    "armv7l": None,
    "ppc64le": None,
    "osx": isosx,
    "unix": islinux or isosx,
    "win": iswin,
    "win32": iswin and is32bit,
    "win64": iswin and is64bit,
    "py": int(pyversion[0] + pyversion[1]),
    "py2k": pyversion[0] == 2,
    "py3k": pyversion[0] == 3,
    "py27": pyversion[0] == 2 and pyversion[1] == 7,
    "py34": pyversion[0] == 3 and pyversion[1] == 4,
    "py35": pyversion[0] == 3 and pyversion[1] == 5,
    "py36": pyversion[0] == 3 and pyversion[1] == 6
}

Missing selectors are armv6l, armv7l, and ppc64le (I'lll have to research more :)). We can remove the pyXY variables as requested by @prusse-martin .

Comments welcome.

from conda-devenv.

nicoddemus avatar nicoddemus commented on June 16, 2024

Looks good! The py* variables should not go in as mentioned. 👍

from conda-devenv.

edisongustavo avatar edisongustavo commented on June 16, 2024

I know the discussion is over already, but I'd just like to add that add anything that is "package related" should NOT be added in these selectors.

The main reason is that these kind of selectors (package related) might not make sense in some environments, leading to confusion.

For example:

packages:
  - cmake  # [py3]

(environment.devenv.yml)

What would happen if I call conda devenv ? Remember that there is no python being installed in this environment. Will the environment be empty?

It would just lead to confusion. So good call there @prusse-martin .

from conda-devenv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.