Coder Social home page Coder Social logo

aactivator's People

Contributors

asottile avatar benbariteau avatar chriskuehl avatar dbgrigsby avatar kennydo avatar mesozoic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aactivator's Issues

Formula for installation via homebrew

Would be nice to brew install aactivator

Here is a working forumla for doing so:

class Aactivator < Formula
  desc "Automatically source and unsource a project's environment"
  homepage "https://github.com/Yelp/aactivator"
  url "https://github.com/Yelp/aactivator/archive/v1.0.0.tar.gz"
  sha256 "395430f9dbabd2644a030d534761899165e2d5c8cb5aa71bf620808543cdfb02"

  include Language::Python::Virtualenv
  depends_on :python if MacOS.version <= :snow_leopard

  def install
    virtualenv_install_with_resources
  end

  def caveats; <<-EOS.undent
    To add aactivator to your shell, add the following line to your .bashrc or .zshrc:

       eval "$(aactivator init)"

    More information: https://github.com/Yelp/aactivator
    EOS
  end

  test do
    assert_match "aactivator", shell_output("#{bin}/aactivator -h")
  end
end

Does anyone have any objections to me submitting this to homebrew?

Add fish shell support

It would be nice to add support for fish shell users. This would require targeting a different virtualenv activation script (activate.fish) and using fish syntax for the output eval command.

If fully supporting fish is too much scope, then maybe we can expose additional sub-commands (like security-check) that will enable fish users to implement remainder of the logic.

If you're receptive to this idea, I can investigate further once we decide on general direction.

Python 3.11/3.13 compatibility issue with pipes

Problem:

precmd_aactivator causes the following warning if #!/usr/bin/env python3 evals to python 3.11 or newer:

/usr/bin/aactivator:35: DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
  from pipes import quote

Reference: python 3.11 docs

Navigating to paths with unicode characters in py27 causes exception

When I navigate into a path with unicode in the name, I get the following error:

$ cd ~/妹; pwd
/Users/kedo/妹
Traceback (most recent call last):
  File "/usr/local/bin/aactivator.py", line 342, in <module>
    sys.exit(main())
  File "/usr/local/bin/aactivator.py", line 334, in main
    print(aactivator(tuple(sys.argv), os.environ.copy()))
  File "/usr/local/bin/aactivator.py", line 323, in aactivator
    return get_output(env, arg0=args[0])
  File "/usr/local/bin/aactivator.py", line 304, in get_output
    activate_path = config.find_allowed(pwd)
  File "/usr/local/bin/aactivator.py", line 221, in find_allowed
    return first(search_parent_paths(path), self.is_allowed)
  File "/usr/local/bin/aactivator.py", line 89, in first
    if predicate(x):
  File "/usr/local/bin/aactivator.py", line 224, in is_allowed
    activate = os.path.join(path, ACTIVATE)
  File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 73, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 12: ordinal not in range(128)

I tried to get a branch working to support unicode, but making code + tests compatible with both py2 and py3 without requiring third party libraries caused great anguishment.

To anyone else facing this issue, changing first line from #!/usr/bin/env python2.7 to #!/usr/bin/env python3.5 made unicode work perfectly.

ability to source `.activate.sh` even if writeable by group ("Cowardly refusing to source .activate.sh because writeable by others")

Currently aactivator will not source any script that is "writeable by others":

elif pathstat & (stat.S_IWGRP | stat.S_IWOTH):

In my case the files are just writeable by me and group members but not "others". While I can see that you really want to have tight restrictions in some places, I'm willing to accept group writeable files and directories.

It would be nice if there was an option to loosen the restriction a bit.

Checks for group permission despise not mentioned in the docs

Hey im trying to use aactivator with zsh on ubuntu 22.04

I setup a venv in my project with virtualenv venv and then created a symlink with ln -s venv/bin/activate .activate.sh

But aactivator is then telling me that its cowardly refusing to source .activate.sh because it is writable by others.
But permissions of venv/bin/activate are 0664

In the code here

elif pathstat & (stat.S_IWGRP | stat.S_IWOTH):
the security checks not only for write permissions of others (stat.S_IWOTH) but also if the group can write (stat.S_IWGRP).

This is not mentioned in the docs and also the error message is misleading.

Is this intended? Or am i just not seeing something?

I followed the steps shown here https://youtu.be/q8DkatMZvUs?t=1519

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.