Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.1 #3

Merged
merged 76 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
ca65d35
add dev-requirements for reserver package
AHReccese Jan 13, 2024
108a439
import uploader object in `__init__`
AHReccese Jan 19, 2024
c19d101
add function to check given name existance as a package name
AHReccese Jan 19, 2024
46784b7
add function to generate template `setup.py` for the given name
AHReccese Jan 19, 2024
0028cf8
`Uploader` object initialization
AHReccese Jan 19, 2024
81eb47e
add `upload_to_pypi` function
AHReccese Jan 19, 2024
b0c4da8
add pypi associated params to `reserver_param.py`
AHReccese Jan 19, 2024
e8e7e07
add docstring for functions in `reserver_func.py`
AHReccese Jan 19, 2024
c10d31d
update docstring
AHReccese Jan 19, 2024
f49afe5
add `is_platform_linux` & `get_random_name` utility function
AHReccese Jan 19, 2024
8635a16
apply `autopep8.sh`
AHReccese Jan 19, 2024
55bd135
add `test.pypi` credentials to test.yml
AHReccese Jan 19, 2024
9e45352
add package name to the params
AHReccese Jan 19, 2024
4763bc6
update test step's name
AHReccese Jan 19, 2024
b2b2665
reserved name package upload test case
AHReccese Jan 19, 2024
cce915e
update .gitignore
AHReccese Jan 20, 2024
78d4ed1
update the exception's description
AHReccese Jan 20, 2024
f8c047f
update test files
AHReccese Jan 20, 2024
cbf017c
add requests requirement to `dev-requirements.txt`
AHReccese Jan 20, 2024
03f1763
add timeout to `get` request
AHReccese Jan 20, 2024
0b8c547
add `bandit` config file
AHReccese Jan 20, 2024
894ac77
update `test.yml`
AHReccese Jan 20, 2024
739737e
update docstring issues reported by `pydocstyle`
AHReccese Jan 20, 2024
1be1feb
clean `imports` part
AHReccese Jan 20, 2024
f93239c
add return value for `upload_to_pypi` function
AHReccese Jan 20, 2024
e8e63e4
handle invalid PyPI API Key
AHReccese Jan 20, 2024
6d07a8f
split test cases
AHReccese Jan 20, 2024
0a171bb
enhance docstrings
AHReccese Jan 20, 2024
2f30b8d
remove python 3.6 support for now
AHReccese Jan 20, 2024
07ffc0c
remove assert & dummy pass detection rules in bandit
AHReccese Jan 20, 2024
bc0a473
add test case to `README.md`
AHReccese Jan 20, 2024
6565553
add placeholder for github stars
AHReccese Jan 20, 2024
d71d7d3
add placeholder for PyPI counter
AHReccese Jan 20, 2024
419d838
update `CHANGELOG.md`
AHReccese Jan 20, 2024
2476f62
`dev-requirements.txt` updated
AHReccese Jan 23, 2024
7e8af9d
`requirements.txt` updated
AHReccese Jan 23, 2024
4025d3d
remove installation of requirements
AHReccese Jan 23, 2024
38c7288
temporarily removed `importlib-metadata<5.0`
AHReccese Jan 23, 2024
c972cbe
remove unused import
AHReccese Jan 23, 2024
a8bda05
remove `is_platform_linux` function
AHReccese Jan 23, 2024
5dadf3c
move `get_random_name` function from `utils.py` to `reserver_func.py`
AHReccese Jan 24, 2024
4e0a4cc
update template `setup.py`
AHReccese Jan 24, 2024
3018bda
update docstrings
AHReccese Jan 24, 2024
970922a
remove `util.py` and add inner functionalities to `reserver_func.py`
AHReccese Jan 24, 2024
f2fce33
update test file import
AHReccese Jan 24, 2024
8d88a2d
update author email
AHReccese Jan 24, 2024
2143bd8
add logo to readme
AHReccese Jan 25, 2024
c11cf8f
partially update discord badge
AHReccese Jan 25, 2024
d35cfd0
add Logo `.png` file
AHReccese Jan 25, 2024
8864641
fullfil discord badges
AHReccese Jan 25, 2024
17bfb6b
fullfil `pypi` badge in `README.md`
AHReccese Jan 25, 2024
647aed9
add References + fix typo
AHReccese Jan 29, 2024
075dec4
remove `\n` from packages
AHReccese Jan 29, 2024
e39d220
add functionality to create folder with the package name with a __ini…
AHReccese Jan 29, 2024
62155a1
make param name shorter
AHReccese Jan 29, 2024
a3ebc6c
handle "-" issue in `.eggfile`(replace with "_")
AHReccese Jan 29, 2024
e58e77c
handle too similiar name
AHReccese Jan 29, 2024
81c84fc
remove extra print in `reserver_obj.py`
AHReccese Jan 29, 2024
932de11
update test cases
AHReccese Jan 29, 2024
bc603d5
`README.md` updated
AHReccese Jan 29, 2024
2497c43
`CHANGELOG.md` updated
AHReccese Feb 3, 2024
152a128
logo name updated
AHReccese Feb 3, 2024
8afbadf
fix `requests` requirment to trigger dependent bot
AHReccese Feb 3, 2024
28f1487
add `requests` to package main requirments
AHReccese Feb 3, 2024
54f7b67
remove python 3.6
AHReccese Feb 3, 2024
b9ff69f
correct typo in docstring
AHReccese Feb 3, 2024
258ec37
ensure env variables are popped out
AHReccese Feb 3, 2024
9593254
change `>=` to `==` in basic requirments' version to trigger dependen…
AHReccese Feb 3, 2024
34e5e32
Bump twine from 4.0.0 to 4.0.2 (#6)
dependabot[bot] Feb 5, 2024
2b989f0
Bump requests from 1.0.0 to 2.31.0 (#7)
dependabot[bot] Feb 5, 2024
87eaec4
Bump wheel from 0.40.0 to 0.42.0 (#8)
dependabot[bot] Feb 5, 2024
ea307cf
Bump setuptools from 40.8.0 to 69.0.3 (#9)
dependabot[bot] Feb 5, 2024
816438d
`Disclaimer` section added
AHReccese Feb 6, 2024
88bad99
Merge branch 'dev' of https://github.com/openscilab/reserver into dev
AHReccese Feb 6, 2024
afe8568
add disclaimer to table of index
AHReccese Feb 6, 2024
b781c1d
`README.md` updated
AHReccese Feb 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bandit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bandit]
skips=B404,B602,B101,B105
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest, macOS-latest]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0, 3.11.0, 3.12.0]
python-version: [3.7, 3.8, 3.9, 3.10.0, 3.11.0, 3.12.0]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -32,17 +32,20 @@ jobs:
python otherfiles/requirements-splitter.py
pip install --upgrade --upgrade-strategy=only-if-needed -r test-requirements.txt
- name: Test with pytest
env:
TWINE_TEST_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_TEST_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
python -m pytest . --cov=reserver --cov-report=term
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
if: matrix.python-version == env.TEST_PYTHON_VERSION && matrix.os == env.TEST_OS
- name: Other tests
- name: vulture, bandit and pydocstyle tests
run: |
python -m vulture reserver/ otherfiles/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size
python -m bandit -r reserver -s B311
python -m bandit -r reserver .
python -m pydocstyle -v
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Version check
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,4 @@ ENV/
out
gen

/tests/exported_linear_models
/tests/exported_neural_networks
/tests/exported_decision_trees
/tests/exported_clusterings
/.VSCodeCounter
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.1] - 2022-08-17
### Added
### Changed
## [0.1] - 2024-02-07
### Added
- `Uploader` class
- Check package name existence
- Upload template package to test.pypi
- Upload template package to pypi
- Generate template package for a given name
- Handle similiar name existance in pypi
- Handle issue with "-" character `.egginfo` file name

