pypa / hatch Goto Github PK
View Code? Open in Web Editor NEWModern, extensible Python project management
Home Page: https://hatch.pypa.io/latest/
License: MIT License
Modern, extensible Python project management
Home Page: https://hatch.pypa.io/latest/
License: MIT License
Looking at the FAQ in the semver spec it looks like the initial version should be 0.1.0
or maybe 0.0.0
and not 0.0.1
as the initial PATCH level is 0
.
I can create a pull request to implement this.
Does hatch support tab completion as a CLI tool? Or this is in the plan?
The .
command has been deprecated for a long time in fish, and has been removed in recent versions. Setting fish
as shell in the hatch config and then executing hatch use
yields the following message with recent fish versions:
fish: The file “.” is not executable by this user
To remedy this, hatch should inject the source
command instead.
For now, manually running source <activate.fish filename seen above>
does the trick.
A quick glance at the code for hatch release
indicates that it only supports releasing to the standard PyPI server. It would be nice if hatch
supported releases to custom/private PyPI servers as well. Since hatch
already makes use of the TWINE_PASSWORD
environment variable (directly or indirectly), perhaps it would make the most sense to just support the full set of twine
environment variables (TWINE_USERNAME
, TWINE_REPOSITORY
, TWINE_REPOSITORY_URL
, and TWINE_CERT
) where it makes sense to do so. This could be as simple as not passing any of the corresponding flags to twine
and letting twine
determine the appropriate configuration on its own from the environment.
I'm thinking about automating the process of tagging a release and update git mirrors with something like hatch tag
to basically run the following.
$ git tag -s 0.1.1
$ git push gitlab 0.1.1
$ git push mirror 0.1.1
Hi there,
First off, thanks for creating hatch! For a long time, I've been confused by idempotent Python. I work in many languages, and so the particulars of a given language can sometimes escape me.
I assume your goal is to make Python development simpler. As such, it'd be fantastic if you could place a bit of a description (in the form of comments) at the top of setup.py
. I say this, since it seems like a few hundred StackOverflow users have also been mystified by this convention [0].
Thanks again!
0 : https://stackoverflow.com/questions/1471994/what-is-setup-py
hatch grow
is a useful utility, but I am seeing one limitation. I would expect to be able to go from a release build 0.0.1
to 0.0.2.rc1
. Then, when making a release, I would want to go from version 0.0.2.rc1
to 0.0.2
(i.e. the corresponding final release), make the release with hatch release
, and then change the version to 0.0.3.rc1
. This does not seem to be currently possible, since hatch grow
doesn't appear to support the move from the release candidate to the final release version. Perhaps some sort of hatch grow final
(which lobs off the existing patch and build versions) would make sense to add?
In general, though, the versioning pattern seems a bit backwards; running hatch grow pre
from version X.Y.Z
will update to version X.Y.Z.rc1
, which is really a shrinking instead of the version as opposed to a growing of it. Would others disagree? Perhaps a different command could be used? I'm not sure what the most appropriate fix is here.
$ hatch new test
Created project `test`
Creating its own virtual env... Traceback (most recent call last):
File "/home/kossak/anaconda3/lib/python3.6/site-packages/virtualenv.py", line 2328, in <module>
main()
File "/home/kossak/anaconda3/lib/python3.6/site-packages/virtualenv.py", line 713, in main
symlink=options.symlink)
File "/home/kossak/anaconda3/lib/python3.6/site-packages/virtualenv.py", line 945, in create_environment
download=download,
File "/home/kossak/anaconda3/lib/python3.6/site-packages/virtualenv.py", line 901, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/home/kossak/anaconda3/lib/python3.6/site-packages/virtualenv.py", line 797, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /tmp/1/test/venv/bin/python3.6 - setuptools pip wheel failed with error code 1
complete!
Installing locally in the virtual env... complete!
I use Linux Manjaro
$ python -VV
Python 3.6.2 | packaged by conda-forge | (default, Jul 23 2017, 22:59:30)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]
$ python3 -VV
Python 3.6.2 | packaged by conda-forge | (default, Jul 23 2017, 22:59:30)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]
Hello devs,
I was wondering if you would be interested in support for readme files in org-mode? I have half an implementation (badges do not work but are not crucial for my workflow right now).
If you are interested, I can wrap it up and prepare a PR soon.
@frenzymadness Please add yourself to https://github.com/ofek/hatch/blob/master/AUTHORS.rst
When I run hatch env bla
it gets created in the above mentioned folder. Using hatch use bla
always results in
/usr/local/bin/python: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ModuleNotFoundError: No module named 'virtualenvwrapper')
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/Users/jo/Library/Application Support/hatch/venvs/banksapi/bin/python and that PATH is
set properly.
How can I use the directories that you use? (~/.local/share...
)
Does Hatch support the src
layout (or any other custom name)?
Because a lot of major Python projects have switched to the src
layout now:
And a few major Python projects have adopted a non-conventional lib
layout:
OS X 10.12.6
9063 ◯ pip3.5 install hatch
Collecting hatch
Downloading hatch-0.9.0-py3-none-any.whl (83kB)
100% |████████████████████████████████| 92kB 634kB/s
Requirement already satisfied: atomicwrites in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: wheel>=0.27.0 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: pytest in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: setuptools>=36.0.0 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: click in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: colorama in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: coverage in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: pip>=9.0.1 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: semver>=2.7.8 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: twine>=1.9.1 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: virtualenv in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: pexpect in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: appdirs in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from hatch)
Requirement already satisfied: py>=1.4.33 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from pytest->hatch)
Requirement already satisfied: pkginfo>=1.0 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from twine>=1.9.1->hatch)
Requirement already satisfied: tqdm>=4.11 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from twine>=1.9.1->hatch)
Requirement already satisfied: requests-toolbelt>=0.8.0 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from twine>=1.9.1->hatch)
Requirement already satisfied: requests!=2.15,!=2.16,>=2.5.0 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from twine>=1.9.1->hatch)
Requirement already satisfied: ptyprocess>=0.5 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from pexpect->hatch)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from requests!=2.15,!=2.16,>=2.5.0->twine>=1.9.1->hatch)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from requests!=2.15,!=2.16,>=2.5.0->twine>=1.9.1->hatch)
Requirement already satisfied: idna<2.7,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from requests!=2.15,!=2.16,>=2.5.0->twine>=1.9.1->hatch)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from requests!=2.15,!=2.16,>=2.5.0->twine>=1.9.1->hatch)
Installing collected packages: hatch
Successfully installed hatch-0.9.0
MacBooks-MacBook-Pro-2 ॐ ~/Library/Caches:
9064 ◯ hatch env dk
Successfully saved virtual env `dk` to `/Users/a1/.virtualenvs/dk`.
MacBooks-MacBook-Pro-2 ॐ ~/Library/Caches:
9065 ◯ hatch use dk
source "/Users/a1/.virtualenvs/dk/bin/activate"
(dk)MacBooks-MacBook-Pro-2 ॐ ~/Library/Caches:
9066 ◯ source "/Users/a1/.virtualenvs/dk/bin/activate"
(dk) (dk)MacBooks-MacBook-Pro-2 ॐ ~/Library/Caches:
9067 ◯
Currently hatch includes the files under the tests directory in the coverage result as well.
I don't see any added value for that, is it possible to remove all the files under the tests directory from the results?
From the README:
$ git clone https://github.com/ofek/privy && cd privy
$ hatch test -c
========================= test session starts ==========================
platform linux -- Python 3.5.2, pytest-3.2.1, py-1.4.34, pluggy-0.4.0
rootdir: /home/ofek/privy, inifile:
plugins: xdist-1.20.0, mock-1.6.2, httpbin-0.0.7, forked-0.2, cov-2.5.1
collected 10 items
tests/test_privy.py ..........
====================== 10 passed in 4.34 seconds =======================
Tests completed, checking coverage...
Name Stmts Miss Branch BrPart Cover Missing
-----------------------------------------------------------------
privy/__init__.py 1 0 0 0 100%
privy/core.py 30 0 0 0 100%
privy/utils.py 13 0 4 0 100%
tests/__init__.py 0 0 0 0 100%
tests/test_privy.py 57 0 0 0 100%
-----------------------------------------------------------------
TOTAL 101 0 4 0 100%
Per #14:
Closing this, as Hatch itself will use Pipfiles soon!
Is there a target date or version number for Pipfile support?
Hi, I am using hatch with Mac OSX. There are two issues here. I have checked the sourced code. I found that when hatch open sub zsh, it will open sub process with PATH and PROMPT added. When it is a pure zsh without any plugin. It works really good.
But when there are oh-my-zsh and pyenv. Issue happens.
pyenv will do pyenv init
in .zshrc file. It will change PATH to $HOME/.pyenv/shims:$PATH
. So the PATH set by hatch is overwritten.
Similar as previous one. oh-my-zsh usually set PROMPT to make zsh looks beautiful. But it also set this inside .zshrc
file.
Any thought?
powerful environment manager, better than virtualenv in my eyes
what do you think?
Hi,
I noticed that the project says that it replaces a whole multitude of tools, including pyenv
.
Does this indicate that you'd recommend using this as the sole python package in the global python package space? Or could hatch
be safely used from within a virtualenv that was produced by pyenv? (I'm not sure if hatch modifies $PATH
or any other environment variables from quickly browsing the project).
I understand the project is in its infancy, but I thought I could submit a PR at some point. So I opened this issue in the hopes that we can discuss your expectations of how the program should work, and hence what the tests should test for.
pytest reports 1 invalid escape sequence in the code, and lots in the test modules.
[ 345s] hatch/commands/shed.py:49
[ 345s] /home/abuild/rpmbuild/BUILD/hatch-0.20.0/hatch/commands/shed.py:49: DeprecationWarning: invalid escape sequence \/
[ 345s] """
[ 345s]
[ 345s] tests/test_venv.py:117
[ 345s] /home/abuild/rpmbuild/BUILD/hatch-0.20.0/tests/test_venv.py:117: DeprecationWarning: invalid escape sequence \.
[ 345s] " sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])\n"
[ 345s]
[ 345s] tests/test_venv.py:134
[ 345s] /home/abuild/rpmbuild/BUILD/hatch-0.20.0/tests/test_venv.py:134: DeprecationWarning: invalid escape sequence \.
[ 345s] " sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])\n"
[ 345s]
[ 345s] tests/test_venv.py:152
[ 345s] /home/abuild/rpmbuild/BUILD/hatch-0.20.0/tests/test_venv.py:152: DeprecationWarning: invalid escape sequence \.
[ 345s] " sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])\n"
[ 345s]
[ 345s] tests/test_venv.py:169
[ 345s] /home/abuild/rpmbuild/BUILD/hatch-0.20.0/tests/test_venv.py:169: DeprecationWarning: invalid escape sequence \.
[ 345s] " sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])\n"
[ 345s]
[ 345s] tests/test_venv.py:187
[ 345s] /home/abuild/rpmbuild/BUILD/hatch-0.20.0/tests/test_venv.py:187: DeprecationWarning: invalid escape sequence \.
[ 345s] " sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])\n"
[ 345s]
[ 345s] tests/test_venv.py:204
[ 345s] /home/abuild/rpmbuild/BUILD/hatch-0.20.0/tests/test_venv.py:204: DeprecationWarning: invalid escape sequence \.
[ 345s] " sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])\n"
[ 345s]
[ 345s] tests/test_venv.py:222
[ 345s] /home/abuild/rpmbuild/BUILD/hatch-0.20.0/tests/test_venv.py:222: DeprecationWarning: invalid escape sequence \.
[ 345s] " sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])\n"
[ 345s]
[ 345s] tests/test_venv.py:239
[ 345s] /home/abuild/rpmbuild/BUILD/hatch-0.20.0/tests/test_venv.py:239: DeprecationWarning: invalid escape sequence \.
[ 345s] " sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])\n"
Hatch seems to support a narrow range of licenses, it would be nice if more licenses were included.
doesn't support python2?
Hello.
I am trying to package Hatch for Fedora and I have some troubles with tests. First (and IMHO the biggest one) is that build of RPM package is done in the restricted environment without access to the internet. But build environment has more restrictions and I don't know Hatch that much that I can fix or skip all of failing tests.
The thing I can do is to check if internet connection is present and if not, skip tests depending on them. What do you think about it?
Could you please help me fix (or find a reason/condition to skip) the rest of failing tests?
Thank you and have a nice day.
Full output: build_tests.txt
I'm using ntfy (https://github.com/dschep/ntfy) with bash and invoking hatch shell breaks it. Every new prompt is accompanied by:
__bp_precmd_invoke_cmd: command not found
Also, it doesn't seem to respect VIRTUAL_ENV_DISABLE_PROMPT.
Hello,
I think the new update might have broken something on Ubuntu 18.04.3. After a pip3 install --user hatch
I attempt to run hatch --help
and get the following error message:
Traceback (most recent call last):
File "/home/kyle/.local/bin/hatch", line 5, in <module>
from hatch.cli import hatch
File "/home/kyle/.local/lib/python3.6/site-packages/hatch/cli.py", line 3, in <module>
from hatch.commands import (
ModuleNotFoundError: No module named 'hatch.commands'
If I go to ~/.local/lib/python3.6/site-packages/hatch
, here is the output I get from running tree
:
├── build.py
├── clean.py
├── cli.py
├── conda.py
├── config.py
├── create.py
├── env.py
├── exceptions.py
├── grow.py
├── __init__.py
├── __main__.py
├── project.py
├── __pycache__
│ ├── build.cpython-36.pyc
│ ├── clean.cpython-36.pyc
│ ├── cli.cpython-36.pyc
│ ├── conda.cpython-36.pyc
│ ├── config.cpython-36.pyc
│ ├── create.cpython-36.pyc
│ ├── env.cpython-36.pyc
│ ├── exceptions.cpython-36.pyc
│ ├── grow.cpython-36.pyc
│ ├── __init__.cpython-36.pyc
│ ├── __main__.cpython-36.pyc
│ ├── project.cpython-36.pyc
│ ├── settings.cpython-36.pyc
│ ├── shells.cpython-36.pyc
│ ├── structures.cpython-36.pyc
│ ├── utils.cpython-36.pyc
│ └── venv.cpython-36.pyc
├── settings.py
├── shells.py
├── structures.py
├── utils.py
└── venv.py
This differs from the output of running tree
from within the hatch
directory of a freshly clone git repo, which is
.
├── build.py
├── clean.py
├── cli.py
├── commands
│ ├── build.py
│ ├── clean.py
│ ├── conda.py
│ ├── config.py
│ ├── env.py
│ ├── grow.py
│ ├── __init__.py
│ ├── init.py
│ ├── install.py
│ ├── new.py
│ ├── pypath.py
│ ├── python.py
│ ├── release.py
│ ├── shed.py
│ ├── shell.py
│ ├── test.py
│ ├── uninstall.py
│ ├── update.py
│ └── utils.py
├── conda.py
├── config.py
├── create.py
├── env.py
├── exceptions.py
├── files
│ ├── ci
│ │ ├── __init__.py
│ │ ├── tox.py
│ │ └── travis.py
│ ├── coverage
│ │ ├── codecov.py
│ │ ├── coveragerc.py
│ │ └── __init__.py
│ ├── ignore
│ │ ├── git.py
│ │ └── __init__.py
│ ├── __init__.py
│ ├── licenses
│ │ ├── apache2.py
│ │ ├── cc0.py
│ │ ├── __init__.py
│ │ ├── mit.py
│ │ └── mpl.py
│ ├── pyproject.py
│ ├── readme
│ │ ├── __init__.py
│ │ ├── markdown.py
│ │ └── restructuredtext.py
│ ├── setup.py
│ └── vc
│ ├── git.py
│ └── __init__.py
├── grow.py
├── __init__.py
├── __main__.py
├── project.py
├── settings.py
├── shells.py
├── structures.py
├── utils.py
└── venv.py
The git repo appears to have a commands
directory, which is a proper module. Maybe something went wrong with the packaging process on PyPI?
Currently, the only way to really run hatch test
in the project's virtualenv
is by running hatch shell . pip install hatch
followed by hatch shell . hatch test
. This is a little awkward to use. It would be nice if there was some sort of -env
flag for hatch test
that could cause it to run inside of a virtualenv
. Presumably it would need to install hatch
(or just the tests_require
dependencies) inside of the virtualenv
to facilitate this, but that seems reasonable enough.
(The intuition here being that, since hatch install
automatically manages the virtualenv
, it would stand to reason that hatch test
should too)
Currently hatch only allows users to create virtual envs (using hatch env
).
In order to delete an environment the user must manually delete the environment from ~/.virtualenvs.
It would be nice to have a delete command to manage this directly from hatch
When running hatch new --cli mypackage
the default entry_point
can conflict with import mypackage
'console_scripts': ['{pn} = {pnn}.cli:{pnn}']
Any thoughts on changing this to 'console_scripts': ['{pn} = {pnn}.cli:cli']
so __main__
calls cli()
instead of mypackage()
?
If so, I can generate a PR and make the default version of cli.py
a little more click
-ish
hey,
are you looking for contributors? do you have any item that i can start off with?
Python 3.6.1 on OS X 10.11.6, bash 4.4.12 in iTerm2 and Terminal
Installed hatch, created new project, created new env, used new env, CPU use (in htop) for "hatch use " shot up to 100% and stayed there until I exited the env. The shell was not doing anything during this. I tried a few times with different envs (python 3.6, 3.5, 2.7) with the same result. Each time I waited a minute or so just in case there was some initialization going on but the usage never came down and the load kept going up.
I normally use iTerm2, but to verify my findings I rechecked in Terminal and got this error after "hatch use ":
bash: no job control in this shell
CPU use of 100% was unchanged.
I can't install hatch
on my local machine.
I'm using Python 3.6.4 as primary python version
.
Shows error like as below:
Downloading/unpacking hatch
Downloading hatch-0.20.0.tar.gz (70kB): 70kB downloaded
Running setup.py (path:/tmp/pip_build_root/hatch/setup.py) egg_info for package hatch
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/hatch/setup.py", line 11, in <module>
with open('README.rst', 'r', encoding='utf-8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/hatch/setup.py", line 11, in <module>
with open('README.rst', 'r', encoding='utf-8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/hatch
Storing debug log for failure in /home/desktop/.pip/pip.log
Running hatch clean
gives the following error when venv
is a virtual environment in the project directory:
Traceback (most recent call last):
File "/Users/pblair/views/test-project/venv/lib/python3.6/site-packages/hatch/utils.py", line 124, in remove_path
shutil.rmtree(path)
File "/Users/pblair/views/test-project/venv/lib/python3.6/shutil.py", line 480, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/Users/pblair/views/test-project/venv/lib/python3.6/shutil.py", line 438, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/Users/pblair/views/test-project/venv/lib/python3.6/shutil.py", line 436, in _rmtree_safe_fd
os.unlink(name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: '__init__.cpython-36.opt-1.pyc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/pblair/views/test-project/venv/bin/hatch", line 11, in <module>
sys.exit(hatch())
File "/Users/pblair/views/test-project/venv/lib/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/Users/pblair/views/test-project/venv/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Users/pblair/views/test-project/venv/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/pblair/views/test-project/venv/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/pblair/views/test-project/venv/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Users/pblair/views/test-project/venv/lib/python3.6/site-packages/hatch/commands/clean.py", line 77, in clean
removed_paths = clean_package(path, editable=package or local)
File "/Users/pblair/views/test-project/venv/lib/python3.6/site-packages/hatch/clean.py", line 76, in clean_package
remove_path(p)
File "/Users/pblair/views/test-project/venv/lib/python3.6/site-packages/hatch/utils.py", line 127, in remove_path
os.remove(path)
PermissionError: [Errno 13] Permission denied: '/Users/pblair/views/test-project/venv/lib/python3.6/importlib/__pycache__'
I'm thinking that the hatch clean
implementation should check for the VIRTUAL_ENV
variable, automatically ignore $ROOT/venv
, and perhaps even allow manual excludes to be passed.
First, this project is awesome and I'm loving it so far.
This is more of a feature request than an actual issue, but I was thinking it would be really cool if hatch could optionally integrate with conda. Perhaps one could switch between "conda mode" and "normal mode" where hatch env
, hatch install
, etc. are just wrappers around the relevant conda commands.
The main benefit from this is consolidation, instead of having to manually manage two sets of virtual environments (ones generated by conda and ones generated by hatch), everything could just be managed through hatch. The second benefit is that install will pull from the conda repos instead of PyPI repos, which tends to have nicely optimized data analysis packages.
I did try just configuring hatch to put its virtual environments under ~/miniconda/envs, but conda didn't pick them up for some reason (I think because conda expects some additional metadata and environment structure).
In the future, it might also be really neat to integrate with Anaconda Project. Apparently the API isn't stable yet though :(
If this is a pain, or otherwise a silly request, feel free to say so.
Thanks!
Love this tool. Is there a possibility to integrate https://github.com/kennethreitz/pipenv into the workflow, so that maybe during new
/init
hatch creates a Pipfile{,.lock}
and uses it instead?
Hi @ofek
Thanks again for this magnificent project! I have a quick question, which is, how are we suppose to track requirements?
I noticed the requirements.txt
file is a little different than I'm used to seeing:
(venv) my-computer:tests blong$ cat requirements.txt
-e .
I also noticed, I can install pip
dependencies using hatch
, like so:
(venv) my-computer:tests blong$ hatch install opencv-python
Installing...
Collecting opencv-python
Using cached opencv_python-3.3.0.10-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting numpy>=1.11.1 (from opencv-python)
Downloading numpy-1.13.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.5MB)
100% |████████████████████████████████| 4.6MB 324kB/s
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.13.1 opencv-python-3.3.0.10
Does this mean I am supposed to track dependencies (for now) using pip freeze > requirements.txt
or is there some better process?
Is it possible to change the location of the config file?
hatch config
Settings location: /Users/mbaechtold/Library/Application Support/hatch/settings.json
Is there a reason the config file is in
~/.local/share/hatch/settings.json
instead of
~/.config/hatch/settings.json
aka $XDG_CONFIG_HOME/hatch/settings.json
Hello, thank you for doing great job!
Testing on xubuntu 16.04, however shows that .deb pkg required for virtualenv:
app1@jm:~/prj-ex$ hatch env dk
Traceback (most recent call last):
File "/usr/local/bin/hatch", line 11, in <module>
sys.exit(hatch())
File "/home/app1/.local/lib/python3.5/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/app1/.local/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/app1/.local/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/app1/.local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/app1/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/hatch/cli.py", line 1194, in env
create_venv(venv_dir, pypath, verbose=verbose)
File "/usr/local/lib/python3.5/dist-packages/hatch/venv.py", line 69, in create_venv
subprocess.run(command, shell=NEED_SUBPROCESS_SHELL)
File "/usr/lib/python3.5/subprocess.py", line 693, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'virtualenv'
app1@jm:~/prj-ex$ virtualenv
The program 'virtualenv' is currently not installed. You can install it by typing:
sudo apt install virtualenv
app1@jm:~/prj-ex$
What is a good way to add this depency to setup.py?
https://github.com/theacodes/nox is the new tox ;-)
When running hatch install -l
, the following error appears:
Installing...
Obtaining file:///Users/pblair/views/test-project
Installing collected packages: test-project
Running setup.py develop for test-project
Complete output from command /opt/local/bin/python3 -c "import setuptools, tokenize;__file__='/Users/pblair/views/test-project/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps:
running develop
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/test-easy-install-67789.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://setuptools.readthedocs.io/en/latest/easy_install.html
Please make the appropriate changes for your system and try again.
The problem appears to be in the virutualenv
handling:
λ test-project git:(master) ✗ > hatch shell . pip --version
Running `pip --version` in this project's env...
pip 9.0.1 from /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)
λ test-project git:(master) ✗ > . ./venv/bin/activate && pip --version && deactivate
pip 9.0.1 from /Users/pblair/views/test-project/venv/lib/python3.6/site-packages (python 3.6)
λ test-project git:(master) ✗ >
Further investigation seems to indicate that the culprit is the __PYENV_LAUNCHER__
variable:
λ test-project git:(master) ✗ > hatch shell . env | grep LAUNCHER
__PYVENV_LAUNCHER__=/opt/local/bin/python3
λ test-project git:(master) ✗ > . ./venv/bin/activate && (env | grep LAUNCHER) && deactivate
And, sure enough, unsetting it manually fixes the issue:
λ test-project git:(master) ✗ > hatch shell .
source "/Users/pblair/views/test-project/venv/bin/activate"
λ test-project git:(master) ✗ > source "/Users/pblair/views/test-project/venv/bin/activate"
(venv) λ test-project git:(master) ✗ > pip --version
pip 9.0.1 from /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)
(venv) λ test-project git:(master) ✗ > unset __PYVENV_LAUNCHER__
(venv) λ test-project git:(master) ✗ > env | grep LAUNCHER
(venv) λ test-project git:(master) ✗ > pip --version
pip 9.0.1 from /Users/pblair/views/test-project/venv/lib/python3.6/site-packages (python 3.6)
(venv) λ test-project git:(master) ✗ >
Would it be possible to add a del os.environ["__PYVENV_LAUNCHER__"]
in the venv
code to remedy this problem?
I could be wrong but it seems to only support one project layout which is regardless of the other features, a complete showstopper for me.
Is significant enhancement of this functionality likely to be accepted/merged?
I currently consider https://github.com/ionelmc/cookiecutter-pylibrary my standard starting point for any project. However extending cookiecutter is not trivial, its just not in the design (currently) and one of the primary motivations for starting to write my own tool similar to Hatch, was to be able to have extensibility so that I can extend and enhance my personal project template without it turning into https://github.com/pydanny/cookiecutter-django which has in my opinion grown far too complex, and is once again, in my own own opinion, beginning to 'fall apart'.
Would a modular project template mechanism be a welcome addition?
Would be nice to see pylint integrated into hatch in a future release.
I would like the ability to load a .env file in my project with hatch shell
The reason is I set some test or production variables in this file which are needed as environment variables.
I've seen that many projects have this folder venv
where they keep their virtual environment. While that's cool because for structural reasons, it's not as nice to see (venv)
at the beginning of the prompt line, for all of your virtual envs.
I usually create virtual environments like this:
$ virtualenv my-project
$ ln -s venv my-project
This way, there is a good old standard venv
folder (for using in paths), but then when you activate, the prompt you see is not
(venv) user@host :~/path$
but
(my-project) user@host: ~/path$
This is much nicer, and actually quite important for people working with many projects/virtual environments (as me :) ). It's not necessary to have a symbolic link. One could create a virtualenv like this
$ python -m virtualenv my-project
$ mv my-project venv
This way we only have the venv
folder in the end, but when activating it, it automatically uses a good name.
I did investigate whether there is an option to pass to python -m virtualenv
so that it knows that the destination folder and the virtual env names are different, but there is no such option. Moreover, the name is very deeply hardcoded as the folder name. Still the workarounds I provided could be a source of inspiration 😄
I also did try fiddling with the configuration file, where I found an option venv_dir
... That didn't seem to do anything though (or at least not what I had hoped - to make the prompt more explicit when I activate the venv).
Anyway, I am sorry for being lazy and not making a PR with the feature, but I think it's a good feature to have, and maybe if you have time, you'll get to it 😄 - or maybe I get less lazy at some point and try to help with a PR.
Thanks,
Sorry for being lazy,
Cool project. I'm evaluating/playing with it, keep on the god work!
I am running Python 3.5.2, Ubuntu 16.04 and zsh 5.1.1.
I can create a new virtual environment fine, but running 'hatch use <env_name>' does not activate the environment - It doesn't throw any errors either, it just doesn't activate.
@amjith Please add yourself to https://github.com/ofek/hatch/blob/master/AUTHORS.rst
As per SO the following needs to be added to setup() for PyPI to correctly render.
long_description_content_type='text/markdown'
Update:
This solved my PyPI README markdown rendering issue.
At some point I'll look at putting together a pull request.
CI is failing with
HTTPError: 400 Client Error: User 'Ofekmeister' does not have a verified primary email address. Please add a verified primary email before attempting to upload to PyPI. See https://test.pypi.org/help/#verified-email for more information.for more information. for url: https://test.pypi.org/legacy/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.