When can I use python 3 instead of python 2?

Now, python2 is to old, code compatibility is poor.

Will the new release FreeBSD 12.0-CURRENT update it?

Is there a plan? :)
 
There is still lots of python 2 code around that will not be updated any time soon. For the time being (at least a few years), computers will need both python 2 and 3 installed.

You can use python 3 for your code right now. Matter-of-fact, a good starting point for that would be: (a) start using the print function in python 2 code, and (b) try mechanically translating your code using 2to3 and testing the python 3 version. In many cases, it will just work.
 
Now, python2 is to old, code compatibility is poor.

Will the new release FreeBSD 12.0-CURRENT update it?

Is there a plan? :)

I am not following your question. Python is not the part of FreeBSD (as it is used for/as a main system scripting language on RHEL). Both branches 2.7.xxx and 3.6.xxx in the ports tree are up to date just like packages. I subscribed to a point of view that Python 2 and Python 3 are two different programming languages that commonly get clamped together just like C and C++ due to the somewhat common syntax. Just like I have never met anybody who is truly great programmer in C and C++, I never met truly grate Pythonist who is mixing two branches of Python. The current rule of the thumb if you are going to use Python for scientific programming (the only thing I am familiar with) is to go with Python 3.6.xxx if you are starting from a scratch. If you are going to support some legacy code (there is a tons of Python 2.7.xxx code which is never going to be rewritten in Python 3.6.xxx) or reuse large chunks of already existing 2.7.xxx code go with 2.7 branch.

Unlike few years ago all major Python libraries used in scientific computing nowadays are ported to 3.6.xxx and well tested so there is no real reason to write a fresh code with old Python language. The difference in the syntax is the least of the problems. The true reason behind my recommendation is the difference in the interpreter itself and internal optimization.

If you were going to use Python for system administration I recommend neither 2.7.xxx nor 3.6.xxx. You should be using Perl 5.
 
Now, python2 is to old, code compatibility is poor.

Will the new release FreeBSD 12.0-CURRENT update it?

Is there a plan? :)
Use the version you like best.
FreeBSD is not prejudice. It gives you both. :)

Happy Pythoning!

--Chris

P.S. For your reported needs, you might want to add the following to your make.conf(5)
Code:
DEFAULT_VERSIONS+=python3=3.6

Hope this helps!
 
Will the new release FreeBSD 12.0-CURRENT update it?
All versions on all architectures use the exact same ports tree. Which means that versions and defaults of applications in the ports tree have no relation to the FreeBSD version or architecture.
 
My freebsd have many python 2.7 packages:
Code:
[brian@freebsd] /usr/ports% pkg info | grep py2
py27-Babel-2.5.3               Collection of tools for internationalizing Python applications
py27-Jinja2-2.10               Fast and easy to use stand-alone template engine
py27-MarkupSafe-1.0            Implements XML/HTML/XHTML Markup safe string for Python
py27-alabaster-0.7.6           Modified Kr Sphinx theme
py27-asn1crypto-0.22.0         ASN.1 library with a focus on performance and a pythonic API
py27-certifi-2018.4.16         Mozilla SSL certificates
py27-cffi-1.11.5               Foreign Function Interface for Python calling C code
py27-chardet-3.0.4             Universal encoding detector for Python 2 and 3
py27-cryptography-2.2.2        Cryptographic recipes and primitives for Python developers
py27-docutils-0.14_3           Python Documentation Utilities
py27-enum34-1.1.6              Python 3.4 Enum backported to 3.3, 3.2, 3.1, 2.7
py27-idna-2.6                  Internationalized Domain Names in Applications (IDNA)
py27-imagesize-0.7.1           Python image size library
py27-ipaddress-1.0.22          Port of Python 3.3+ ipaddress module to 2.7
py27-openssl-17.5.0_1          Python interface to the OpenSSL library
py27-pycparser-2.18            C parser in Python
py27-pygments-2.2.0            Syntax highlighter written in Python
py27-pysocks-1.6.8             Python SOCKS module
py27-pystemmer-1.3.0_1         Snowball Stemming Algorithms for Information Retrieval
py27-pytest-runner-2.11.1      Test support for pytest runner in setup.py
py27-pytz-2018.4,1             World Timezone Definitions for Python
py27-requests-2.18.4           HTTP library written in Python for human beings
py27-setuptools-39.2.0         Python packages installer
py27-setuptools_scm-1.17.0     Setuptools plugin to manage your versions by scm tags
py27-six-1.11.0                Python 2 and 3 compatibility utilities
py27-snowballstemmer-1.2.0_1   Snowball stemming library collection for Python
py27-sphinx-1.6.5_1,1          Python documentation generator
py27-sphinx_rtd_theme-0.2.4    Mobile-friendly py-sphinx theme
py27-sphinxcontrib-websupport-1.0.1 Sphinx API for Web Apps
py27-typing-3.6.4              Type Hints for Python
py27-urllib3-1.22              HTTP library with thread-safe connection pooling, file post, and more
 
Your last post is a bit vague. But if you're asking what you need for Python 2.7, it's lang/python27.

Many ports will already have Python 2.7 as a dependency, so it's very likely to be already installed on your machine.

If you need something more modern and much saner, then also install Python 3 for your everyday script programming. You can have both versions side by side. Python 3 is the future, no matter what people here and there think about it and no matter how many developers delay its adoption as a dependency for their applications.
 
My freebsd have many python 2.7 packages:
Code:
[brian@freebsd] /usr/ports% pkg info | grep py2
py27-Babel-2.5.3               Collection of tools for internationalizing Python applications
py27-Jinja2-2.10               Fast and easy to use stand-alone template engine
...
py27-sphinxcontrib-websupport-1.0.1 Sphinx API for Web Apps
py27-typing-3.6.4              Type Hints for Python
py27-urllib3-1.22              HTTP library with thread-safe connection pooling, file post, and more
If you're concerned about pulling in python2, as you'd prefer python3. You can simply use FLAVOR(s), eg;
make FLAVOR=python3
This won't necessairly work for all of them. But, at this point in time, almost all of them.
HTH

--Chris
 
If you're concerned about pulling in python2, as you'd prefer python3. You can simply use FLAVOR(s), eg;
make FLAVOR=python3

I've also got all these py27- ports, pulled in to make some other port compile as I'm not using them explicitly. What's the best way to get them to automatically update to python3? I've tried to uninstall python27 and it always comes back when I try to reinstall other things. From what I've read, I should have left it alone, but I'm still not sure how to get all these py27- things up to speed.
 
OK, I think I can answer my own question here. Removing the py27- ports didn't seem to affect many other ports, so I just took them out along with devel/llvm60 which didn't seem to be needed by anything to run, only to build. For the record, I also had devel/llvm50 which I also removed.

Then I reinstalled llvm60 and it pulled down the same python-related related ports, but with the py36- prefix. So I think that explains why I had all those ports in the first place, and what needed to be done to update them. There might be a more direct route, but this was a relatively simple fix and makes sense to me.

Hopefully this will help future Googlers looking for answers.
 
Back
Top