[Unreleased]: https://github.com/openscilab/reserver/compare/v0.1...dev
[0.1]: https://github.com/openscilab/reserver/compare/3598e8b...v0.1
[0.1]: https://github.com/openscilab/reserver/compare/0ae5bb9...v0.1
43 changes: 27 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<div align="center">
<img src="https://github.com/openscilab/reserver/raw/main/otherfiles/logo.png" width="280" height="400">
<img src="https://github.com/openscilab/reserver/raw/main/otherfiles/reserver.png" width="300" height="300">
<br/>
<br/>
<a href="https://codecov.io/gh/openscilab/reserver">
<img src="https://codecov.io/gh/openscilab/reserver/branch/main/graph/badge.svg" alt="Codecov"/>
</a>
<a href="TODO">
<img src="TODO" alt="PyPI version" height="18">
<a href="https://badge.fury.io/py/reserver">
<img src="https://badge.fury.io/py/reserver.svg" alt="PyPI version" height="18">
</a>
<a href="https://www.python.org/">
<img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3">
</a>
<a href="TODO">
<img src="TODO" alt="Discord Channel">
<a href="https://discord.gg/RD2y6SGuY3">
<img src="https://img.shields.io/discord/1064533716615049236.svg" alt="Discord Channel">
</a>
</div>

