Phyton Should I put pyc files under version control? should python files be capitalized,how long should python files

You shouldn't. .pyc files contain bytecode, which can be different for different versions and implementation of Python.

Just add *.pyc line in your .gitignore or global gitignore.

Also take a look at the great collection of gitignore files for almost all platforms. You can use this one for your python projects:

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
Answer:1

These files are compiled versions of the code already in the repo, so that Python can execute the code faster. Since they are a direct computational result of the actual source code there's no benefit to checking them in - they'd just need to be updated every time the source code was updated. Also, there's no guarantee (to my knowledge) that different machines or versions of Python will generate compatible .pyc files, meaning distributing the .pyc files you generated could potentially break other people's environments.

Instead you could fix the .gitignore file to ignore .pyc files and commit that to your fork (or even back to the upstream repo). That way no one will notice or need to worry about these files in the future.

Answer:2

There isn't anything bad about the file, but it's useless junk, it's there only to speed up python application execution, and it's rebuilt every time you make changes, so it will just grow over time, to fix it you might want to add __pycache__ line to your .gitignore file

Answer:3



  1. should python files be capitalized
  2. how long should python files be

So, i trying to install with the command ecmwf api client conda install -c conda-forge ecmwf-api-client then the warning in the title shows up. I don't know how to proceede (base) C:\Users\caina>...

So, i trying to install with the command ecmwf api client conda install -c conda-forge ecmwf-api-client then the warning in the title shows up. I don't know how to proceede (base) C:\Users\caina>...

I'm trying to use Travis CI on a C library that uses custom python3-based build scripts. When the repository gets built, it fails on ./configure because configure uses Python 3, which isn't installed ...

I'm trying to use Travis CI on a C library that uses custom python3-based build scripts. When the repository gets built, it fails on ./configure because configure uses Python 3, which isn't installed ...