Comments (13)
@nicoddemus Sure! :) I'll see what I can do.
@marcelotrevisani Sure, unix === linux or osx
, right.
from conda-devenv.
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.
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.
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.
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.
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.
Agreed to all those. Should be a nice first contribution if you are inclined @allanleal. 😉
from conda-devenv.
I think would be useful to have an unix
variable instead of doing linux or osx
from conda-devenv.
@tadeu Nice list as a reference for what should be supported.
from conda-devenv.
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.
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.
Looks good! The py*
variables should not go in as mentioned. 👍
from conda-devenv.
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)
- Incorrect rendering of pip dependencies with flags HOT 2
- Add ability to read devenv.yml from URL HOT 3
- Channel order should be respected (and maybe also pip dependency order) HOT 1
- Including several editable pip installs generates a wrong requirements line HOT 2
- ~leave_here alias for 'not is_included' HOT 6
- enable selectors syntax in includes section HOT 1
- How to update the environment variables only? HOT 2
- option to pass args to conda HOT 3
- use conda env config vars set HOT 2
- activation script not set when using alt filename HOT 1
- feature: 'included_by' list HOT 2
- mamba devenv is not using mamba HOT 4
- Add type annotations HOT 1
- Proposal: pins/run_constrained support HOT 8
- dep key items unintended merging HOT 6
- inconsistent 'schema' when merging with non-pip HOT 1
- conda-lock --update stripping auth environment variables HOT 1
- Support for constrained/optional dependencies
- Fix readthedocs documentation generation
- python-dotenv support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conda-devenv.