----------

## Table of contents

* [Disclaimer](https://github.com/openscilab/reserver#disclaimer)
* [Overview](https://github.com/openscilab/reserver#overview)
* [Installation](https://github.com/openscilab/reserver#installation)
* [Usage](https://github.com/openscilab/reserver#usage)
Expand All @@ -32,25 +33,29 @@
* [Changelog](https://github.com/openscilab/reserver/blob/main/CHANGELOG.md)
* [Code of Conduct](https://github.com/openscilab/reserver/blob/main/.github/CODE_OF_CONDUCT.md)

## Disclaimer
<p align="justify">
⚠️The intention of this package is facilitating the reservation of package names on PyPI for legitimate and appropriate purposes. We explicitly disclaim any responsibility for the misuse or spamming of this tool, particularly in the excessive reservation of package names. Users are advised to be cautious and ensure the legitimate use of this package to avoid potential consequences such as the suspension of their PyPI account. By using this package, users acknowledge and agree to these terms.
</p>

## Overview
<p align="justify">
Reserver is an open source Python package that provides functionality to easily reserve a pypi package name. Have an idea? Reserve the package name instantly before it gets taken!
Reserver is an open source Python package that offers the ability to quickly reserve a PyPI package name. Got a notion? Before it's taken, immediately reserve the product name!
</p>
<table>
<tr>
<td align="center">PyPI Counter</td>
<td align="center">
<a href="TODO">
<img src="TODO">
<a href="http://pepy.tech/project/reserver">
<img src="http://pepy.tech/badge/reserver">
</a>
</td>
</tr>
<tr>
<td align="center">Github Stars</td>
<td align="center">
<a href="https://github.com/openscilab/reserver">
<img src="TODO">
<img src="https://img.shields.io/github/stars/openscilab/reserver.svg?style=social&label=Stars">
</a>
</td>
</tr>
Expand Down Expand Up @@ -84,9 +89,11 @@ Reserver is an open source Python package that provides functionality to easily
- Run `pip install .`

## Usage
### Reserve a specific pypi package name
```pycon
>>> TODO
### Secure your desired PyPI package name!
```python
from reserver import Uploader
uploader = Uploader(PYPI_API_TOKEN, test_pypi= False)
uploader.upload_to_pypi("CONSIDERED_NAME_FOR_YOUR_PACKAGE")
```

## Issues & bug reports
Expand All @@ -97,16 +104,20 @@ Just fill an issue and describe it. We'll check it ASAP! or send an email to [in

You can also join our discord server

<a href="TODO">
<img src="TODO" alt="Discord Channel">
<a href="https://discord.gg/RD2y6SGuY3">
<img src="https://img.shields.io/discord/1064533716615049236.svg?style=for-the-badge" alt="Discord Channel">
</a>

## References

## Show Your Support
### flaticon.com
+ box: <a href="https://www.flaticon.com/free-icons/box" title="box icons">Box icons created by Good Ware - Flaticon</a>
+ reserve plate: <a href="https://www.flaticon.com/free-icons/reserved" title="reserved icons">Reserved icons created by Freepik - Flaticon</a>


### Star this repo
## Show your support

### Star this repo
Give a ⭐️ if this project helped you!

### Donate to our project
Expand Down
9 changes: 9 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
requests==2.31.0
setuptools==69.0.3
wheel==0.42.0
twine==4.0.2
vulture>=1.0
bandit>=1.5.1
pydocstyle>=3.0.0
pytest>=4.3.1
pytest-cov>=2.6.1
Binary file added otherfiles/reserver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
requests>=1.0.0
setuptools>=40.8.0
wheel>=0.40.0
twine>=4.0.0
1 change: 1 addition & 0 deletions reserver/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""Reserver modules."""
from .reserver_param import RESERVER_VERSION
from .reserver_obj import Uploader

__version__ = RESERVER_VERSION
103 changes: 102 additions & 1 deletion reserver/reserver_func.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,103 @@
# -*- coding: utf-8 -*-
"""Functions."""
"""Reserver functions."""
from requests import get
from .reserver_param import PYPI_TEST_URL, PYPI_MAIN_URL
from hashlib import sha256
from time import time
from os import mkdir, rmdir


def get_random_name():
"""
Generate a random str based on current timestamp.

:return: str
"""
return sha256(str(time()).encode("utf-8")).hexdigest()


def does_package_exist(suggested_name, test_pypi):
"""
Check whether a package with the given name exists or not.

:param suggested_name: given name to search in pypi(or test.pypi)
:type suggested_name: str
:param test_pypi: indicates to search in test.pypi or not
:type test_pypi: bool
:return: whether given name does exist in the pypi or not(as a boolean value)
"""
if not isinstance(suggested_name, str):
suggested_name = str(suggested_name)
if test_pypi:
url = PYPI_TEST_URL + "/" + suggested_name + "/"
else:
url = PYPI_MAIN_URL + "/" + suggested_name + "/"
response = get(url, timeout=5)
return not response.status_code == 404


def generate_template_setup_py(package_name):
"""
Generate a template `setup.py` file for given package name.

:param package_name: given name to generate template `setup.py` for it.
:type package_name: str
:return: None
"""
setup_py_content = """
import sys

try:
from setuptools import setup
except ImportError:
from distutils.core import setup

# invalid email
# download url
# url
# project urls

setup(
name =""" + "\"" + package_name + "\"" + """,
packages=[""" + "\"" + package_name + "\"" + "," + """],
version='0.0.0',
description='This name has been reserved using Reserver',
long_description=\"\"\"
This name has been reserved using [Reserver](https://github.com/openscilab/reserver).
\"\"\",
long_description_content_type='text/markdown',
author='Development Team',
author_email='test@test.com',
url='https://url.com',
download_url='https://download_url.com',
keywords="python3 python reserve reserver reserved",
project_urls={
'Source': 'https://github.com/source',
},
install_requires="",
python_requires='>=3.6',
classifiers=[
\'Development Status :: 1 - Planning\',
\'Programming Language :: Python :: 3.6\',
\'Programming Language :: Python :: 3.7\',
\'Programming Language :: Python :: 3.8\',
\'Programming Language :: Python :: 3.9\',
\'Programming Language :: Python :: 3.10\',
\'Programming Language :: Python :: 3.11\',
\'Programming Language :: Python :: 3.12\',
],
license='MIT',
)

"""
with open(package_name + "_setup.py", "w+") as f:
f.writelines(setup_py_content)

try:
mkdir(package_name)
except FileExistsError:
rmdir(package_name)
mkdir(package_name)
with open(package_name + "/__init__.py", "w") as f:
f.write("# -*- coding: utf-8 -*-\n")
f.write("\"\"\"" + package_name + " modules." + "\"\"\"")
Loading
Loading